abi.cc -> abi_type.cc
[musl-tools.git] / maketags.sh
blobf634f219a61b98ecba2d0e08bf3ea197a9c08ea3
1 #!/bin/sh
3 export LC_ALL=C
4 MUSL=${MUSL:-../musl}
7 cd $MUSL/include
8 ctags -f /tmp/musl.tags -R -n -u --language-force=c --c-kinds=pxdstuve --fields=k --exclude='*.sh' .
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
14 awk -v inc=$MUSL/include/ '
15 BEGIN {
16 FS="\t"
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
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