X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=emacs%2Fptags;h=55512014ff4f4c73ada3e97f212655fdabb6530d;hb=1779d84dfb511a39bc8c645afc698f9dce95ef29;hp=c32a1289ec92f9708931531b023f861ab79a5983;hpb=3419a968bbeefe011eeb78c3583a321853782e93;p=p5sagit%2Fp5-mst-13.2.git diff --git a/emacs/ptags b/emacs/ptags index c32a128..5551201 100755 --- a/emacs/ptags +++ b/emacs/ptags @@ -14,15 +14,20 @@ # Use Hallvard's scan for XS files - since he processes the "C" part too - # but with a lot of improvements: now it is no worse than CPerl's one. -# Avoid builitin on OS/2: +# Avoid builtin on OS/2: if test ! -z "$OS2_SHELL"; then alias find=gnufind; fi # Insure proper order (.h after .c, .xs before .c in subdirs): -topfiles="`echo ' ' *.y *.c *.h ' ' | sed 's/ embed.h / /' | sed 's/ globals.c / /'`" -subdirfiles="`( find ./*/* -name '*.[cy]' -print | sort ; find ./*/* -name '*.[hH]' -print | sort )`" +# Move autogenerated less-informative files to the end: +# Hard to do embed.h and embedvar.h in one sweep: + +topfiles="`echo ' ' *.y *.c *.h ' ' | sed 's/ / /g' | sed 's/ embedvar\.h\|embed\.h\|perlapi\.h\|\(globals\|perlapi\)\.c / /g'`" +subdirs="`find ./* -maxdepth 0 -type d`" +subdirfiles="`find $subdirs -name '*.[cy]' -print | sort`" +subdirfiles1="`find $subdirs -name '*.[hH]' -print | sort`" xsfiles="`find . -name '*.xs' -print | sort`" -# etags -d : process defineds too (default now) +# etags -d : process defines too (default now) # These are example lines for global variables and PP-code: ## IEXT SV * Iparsehook; @@ -32,10 +37,12 @@ xsfiles="`find . -name '*.xs' -print | sort`" ## PERLVARI(Grsfp, PerlIO *, Nullfp) ## PERLVAR(cvcache, HV *) +# Putting PL_\1 in the substitution line makes etags dump core +# Thus we do it later (but 20.2.92 does it OK). set x -d -l c \ -r '/[dI]?EXT\(CONST\)?[ \t*]+\([a-zA-Z_0-9]+[ \t*]+\)*\([a-zA-Z_0-9]+\)[ \t]*\($\|;\|\[\|[ \t]I+NIT[ \t]*(\|\/\*\)/\3/' \ -r '/IEXT[ \t][^\/]*[ \t*]I\([a-zA-Z_][a-zA-Z_0-9]*\)[\[; \t]/\1/' \ - -r '/PERLVAR[a-zA-Z_0-9]*[ \t]*([ \t]*[GIT]?\([a-zA-Z_][a-zA-Z_0-9]*\)[ \t]*,/\1/' \ + -r '/PERLVAR[a-zA-Z_0-9]*[ \t]*([ \t]*[GIT]?\([a-zA-Z_][a-zA-Z_0-9]*\)[ \t]*[\[,]/\1/' \ -r '/PP[ \t]*([ \t]*\([^ \t()]*\)[ \t]*)/\1/' shift @@ -46,17 +53,65 @@ rm -f TAGS.tmp TAGS.tm2 etags -o TAGS.tmp \ -l none -r '/#\(\$[a-zA-Z_0-9]+\|define\)[ \t]+\([a-zA-Z_0-9]+\)/\2/' \ config_h.SH +# Process lines like this: Mcc (Loc.U): +etags -o TAGS.tmp -a \ + -l none -r '/^\([a-zA-Z_0-9]+\)[ \t]+(/\$\1/' \ + -r '/^\([a-zA-Z_0-9]+\)[ \t]+(/\1/' Porting/Glossary + etags -o TAGS.tmp -a "$@" $topfiles + +# Now add these PL_: +perl -w014pe 'if (s/^( .* PERLVAR A?I? # 1: TAG group + \s* \( \s* [GIT] # + .* # + \x7F # End of description + ) + ( .* \x01 ) # 2: Exact group + /${1}PL_$2/mgx) { # Add PL_ + $chars = chomp; + s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e; + $_ .= ("\f" x $chars); + }' TAGS.tmp > TAGS.tm1 && mv TAGS.tm1 TAGS.tmp + + +# Now remove these Perl_, add empty- and perl_-flavors: +perl -w014pe 'if (s/^(Perl_ # 1: First group + (\w+) \( # 2: Stripped name + \x7F # End of description + ) # End of description + (\d+,\d+\n) # 3: TAGS Trail + /$1$3$1$2\x01$3$1perl_$2\x01$3/mgx) { # Repeat, add empty and perl_ flavors + $chars = chomp; + s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e; + $_ .= ("\f" x $chars); + }' TAGS.tmp > TAGS.tm1 && mv TAGS.tm1 TAGS.tmp + +# Now remove these S_, add empty-flavor: +perl -w014pe 'if (s/^(S_ # 1: First group + (\w+) \( # 2: Stripped name + \x7F # End of description + ) # End of description + (\d+,\d+\n) # 3: TAGS Trail + /$1$3$1$2\x01$3/mgx) { # Repeat, add empty_ flavor + $chars = chomp; + s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e; + $_ .= ("\f" x $chars); + }' TAGS.tmp > TAGS.tm1 && mv TAGS.tm1 TAGS.tmp + etags -o TAGS.tmp -a -D -l none -r '/#define.*\t\(Perl_.*\)/\1/' embed.h -etags -o TAGS.tmp -a globals.c +etags -o TAGS.tmp -a globals.c embedvar.h perlapi.c perlapi.h -perl -w014pe 'if (s/^( [^\n\x7F\x1]*\b # 1: TAG group +# The above processes created a lot of descriptions with an +# an explicitly specified tag. Such descriptions have higher +# precedence than descriptions without an explicitely specified tag. +# To restore the justice, make all the descriptions explicit. +perl -w014pe 'if (s/^( [^\n\x7F\x01]*\b # 1: TAG group (\w+) # 2: word - [^\w\x7X\x1\n]* # Most anything + [^\w\x7F\x01\n]* # Most anything \x7F # End of description ) (\d+,\d+\n) # 3: TAGS Trail - /$1$2\x1$3/mgx) { # Add specific marking + /$1$2\x01$3/mgx) { # Add specific marking $chars = chomp; s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e; $_ .= ("\f" x $chars); @@ -83,6 +138,7 @@ etags -o TAGS.tmp -a -d -l c \ # $xsfiles etags -o TAGS.tmp -a "$@" $subdirfiles +etags -o TAGS.tmp -a "$@" $subdirfiles1 if test ! -f emacs/cperl-mode.elc ; then ( cd emacs; emacs -batch -q -no-site-file -f batch-byte-compile cperl-mode.el )