X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=maketags.sh;h=cf3319459313460ae2af037dae47d7d9b87f8fae;hb=42056842b1310d2f3c5f2c49aa51f568bc689ff7;hp=c64907ade3ba19ab989f3352b71349ca8fd4dd8a;hpb=20a09623ad0b2fd91d81eb6260ebbeed1fbac53b;p=musl-tables diff --git a/maketags.sh b/maketags.sh index c64907a..cf33194 100755 --- a/maketags.sh +++ b/maketags.sh @@ -1,23 +1,41 @@ #!/bin/sh export LC_ALL=C -MUSL=../musl +MUSL=${MUSL:-../musl} ( cd $MUSL/include ctags -f /tmp/musl.tags -R -n -u --language-force=c --c-kinds=pxdstuv --fields=k --exclude='*.sh' . + + # fix wchar_t bug of ctags + awk '/typedef.* wchar_t/{print "wchar_t\tbits/alltypes.h\t" NR ";\"\tt"}' bits/alltypes.h >>/tmp/musl.tags ) -awk ' +awk -v inc=$MUSL/include/ ' BEGIN { FS="\t" } +function proto(t,h,n) { + cmd = "awk '\''NR==" n + if (t == "p") + cmd = cmd "{s=$0; if(s!~/;/){getline; s=s \" \" $0} print s; exit}" + else if (t == "d") + cmd = cmd "{s=$0; while(gsub(/\\\\$/,\"\",s)){getline; s=s $0} print s; exit}" + else + return "" + cmd = cmd "'\'' " inc h + cmd | getline s + close(cmd) + gsub(/\t/, " ", s) + gsub(/ +/, " ", s) + return s +} /^[^!]/ { gsub(/[^0-9]*/,"",$3) if ($4 == "s") $1 = "struct " $1 if ($4 == "u") $1 = "union " $1 - print $1 "\t" $2 "\t" $4 "\t" $3 + print $1 "\t" $2 "\t" $4 "\t" $3 "\t" proto($4,$2,$3) }' /tmp/musl.tags |sort >data/musl.tags rm -f /tmp/musl.tags