sizeof renames
[musl-tables] / maketags.sh
1 #!/bin/sh
2
3 export LC_ALL=C
4 MUSL=${MUSL:-../musl}
5
6 (
7         cd $MUSL/include
8         ctags -f /tmp/musl.tags -R -n -u --language-force=c --c-kinds=pxdstuv --fields=k --exclude='*.sh' .
9
10         # fix wchar_t bug of ctags
11         awk '/typedef.* wchar_t/{print "wchar_t\tbits/alltypes.h\t" NR ";\"\tt"}' bits/alltypes.h >>/tmp/musl.tags
12 )
13
14 awk -v inc=$MUSL/include/ '
15 BEGIN {
16         FS="\t"
17 }
18 function proto(t,h,n) {
19         cmd = "awk '\''NR==" n
20         if (t == "p")
21                 cmd = cmd "{s=$0; if(s!~/;/){getline; s=s \" \" $0} print s; exit}"
22         else if (t == "d")
23                 cmd = cmd "{s=$0; while(gsub(/\\\\$/,\"\",s)){getline; s=s $0} print s; exit}"
24         else
25                 return ""
26         cmd = cmd "'\'' " inc h
27         cmd | getline s
28         close(cmd)
29         gsub(/\t/, " ", s)
30         gsub(/ +/, " ", s)
31         gsub(/ \(/, "(", s)
32         return s
33 }
34 /^[^!]/ {
35         gsub(/[^0-9]*/,"",$3)
36         if ($4 == "s")
37                 $1 = "struct " $1
38         if ($4 == "u")
39                 $1 = "union " $1
40         print $1 "\t" $2 "\t" $4 "\t" $3 "\t" proto($4,$2,$3)
41 }' /tmp/musl.tags |sort >data/musl.tags
42 rm -f /tmp/musl.tags