Ilya Zakharevich on Thu, 10 Sep 1998 01:07:22 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Newer etags support patch


This is a newer variant.  It has "configurable" names of the files
with the crossreference data.

To understand what this gives in addition to the standard C tags, do

   M-. component
   C-u M-.

Enjoy,
Ilya

--- ./src/make_tags.pre	Wed Sep  9 21:23:20 1998
+++ ./src/make_tags	Wed Sep  9 21:28:48 1998
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# Generate a tags file which contains PARI functions, and allows going
+# to help-message for a PARI functions and to a PARI function of C function
+# by repeated C-u M-.
+
+# If you are reading this, you may enjoy imenu-go.el from
+#    ftp://ftp.math.ohio-state.edu/pub/users/ilya/emacs/
+
+# Skip language/init.c, gp/gp_init.c and language/helpmessages.c:
+
+messages='language/helpmsg.c'
+gp_init='gp/gp_init.c'
+init_c='language/init.c'
+
+excluded=`perl -e 'print join "\n", 
+                      grep { $_ ne "'$init_c'" 
+			     and $_ ne "'$messages'"
+			     and $_ ne "'$gp_init'" }
+                           <*/*.[chs]>, <*/*/*.[chs]>'`
+
+etags $excluded
+
+# Process declarations like
+
+# {"polredord",1,(void*)ordred,6,"Gp"},
+
+# => an entry for polredord, and an entry for ordred as well
+# (so that one may find which PARI function is implemented by the C one)
+
+re='[ \t]*{[ \t]*"\([a-zA-Z_0-9]+\)"[ \t]*,[ \t]*[0-9]+[ \t]*,[ \t]*([ \t]*void[ \t]*\*[ \t]*)[ \t]*\([a-zA-Z0-9+]+\)[ \t]*,'
+
+etags -a -l c -o TAGS.tmp     -r "/$re/\\1/" -r "/$re/\\2/" $init_c
+
+# Process helpmessages too:
+#  "printtex(a): outputs a in TeX format",
+
+helpre='[ \t]*"\([a-zA-Z_0-9]+\)[=(]'
+
+etags -a -l c -o TAGS.tmp     -r "/$re/\\1/" -r "/$re/\\2/" \
+    -r "/$helpre/\\1/"    $gp_init
+
+etags -a -l c -o TAGS.tmp     -r "/$helpre/\\1/"  $messages
+
+# This would produces a wrong entry size - though AFAIK, nobody uses it
+# uniq TAGS.tm >> TAGS
+
+perl -w014pe 'if (s/^(.*\n)\1+/$1/mg) {		# Remove duplicate lines
+		  $chars = chomp;
+		  s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e;
+		  $_ .= ("\f" x $chars);
+	      }' TAGS.tmp > TAGS.tm2
+
+# Since we generate *specific* definitions for the functions in the table,
+# they will be prefered by Emacs over non-specific ones for the code, so we 
+# convert non-specific definitions into specific ones (with \x1):
+
+perl -w014pe 'if (s/^( [^\n\x7F\x1]*\b	# 1:   TAG group
+	               (\w+)		#   2: word
+		       [^\w\x7X\x1\n]*	#      Most anything
+		       \x7F		#      End of description
+		     )
+		     (\d+,\d+\n)	# 3:   TAGS Trail
+		   /$1$2\x1$3/mgx) {	# Add specific marking
+		  $chars = chomp;
+		  s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e;
+		  $_ .= ("\f" x $chars);
+	      }' TAGS > TAGS.tm1 && mv TAGS.tm1 TAGS
+
+cat TAGS.tm2 >> TAGS
+rm TAGS.tm*
--- ./config/TOP_Makefile.SH.pre	Thu Jul 23 08:40:00 1998
+++ ./config/TOP_Makefile.SH	Wed Sep  9 21:44:54 1998
@@ -41,6 +41,7 @@ dft target::
 	@echo "	all			Compile gp-sta gp-dyn lib-sta lib-dyn"
 	@echo "	distrib			For distribution of pari/gp"
 	@echo "	bigdistrib		Idem, with all directories"
+	@echo "	etags			Generate Emacs tags file in ./src"
 
 gp all ftest bench test test-compat test-graphic install clean cleantest install-bin install-lib-sta install-bin-sta dobench dotest::
 	cd $objdir; \$(MAKE) \$@
@@ -81,6 +82,9 @@ bigtar: tar
 
 tar: tarclean
 	$tar $fl $tarfile $config_dir/tar_exclude $inc $config_dir/tar_include
+
+etags:
+	cd src;  sh make_tags
 EOT
 
 $ln_s $file Makefile 

--BAA24969.905403707/monk.mps.ohio-state.edu--