[BACK]Return to make_emacs_tags CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / src

Annotation of OpenXM_contrib/pari-2.2/src/make_emacs_tags, Revision 1.2

1.1       noro        1: #!/bin/sh
                      2:
                      3: # Generate a tags file which contains PARI functions, and allows going
                      4: # to help-message for a PARI functions and to a PARI function of C function
                      5: # by repeated C-u M-.
                      6:
                      7: # If you are reading this, you may enjoy imenu-go.el from
                      8: #    ftp://ftp.math.ohio-state.edu/pub/users/ilya/emacs/
                      9:
                     10: # Skip language/init.c, gp/gp_init.c and language/helpmessages.c:
                     11:
1.2     ! noro       12: errors='language/errmsg.c'
1.1       noro       13: messages='language/helpmsg.c'
                     14: gp_init='gp/gp_init.c'
                     15: init_c='language/init.c'
                     16:
                     17: excluded=`perl -e 'print join "\n",
                     18:                       grep { $_ ne "'$init_c'"
1.2     ! noro       19:                             and $_ ne "'$errors'"
1.1       noro       20:                             and $_ ne "'$messages'"
                     21:                             and $_ ne "'$gp_init'" }
                     22:                            <*/*.[chs]>, <*/*/*.[chs]>'`
                     23:
1.2     ! noro       24: # Start with errmessages (otherwise enums will come first):
        !            25: #  /* suppler2 */
        !            26:
        !            27: errre='\/\*[ \t]*\([a-zA-Z_0-9]+\)[ \t]*\*\/'
        !            28:
        !            29: etags -r "/$errre/\\1/"  $errors
        !            30:
        !            31: # All files which do not require a special processing
        !            32: etags -a $excluded
1.1       noro       33:
                     34: # Process declarations like
                     35:
                     36: # {"polredord",1,(void*)ordred,6,"Gp"},
                     37:
                     38: # => an entry for polredord, and an entry for ordred as well
                     39: # (so that one may find which PARI function is implemented by the C one)
                     40:
                     41: re='[ \t]*{[ \t]*"\([a-zA-Z_0-9]+\)"[ \t]*,[ \t]*[0-9]+[ \t]*,[ \t]*([ \t]*void[ \t]*\*[ \t]*)[ \t]*\([a-zA-Z0-9+]+\)[ \t]*,'
                     42:
                     43: etags -a -l c -o TAGS.tmp     -r "/$re/\\1/" -r "/$re/\\2/" $init_c
                     44:
                     45: # Process helpmessages too:
                     46: #  "printtex(a): outputs a in TeX format",
                     47:
                     48: helpre='[ \t]*"\([a-zA-Z_0-9]+\)[=(]'
                     49:
                     50: etags -a -l c -o TAGS.tmp     -r "/$re/\\1/" -r "/$re/\\2/" \
                     51:     -r "/$helpre/\\1/"    $gp_init
                     52:
                     53: etags -a -l c -o TAGS.tmp     -r "/$helpre/\\1/"  $messages
                     54:
                     55: # This would produces a wrong entry size - though AFAIK, nobody uses it
                     56: # uniq TAGS.tm >> TAGS
                     57:
                     58: perl -w014pe 'if (s/^(.*\n)\1+/$1/mg) {                # Remove duplicate lines
                     59:                  $chars = chomp;
                     60:                  s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e;
                     61:                  $_ .= ("\f" x $chars);
                     62:              }' TAGS.tmp > TAGS.tm2
                     63:
                     64: # Since we generate *specific* definitions for the functions in the table,
                     65: # they will be prefered by Emacs over non-specific ones for the code, so we
                     66: # convert non-specific definitions into specific ones (with \x1):
                     67:
                     68: perl -w014pe 'if (s/^( [^\n\x7F\x01]*\b        # 1:   TAG group
                     69:                       (\w+)            #   2: word
                     70:                       [^\w\x7F\x01\n]* #      Most anything
                     71:                       \x7F             #      End of description
                     72:                     )
                     73:                     (\d+,\d+\n)        # 3:   TAGS Trail
                     74:                   /$1$2\x01$3/mgx) {   # Add specific marking
                     75:                  $chars = chomp;
                     76:                  s/^((\n.+,)\d+)/ $2 . (length($_) - length($1) - 1) /e;
                     77:                  $_ .= ("\f" x $chars);
                     78:              }' TAGS > TAGS.tm1 && mv TAGS.tm1 TAGS
                     79:
                     80: cat TAGS.tm2 >> TAGS
                     81: rm TAGS.tm*

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>