update makefile
[musl-tools.git] / tab_c11.sh
blob90c72495afde72e728878b57f81ed1f91404da5c
1 #!/bin/sh
3 export LC_ALL=C
4 MUSL=${MUSL:-../musl}
6 ( cd $MUSL; git log -n1 ) | awk '
7 BEGIN {
8 getline
9 hash = $2
10 getline
12 commit = "<h4>commit</h4><p>commit <a href=\"http://git.musl-libc.org/cgit/musl/commit/?id=" hash "\">" hash "</a>"
13 while (getline == 1)
14 commit = commit "<br>" $0
16 FS = "\t"
18 c11 = "data/c11"
19 syms = "data/musl.syms"
20 tags = "data/musl.tags"
22 while (getline < syms == 1)
23 sym[$2] = $1
24 while (getline < tags == 1) {
25 if ($2 ~ /bits\//)
26 s = $3 " "
27 else
28 s = "<a href=\"http://git.musl-libc.org/cgit/musl/tree/include/" $2 "#n" $4 "\">" $3 "</a> "
29 kind[$1] = kind[$1] $3
30 kindstr[$1] = kindstr[$1] s
33 legend = "<h4>legend</h4><ul><li>status: musl implementation status summary<ul>"
34 legend = legend "<li>(empty) - implemented"
35 legend = legend "<li>nosym - prototype found in include files (see decl) but not in libc.a (see sym)"
36 legend = legend "<li>nodecl - symbol is in libc.a but not declared in a public header"
37 legend = legend "<li>missing - neither in include files (see decl) nor in libc.a (see sym)"
38 legend = legend "</ul><li>sym: external symbol kind as found by `nm libc.a` (symbol kind only reported once)<ul>"
39 legend = legend "<li>C - symbol is common (uninitialized data)"
40 legend = legend "<li>D - symbol is in the initialized data section"
41 legend = legend "<li>R - symbol is in the read only data section"
42 legend = legend "<li>T - symbol is in the text section"
43 legend = legend "<li>V - weak object"
44 legend = legend "<li>W - weak symbol"
45 legend = legend "</ul><li>decl: kind of declaration as found by `ctags -R include` (every occurance is reported, arch specific definitions are not linked)<ul>"
46 legend = legend "<li>d - macro definition"
47 legend = legend "<li>t - typedef"
48 legend = legend "<li>s - struct declaration"
49 legend = legend "<li>u - union declaration"
50 legend = legend "<li>p - function prototype"
51 legend = legend "<li>x - external and forward variable declaration"
52 legend = legend "</ul></ul>"
53 legend = legend "<p>(Annex K apis are excluded: -D__STDC_WANT_LIB_EXT1__=0 is assumed)"
55 print "<h3>musl vs c11 api</h3>"
56 print commit
57 print legend
58 print "<h4>table</h4><table border=1><tr><th colspan=3>musl<th colspan=4>c11<tr><th>status<th>sym<th>decl<th>name<th>header<th>proto<th>section"
59 nodecl = nosym = missing = 0
60 while (getline < c11 == 1) {
61 s = "<tr><td>"
62 if (sym[$1] && kind[$1]) {
63 s = s "&#160;"
64 } else if (sym[$1]) {
65 s = s "nodecl"
66 nodecl++
67 } else if (kind[$1] ~ /[dtsue]/) {
68 s = s "&#160;"
69 } else if (kind[$1]) {
70 s = s "nosym"
71 nosym++
72 } else {
73 s = s "missing"
74 missing++
76 s = s "<td>" sym[$1]
77 if (!sym[$1])
78 s = s "&#160;"
79 s = s "<td>" kindstr[$1]
80 if (!kind[$1])
81 s = s "&#160;"
83 s = s "<td>" $1
84 s = s "<td>" $3
85 if ($2)
86 s = s "<td>" $2
87 else
88 s = s "<td>&#160;"
89 s = s "<td>" $4
90 print s
92 print "</table>"
93 print "<h4>stats</h4><ul><li>missing: " missing "<li>nosym: " nosym "<li>nodecl: " nodecl "</ul>"
94 }' >tab_c11.html