aboutsummaryrefslogtreecommitdiff
path: root/roles/webserver/files/www/memzero/pub/.gen.sh
blob: 9a8030e3fce57b05ee31e2193408d8c1479d244f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash

OUT=references.html

cat <<EOF > $OUT
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>references</title>
  <style>
    html {
      font-family: Source Code Pro, monospace, sans-serif;
      font-size: clamp(12px, 2vw, 16px);
    }
    button {
      font-family: inherit;
      font-size: inherit;
    }
  </style>
  <script>
    /// Map HTML elements to display kinds.
    const elementToDisplay = (E) => {
      switch (E.nodeName) {
        case "LI":
          return "list-item";
        default:
          return "block";
      }
    }

    /// Display only elements with tag T.
    const showTag = (T) => {
      Array.from(document.getElementsByClassName("content")).forEach(E => {
        E.style.display = "none";
      });

      Array.from(document.getElementsByClassName(T)).forEach(E => {
        E.style.display = elementToDisplay(E);
      });
    };

    /// Initialize buttons and callbacks.
    window.onload = () => {
      // Handle to the filter placeholder.
      const filter = document.getElementById("filter");

      // Create buttons for each tag T.
      ["clear", "sysv", "arm", "x86"].forEach(T => {
        const btn = document.createElement("button");
        btn.innerHTML = T;
        btn.onclick = T === "clear"
          ? (E) => {
            showTag("content");
            filter.innerHTML = "filter:";
          }
          : (E) => {
            showTag(T);
            filter.innerHTML = \`filter: <mark>\${T}</mark>\`;
          };
        filter.before(btn);
      });
    }
  </script>
</head>
<body>
  <p>Self-hosted collection of frequently referenced documents and specifications. This page provides links to the original sources.</p>
  <p id="filter">filter:</p>
  <ul>
EOF

emit() {
cat <<-EOF >> $OUT
    <li class="content $1">
      <a style="color:black;" href="/pub/$2">$2</a>
      [<a href="$3">original</a>]
    </li>
EOF
}

emit "sysv" abi/sysv/sysv-gabi4-2013 https://www.sco.com/developers/gabi/latest/contents.html
emit "sysv" abi/sysv/sysv-gabi41.pdf https://www.sco.com/developers/devspecs/gabi41.pdf

emit "sysv x86" abi/sysv-psabi-x86-64.pdf     https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/master/raw/x86-64-ABI/abi.pdf?job=build
emit "sysv arm" abi/sysv/sysv-psabi-arm64.pdf https://github.com/ARM-software/abi-aa/releases/download/2023Q3/aaelf64.pdf
emit "sysv arm" abi/arm/aapcs64.pdf           https://github.com/ARM-software/abi-aa/releases/download/2023Q3/aapcs64.pdf

emit "x86" arch/intel/intel64-optimization-ref-vol1.pdf    https://cdrdv2.intel.com/v1/dl/getContent/671488
emit "x86" arch/intel/intel64-optimization-ref-vol2.pdf    https://cdrdv2.intel.com/v1/dl/getContent/787036
emit "x86" arch/intel/intel64-vol1-architecture-manual.pdf https://cdrdv2.intel.com/v1/dl/getContent/671436
emit "x86" arch/intel/intel64-vol2-instruction-ref.pdf     https://cdrdv2.intel.com/v1/dl/getContent/671110
emit "x86" arch/intel/intel64-vol3-system-programming.pdf  https://cdrdv2.intel.com/v1/dl/getContent/671447

cat <<EOF >> $OUT
  </ul>
</body>
</html>
EOF