diff options
| -rw-r--r-- | lib-src/etags.c | 451 |
1 files changed, 239 insertions, 212 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 552a09d2f01..bbc3f690511 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -31,18 +31,21 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |||
| 31 | * Francesco Potorti` (pot@gnu.org) is the current maintainer. | 31 | * Francesco Potorti` (pot@gnu.org) is the current maintainer. |
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | char pot_etags_version[] = "@(#) pot revision number is 13.33"; | 34 | char pot_etags_version[] = "@(#) pot revision number is 13.38"; |
| 35 | 35 | ||
| 36 | #define TRUE 1 | 36 | #define TRUE 1 |
| 37 | #define FALSE 0 | 37 | #define FALSE 0 |
| 38 | 38 | ||
| 39 | #ifndef _GNU_SOURCE | ||
| 40 | # define _GNU_SOURCE /* enables some compiler checks on GNU */ | ||
| 41 | #endif | ||
| 42 | #ifndef DEBUG | 39 | #ifndef DEBUG |
| 43 | # define DEBUG FALSE | 40 | # define DEBUG FALSE |
| 44 | #endif | 41 | #endif |
| 45 | 42 | ||
| 43 | #if defined (__STDC__) && __STDC__ | ||
| 44 | # define P_(proto) proto | ||
| 45 | #else | ||
| 46 | # define P_(proto) () | ||
| 47 | #endif | ||
| 48 | |||
| 46 | #ifdef HAVE_CONFIG_H | 49 | #ifdef HAVE_CONFIG_H |
| 47 | # include <config.h> | 50 | # include <config.h> |
| 48 | /* On some systems, Emacs defines static as nothing for the sake | 51 | /* On some systems, Emacs defines static as nothing for the sake |
| @@ -52,7 +55,12 @@ char pot_etags_version[] = "@(#) pot revision number is 13.33"; | |||
| 52 | # define LONG_OPTIONS /* accept long options */ | 55 | # define LONG_OPTIONS /* accept long options */ |
| 53 | #endif /* HAVE_CONFIG_H */ | 56 | #endif /* HAVE_CONFIG_H */ |
| 54 | 57 | ||
| 58 | #ifndef _GNU_SOURCE | ||
| 59 | # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ | ||
| 60 | #endif | ||
| 61 | |||
| 55 | #ifdef MSDOS | 62 | #ifdef MSDOS |
| 63 | # define MSDOS TRUE | ||
| 56 | # include <fcntl.h> | 64 | # include <fcntl.h> |
| 57 | # include <sys/param.h> | 65 | # include <sys/param.h> |
| 58 | # include <io.h> | 66 | # include <io.h> |
| @@ -60,12 +68,15 @@ char pot_etags_version[] = "@(#) pot revision number is 13.33"; | |||
| 60 | # define DOS_NT | 68 | # define DOS_NT |
| 61 | # include <sys/config.h> | 69 | # include <sys/config.h> |
| 62 | # endif | 70 | # endif |
| 71 | #else | ||
| 72 | # define MSDOS FALSE | ||
| 63 | #endif /* MSDOS */ | 73 | #endif /* MSDOS */ |
| 64 | 74 | ||
| 65 | #ifdef WINDOWSNT | 75 | #ifdef WINDOWSNT |
| 66 | # include <stdlib.h> | 76 | # include <stdlib.h> |
| 67 | # include <fcntl.h> | 77 | # include <fcntl.h> |
| 68 | # include <string.h> | 78 | # include <string.h> |
| 79 | # include <direct.h> | ||
| 69 | # include <io.h> | 80 | # include <io.h> |
| 70 | # define MAXPATHLEN _MAX_PATH | 81 | # define MAXPATHLEN _MAX_PATH |
| 71 | # ifdef HAVE_CONFIG_H | 82 | # ifdef HAVE_CONFIG_H |
| @@ -76,17 +87,19 @@ char pot_etags_version[] = "@(#) pot revision number is 13.33"; | |||
| 76 | # ifndef HAVE_GETCWD | 87 | # ifndef HAVE_GETCWD |
| 77 | # define HAVE_GETCWD | 88 | # define HAVE_GETCWD |
| 78 | # endif /* undef HAVE_GETCWD */ | 89 | # endif /* undef HAVE_GETCWD */ |
| 79 | #endif /* WINDOWSNT */ | 90 | #else /* !WINDOWSNT */ |
| 80 | 91 | # ifdef STDC_HEADERS | |
| 81 | #if !defined (WINDOWSNT) && defined (STDC_HEADERS) | 92 | # include <stdlib.h> |
| 82 | #include <stdlib.h> | 93 | # include <string.h> |
| 83 | #include <string.h> | 94 | # else |
| 84 | #endif | 95 | extern char *getenv (); |
| 96 | # endif | ||
| 97 | #endif /* !WINDOWSNT */ | ||
| 85 | 98 | ||
| 86 | #ifdef HAVE_UNISTD_H | 99 | #ifdef HAVE_UNISTD_H |
| 87 | # include <unistd.h> | 100 | # include <unistd.h> |
| 88 | #else | 101 | #else |
| 89 | # ifdef HAVE_GETCWD | 102 | # if defined (HAVE_GETCWD) && !WINDOWSNT |
| 90 | extern char *getcwd (); | 103 | extern char *getcwd (); |
| 91 | # endif | 104 | # endif |
| 92 | #endif /* HAVE_UNISTD_H */ | 105 | #endif /* HAVE_UNISTD_H */ |
| @@ -192,70 +205,105 @@ typedef struct | |||
| 192 | char **interpreters; | 205 | char **interpreters; |
| 193 | } language; | 206 | } language; |
| 194 | 207 | ||
| 195 | extern char *getenv (); | 208 | typedef struct node_st |
| 209 | { /* sorting structure */ | ||
| 210 | char *name; /* function or type name */ | ||
| 211 | char *file; /* file name */ | ||
| 212 | bool is_func; /* use pattern or line no */ | ||
| 213 | bool been_warned; /* set if noticed dup */ | ||
| 214 | int lno; /* line number tag is on */ | ||
| 215 | long cno; /* character number line starts on */ | ||
| 216 | char *pat; /* search pattern */ | ||
| 217 | struct node_st *left, *right; /* left and right sons */ | ||
| 218 | } node; | ||
| 219 | |||
| 220 | /* | ||
| 221 | * A `linebuffer' is a structure which holds a line of text. | ||
| 222 | * `readline_internal' reads a line from a stream into a linebuffer | ||
| 223 | * and works regardless of the length of the line. | ||
| 224 | * SIZE is the size of BUFFER, LEN is the length of the string in | ||
| 225 | * BUFFER after readline reads it. | ||
| 226 | */ | ||
| 227 | typedef struct | ||
| 228 | { | ||
| 229 | long size; | ||
| 230 | int len; | ||
| 231 | char *buffer; | ||
| 232 | } linebuffer; | ||
| 196 | 233 | ||
| 197 | /* Many compilers barf on this: | 234 | /* Many compilers barf on this: |
| 198 | Lang_function Ada_funcs; | 235 | Lang_function Ada_funcs; |
| 199 | so let's write it this way */ | 236 | so let's write it this way */ |
| 200 | void Ada_funcs (); | 237 | static void Ada_funcs P_((FILE *inf)); |
| 201 | void Asm_labels (); | 238 | static void Asm_labels P_((FILE *inf)); |
| 202 | void C_entries (); | 239 | static void C_entries P_((int c_ext, FILE *inf)); |
| 203 | void default_C_entries (); | 240 | static void default_C_entries P_((FILE *inf)); |
| 204 | void plain_C_entries (); | 241 | static void plain_C_entries P_((FILE *inf)); |
| 205 | void Cjava_entries (); | 242 | static void Cjava_entries P_((FILE *inf)); |
| 206 | void Cobol_paragraphs (); | 243 | static void Cobol_paragraphs P_((FILE *inf)); |
| 207 | void Cplusplus_entries (); | 244 | static void Cplusplus_entries P_((FILE *inf)); |
| 208 | void Cstar_entries (); | 245 | static void Cstar_entries P_((FILE *inf)); |
| 209 | void Erlang_functions (); | 246 | static void Erlang_functions P_((FILE *inf)); |
| 210 | void Fortran_functions (); | 247 | static void Fortran_functions P_((FILE *inf)); |
| 211 | void Yacc_entries (); | 248 | static void Yacc_entries P_((FILE *inf)); |
| 212 | void Lisp_functions (); | 249 | static void Lisp_functions P_((FILE *inf)); |
| 213 | void Pascal_functions (); | 250 | static void Pascal_functions P_((FILE *inf)); |
| 214 | void Perl_functions (); | 251 | static void Perl_functions P_((FILE *inf)); |
| 215 | void Postscript_functions (); | 252 | static void Postscript_functions P_((FILE *inf)); |
| 216 | void Prolog_functions (); | 253 | static void Prolog_functions P_((FILE *inf)); |
| 217 | void Python_functions (); | 254 | static void Python_functions P_((FILE *inf)); |
| 218 | void Scheme_functions (); | 255 | static void Scheme_functions P_((FILE *inf)); |
| 219 | void TeX_functions (); | 256 | static void TeX_functions P_((FILE *inf)); |
| 220 | void just_read_file (); | 257 | static void just_read_file P_((FILE *inf)); |
| 221 | 258 | ||
| 222 | compressor *get_compressor_from_suffix (); | 259 | static compressor *get_compressor_from_suffix P_((char *file, char **extptr)); |
| 223 | language *get_language_from_name (); | 260 | static language *get_language_from_name P_((char *name)); |
| 224 | language *get_language_from_interpreter (); | 261 | static language *get_language_from_interpreter P_((char *interpreter)); |
| 225 | language *get_language_from_suffix (); | 262 | static language *get_language_from_suffix P_((char *file)); |
| 226 | int total_size_of_entries (); | 263 | static int total_size_of_entries P_((register node *np)); |
| 227 | long readline (), readline_internal (); | 264 | static long readline P_((linebuffer *lbp, FILE *stream)); |
| 228 | void get_tag (); | 265 | static long readline_internal P_((linebuffer *lbp, register FILE *stream)); |
| 266 | static void get_tag P_((register char *bp)); | ||
| 229 | 267 | ||
| 230 | #ifdef ETAGS_REGEXPS | 268 | #ifdef ETAGS_REGEXPS |
| 231 | void analyse_regex (); | 269 | static void analyse_regex P_((char *regex_arg, bool ignore_case)); |
| 232 | void add_regex (); | 270 | static void add_regex P_((char *regexp_pattern, bool ignore_case, language *lan)); |
| 233 | void free_patterns (); | 271 | static void free_patterns P_((void)); |
| 234 | #endif /* ETAGS_REGEXPS */ | 272 | #endif /* ETAGS_REGEXPS */ |
| 235 | void error (); | 273 | static void error P_((const char *s1, const char *s2)); |
| 236 | void suggest_asking_for_help (); | 274 | static void suggest_asking_for_help P_((void)); |
| 237 | void fatal (), pfatal (); | 275 | static void fatal P_((char *s1, char *s2)); |
| 238 | void add_node (); | 276 | static void pfatal P_((char *s1)); |
| 239 | 277 | static void add_node P_((node *np, node **cur_node_p)); | |
| 240 | void init (); | 278 | |
| 241 | void initbuffer (); | 279 | static void init P_((void)); |
| 242 | void find_entries (); | 280 | static void initbuffer P_((linebuffer *lbp)); |
| 243 | void free_tree (); | 281 | static void find_entries P_((char *file, FILE *inf)); |
| 244 | void pfnote (), new_pfnote (); | 282 | static void free_tree P_((register node *np)); |
| 245 | void process_file (); | 283 | static void pfnote P_((char *name, bool is_func, char *linestart, |
| 246 | void put_entries (); | 284 | int linelen, int lno, long int cno)); |
| 247 | void takeprec (); | 285 | static void new_pfnote P_((char *name, int namelen, bool is_func, |
| 248 | 286 | char *linestart, int linelen, int lno, long int cno)); | |
| 249 | char *concat (); | 287 | static void process_file P_((char *file)); |
| 250 | char *skip_spaces (), *skip_non_spaces (); | 288 | static void put_entries P_((register node *np)); |
| 251 | char *savenstr (), *savestr (); | 289 | static void takeprec P_((void)); |
| 252 | char *etags_strchr (), *etags_strrchr (); | 290 | |
| 253 | char *etags_getcwd (); | 291 | static char *concat P_((char *s1, char *s2, char *s3)); |
| 254 | char *relative_filename (), *absolute_filename (), *absolute_dirname (); | 292 | static char *skip_spaces P_((char *cp)); |
| 255 | bool filename_is_absolute (); | 293 | static char *skip_non_spaces P_((char *cp)); |
| 256 | void canonicalize_filename (); | 294 | static char *savenstr P_((char *cp, int len)); |
| 257 | void grow_linebuffer (); | 295 | static char *savestr P_((char *cp)); |
| 258 | long *xmalloc (), *xrealloc (); | 296 | static char *etags_strchr P_((const char *sp, int c)); |
| 297 | static char *etags_strrchr P_((const char *sp, int c)); | ||
| 298 | static char *etags_getcwd P_((void)); | ||
| 299 | static char *relative_filename P_((char *file, char *dir)); | ||
| 300 | static char *absolute_filename P_((char *file, char *dir)); | ||
| 301 | static char *absolute_dirname P_((char *file, char *dir)); | ||
| 302 | static bool filename_is_absolute P_((char *fn)); | ||
| 303 | static void canonicalize_filename P_((register char *fn)); | ||
| 304 | static void grow_linebuffer P_((linebuffer *lbp, int toksize)); | ||
| 305 | static long *xmalloc P_((unsigned int size)); | ||
| 306 | static long *xrealloc P_((char *ptr, unsigned int size)); | ||
| 259 | 307 | ||
| 260 | 308 | ||
| 261 | char searchar = '/'; /* use /.../ searches */ | 309 | char searchar = '/'; /* use /.../ searches */ |
| @@ -274,34 +322,8 @@ long charno; /* current character number */ | |||
| 274 | long linecharno; /* charno of start of current line */ | 322 | long linecharno; /* charno of start of current line */ |
| 275 | char *dbp; /* pointer to start of current tag */ | 323 | char *dbp; /* pointer to start of current tag */ |
| 276 | 324 | ||
| 277 | typedef struct node_st | ||
| 278 | { /* sorting structure */ | ||
| 279 | char *name; /* function or type name */ | ||
| 280 | char *file; /* file name */ | ||
| 281 | bool is_func; /* use pattern or line no */ | ||
| 282 | bool been_warned; /* set if noticed dup */ | ||
| 283 | int lno; /* line number tag is on */ | ||
| 284 | long cno; /* character number line starts on */ | ||
| 285 | char *pat; /* search pattern */ | ||
| 286 | struct node_st *left, *right; /* left and right sons */ | ||
| 287 | } node; | ||
| 288 | |||
| 289 | node *head; /* the head of the binary tree of tags */ | 325 | node *head; /* the head of the binary tree of tags */ |
| 290 | 326 | ||
| 291 | /* | ||
| 292 | * A `linebuffer' is a structure which holds a line of text. | ||
| 293 | * `readline_internal' reads a line from a stream into a linebuffer | ||
| 294 | * and works regardless of the length of the line. | ||
| 295 | * SIZE is the size of BUFFER, LEN is the length of the string in | ||
| 296 | * BUFFER after readline reads it. | ||
| 297 | */ | ||
| 298 | typedef struct | ||
| 299 | { | ||
| 300 | long size; | ||
| 301 | int len; | ||
| 302 | char *buffer; | ||
| 303 | } linebuffer; | ||
| 304 | |||
| 305 | linebuffer lb; /* the current line */ | 327 | linebuffer lb; /* the current line */ |
| 306 | linebuffer token_name; /* used by C_entries as a temporary area */ | 328 | linebuffer token_name; /* used by C_entries as a temporary area */ |
| 307 | struct | 329 | struct |
| @@ -531,7 +553,7 @@ language lang_names [] = | |||
| 531 | { NULL, NULL } /* end of list */ | 553 | { NULL, NULL } /* end of list */ |
| 532 | }; | 554 | }; |
| 533 | 555 | ||
| 534 | void | 556 | static void |
| 535 | print_language_names () | 557 | print_language_names () |
| 536 | { | 558 | { |
| 537 | language *lang; | 559 | language *lang; |
| @@ -556,20 +578,23 @@ Fortran is tried first; if no tags are found, C is tried next.\n\ | |||
| 556 | Compressed files are supported using gzip and bzip2."); | 578 | Compressed files are supported using gzip and bzip2."); |
| 557 | } | 579 | } |
| 558 | 580 | ||
| 581 | #ifndef EMACS_NAME | ||
| 582 | # define EMACS_NAME "GNU Emacs" | ||
| 583 | #endif | ||
| 559 | #ifndef VERSION | 584 | #ifndef VERSION |
| 560 | # define VERSION "20" | 585 | # define VERSION "21" |
| 561 | #endif | 586 | #endif |
| 562 | void | 587 | static void |
| 563 | print_version () | 588 | print_version () |
| 564 | { | 589 | { |
| 565 | printf ("%s (GNU Emacs %s)\n", (CTAGS) ? "ctags" : "etags", VERSION); | 590 | printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); |
| 566 | puts ("Copyright (C) 1999 Free Software Foundation, Inc. and Ken Arnold"); | 591 | puts ("Copyright (C) 1999 Free Software Foundation, Inc. and Ken Arnold"); |
| 567 | puts ("This program is distributed under the same terms as Emacs"); | 592 | puts ("This program is distributed under the same terms as Emacs"); |
| 568 | 593 | ||
| 569 | exit (GOOD); | 594 | exit (GOOD); |
| 570 | } | 595 | } |
| 571 | 596 | ||
| 572 | void | 597 | static void |
| 573 | print_help () | 598 | print_help () |
| 574 | { | 599 | { |
| 575 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ | 600 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ |
| @@ -750,7 +775,7 @@ typedef struct { | |||
| 750 | #include <rmsdef.h> | 775 | #include <rmsdef.h> |
| 751 | #include <descrip.h> | 776 | #include <descrip.h> |
| 752 | #define OUTSIZE MAX_FILE_SPEC_LEN | 777 | #define OUTSIZE MAX_FILE_SPEC_LEN |
| 753 | short | 778 | static short |
| 754 | fn_exp (out, in) | 779 | fn_exp (out, in) |
| 755 | vspec *out; | 780 | vspec *out; |
| 756 | char *in; | 781 | char *in; |
| @@ -795,7 +820,7 @@ fn_exp (out, in) | |||
| 795 | v1.01 nmm 19-Aug-85 gfnames - return in successive calls the | 820 | v1.01 nmm 19-Aug-85 gfnames - return in successive calls the |
| 796 | name of each file specified by the provided arg expanding wildcards. | 821 | name of each file specified by the provided arg expanding wildcards. |
| 797 | */ | 822 | */ |
| 798 | char * | 823 | static char * |
| 799 | gfnames (arg, p_error) | 824 | gfnames (arg, p_error) |
| 800 | char *arg; | 825 | char *arg; |
| 801 | bool *p_error; | 826 | bool *p_error; |
| @@ -1171,7 +1196,7 @@ main (argc, argv) | |||
| 1171 | * and EXTPTR is not significant. | 1196 | * and EXTPTR is not significant. |
| 1172 | * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> | 1197 | * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> |
| 1173 | */ | 1198 | */ |
| 1174 | compressor * | 1199 | static compressor * |
| 1175 | get_compressor_from_suffix (file, extptr) | 1200 | get_compressor_from_suffix (file, extptr) |
| 1176 | char *file; | 1201 | char *file; |
| 1177 | char **extptr; | 1202 | char **extptr; |
| @@ -1196,9 +1221,8 @@ get_compressor_from_suffix (file, extptr) | |||
| 1196 | for (compr = compressors; compr->suffix != NULL; compr++) | 1221 | for (compr = compressors; compr->suffix != NULL; compr++) |
| 1197 | if (streq (compr->suffix, suffix)) | 1222 | if (streq (compr->suffix, suffix)) |
| 1198 | return compr; | 1223 | return compr; |
| 1199 | #ifndef MSDOS | 1224 | if (!MSDOS) |
| 1200 | break; | 1225 | break; /* do it only once: not really a loop */ |
| 1201 | #endif | ||
| 1202 | if (extptr != NULL) | 1226 | if (extptr != NULL) |
| 1203 | *extptr = ++suffix; | 1227 | *extptr = ++suffix; |
| 1204 | } while (*suffix != '\0'); | 1228 | } while (*suffix != '\0'); |
| @@ -1210,7 +1234,7 @@ get_compressor_from_suffix (file, extptr) | |||
| 1210 | /* | 1234 | /* |
| 1211 | * Return a language given the name. | 1235 | * Return a language given the name. |
| 1212 | */ | 1236 | */ |
| 1213 | language * | 1237 | static language * |
| 1214 | get_language_from_name (name) | 1238 | get_language_from_name (name) |
| 1215 | char *name; | 1239 | char *name; |
| 1216 | { | 1240 | { |
| @@ -1233,7 +1257,7 @@ get_language_from_name (name) | |||
| 1233 | /* | 1257 | /* |
| 1234 | * Return a language given the interpreter name. | 1258 | * Return a language given the interpreter name. |
| 1235 | */ | 1259 | */ |
| 1236 | language * | 1260 | static language * |
| 1237 | get_language_from_interpreter (interpreter) | 1261 | get_language_from_interpreter (interpreter) |
| 1238 | char *interpreter; | 1262 | char *interpreter; |
| 1239 | { | 1263 | { |
| @@ -1256,7 +1280,7 @@ get_language_from_interpreter (interpreter) | |||
| 1256 | /* | 1280 | /* |
| 1257 | * Return a language given the file name. | 1281 | * Return a language given the file name. |
| 1258 | */ | 1282 | */ |
| 1259 | language * | 1283 | static language * |
| 1260 | get_language_from_suffix (file) | 1284 | get_language_from_suffix (file) |
| 1261 | char *file; | 1285 | char *file; |
| 1262 | { | 1286 | { |
| @@ -1280,7 +1304,7 @@ get_language_from_suffix (file) | |||
| 1280 | /* | 1304 | /* |
| 1281 | * This routine is called on each file argument. | 1305 | * This routine is called on each file argument. |
| 1282 | */ | 1306 | */ |
| 1283 | void | 1307 | static void |
| 1284 | process_file (file) | 1308 | process_file (file) |
| 1285 | char *file; | 1309 | char *file; |
| 1286 | { | 1310 | { |
| @@ -1344,21 +1368,22 @@ process_file (file) | |||
| 1344 | compressed_name = concat (file, ".", compr->suffix); | 1368 | compressed_name = concat (file, ".", compr->suffix); |
| 1345 | if (stat (compressed_name, &stat_buf) != 0) | 1369 | if (stat (compressed_name, &stat_buf) != 0) |
| 1346 | { | 1370 | { |
| 1347 | #ifdef MSDOS | 1371 | if (MSDOS) |
| 1348 | char *suf = compressed_name + strlen (file); | ||
| 1349 | size_t suflen = strlen (compr->suffix) + 1; | ||
| 1350 | for ( ; suf[1]; suf++, suflen--) | ||
| 1351 | { | 1372 | { |
| 1352 | memmove (suf, suf + 1, suflen); | 1373 | char *suf = compressed_name + strlen (file); |
| 1353 | if (stat (compressed_name, &stat_buf) == 0) | 1374 | size_t suflen = strlen (compr->suffix) + 1; |
| 1375 | for ( ; suf[1]; suf++, suflen--) | ||
| 1354 | { | 1376 | { |
| 1355 | real_name = compressed_name; | 1377 | memmove (suf, suf + 1, suflen); |
| 1356 | break; | 1378 | if (stat (compressed_name, &stat_buf) == 0) |
| 1379 | { | ||
| 1380 | real_name = compressed_name; | ||
| 1381 | break; | ||
| 1382 | } | ||
| 1357 | } | 1383 | } |
| 1358 | } | 1384 | if (real_name != NULL) |
| 1359 | if (real_name != NULL) | 1385 | break; |
| 1360 | break; | 1386 | } /* MSDOS */ |
| 1361 | #endif | ||
| 1362 | free (compressed_name); | 1387 | free (compressed_name); |
| 1363 | compressed_name = NULL; | 1388 | compressed_name = NULL; |
| 1364 | } | 1389 | } |
| @@ -1438,7 +1463,7 @@ process_file (file) | |||
| 1438 | * subscripted by the chars in "white" are set to TRUE. Thus "_wht" | 1463 | * subscripted by the chars in "white" are set to TRUE. Thus "_wht" |
| 1439 | * of a char is TRUE if it is the string "white", else FALSE. | 1464 | * of a char is TRUE if it is the string "white", else FALSE. |
| 1440 | */ | 1465 | */ |
| 1441 | void | 1466 | static void |
| 1442 | init () | 1467 | init () |
| 1443 | { | 1468 | { |
| 1444 | register char *sp; | 1469 | register char *sp; |
| @@ -1464,7 +1489,7 @@ init () | |||
| 1464 | */ | 1489 | */ |
| 1465 | node *last_node = NULL; | 1490 | node *last_node = NULL; |
| 1466 | 1491 | ||
| 1467 | void | 1492 | static void |
| 1468 | find_entries (file, inf) | 1493 | find_entries (file, inf) |
| 1469 | char *file; | 1494 | char *file; |
| 1470 | FILE *inf; | 1495 | FILE *inf; |
| @@ -1663,7 +1688,7 @@ new_pfnote (name, namelen, is_func, linestart, linelen, lno, cno) | |||
| 1663 | * free_tree () | 1688 | * free_tree () |
| 1664 | * recurse on left children, iterate on right children. | 1689 | * recurse on left children, iterate on right children. |
| 1665 | */ | 1690 | */ |
| 1666 | void | 1691 | static void |
| 1667 | free_tree (np) | 1692 | free_tree (np) |
| 1668 | register node *np; | 1693 | register node *np; |
| 1669 | { | 1694 | { |
| @@ -1688,7 +1713,7 @@ free_tree (np) | |||
| 1688 | * add_node is the only function allowed to add nodes, so it can | 1713 | * add_node is the only function allowed to add nodes, so it can |
| 1689 | * maintain state. | 1714 | * maintain state. |
| 1690 | */ | 1715 | */ |
| 1691 | void | 1716 | static void |
| 1692 | add_node (np, cur_node_p) | 1717 | add_node (np, cur_node_p) |
| 1693 | node *np, **cur_node_p; | 1718 | node *np, **cur_node_p; |
| 1694 | { | 1719 | { |
| @@ -1746,7 +1771,7 @@ add_node (np, cur_node_p) | |||
| 1746 | } | 1771 | } |
| 1747 | } | 1772 | } |
| 1748 | 1773 | ||
| 1749 | void | 1774 | static void |
| 1750 | put_entries (np) | 1775 | put_entries (np) |
| 1751 | register node *np; | 1776 | register node *np; |
| 1752 | { | 1777 | { |
| @@ -1813,7 +1838,7 @@ put_entries (np) | |||
| 1813 | } | 1838 | } |
| 1814 | 1839 | ||
| 1815 | /* Length of a number's decimal representation. */ | 1840 | /* Length of a number's decimal representation. */ |
| 1816 | int | 1841 | static int |
| 1817 | number_len (num) | 1842 | number_len (num) |
| 1818 | long num; | 1843 | long num; |
| 1819 | { | 1844 | { |
| @@ -1830,7 +1855,7 @@ number_len (num) | |||
| 1830 | * is irrelevant with the new tags.el, but is still supplied for | 1855 | * is irrelevant with the new tags.el, but is still supplied for |
| 1831 | * backward compatibility. | 1856 | * backward compatibility. |
| 1832 | */ | 1857 | */ |
| 1833 | int | 1858 | static int |
| 1834 | total_size_of_entries (np) | 1859 | total_size_of_entries (np) |
| 1835 | register node *np; | 1860 | register node *np; |
| 1836 | { | 1861 | { |
| @@ -1993,7 +2018,7 @@ hash (str, len) | |||
| 1993 | #ifdef __GNUC__ | 2018 | #ifdef __GNUC__ |
| 1994 | __inline | 2019 | __inline |
| 1995 | #endif | 2020 | #endif |
| 1996 | struct C_stab_entry * | 2021 | static struct C_stab_entry * |
| 1997 | in_word_set (str, len) | 2022 | in_word_set (str, len) |
| 1998 | register const char *str; | 2023 | register const char *str; |
| 1999 | register unsigned int len; | 2024 | register unsigned int len; |
| @@ -2091,7 +2116,7 @@ in_word_set (str, len) | |||
| 2091 | } | 2116 | } |
| 2092 | /*%>*/ | 2117 | /*%>*/ |
| 2093 | 2118 | ||
| 2094 | enum sym_type | 2119 | static enum sym_type |
| 2095 | C_symtype (str, len, c_ext) | 2120 | C_symtype (str, len, c_ext) |
| 2096 | char *str; | 2121 | char *str; |
| 2097 | int len; | 2122 | int len; |
| @@ -2247,7 +2272,7 @@ int methodlen; | |||
| 2247 | * next_token_is_func IN OUT | 2272 | * next_token_is_func IN OUT |
| 2248 | */ | 2273 | */ |
| 2249 | 2274 | ||
| 2250 | bool | 2275 | static bool |
| 2251 | consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var) | 2276 | consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var) |
| 2252 | register char *str; /* IN: token pointer */ | 2277 | register char *str; /* IN: token pointer */ |
| 2253 | register int len; /* IN: token length */ | 2278 | register int len; /* IN: token length */ |
| @@ -2552,7 +2577,7 @@ do { \ | |||
| 2552 | } while (0) | 2577 | } while (0) |
| 2553 | 2578 | ||
| 2554 | 2579 | ||
| 2555 | void | 2580 | static void |
| 2556 | make_C_tag (isfun) | 2581 | make_C_tag (isfun) |
| 2557 | bool isfun; | 2582 | bool isfun; |
| 2558 | { | 2583 | { |
| @@ -3254,7 +3279,7 @@ C_entries (c_ext, inf) | |||
| 3254 | * Process either a C++ file or a C file depending on the setting | 3279 | * Process either a C++ file or a C file depending on the setting |
| 3255 | * of a global flag. | 3280 | * of a global flag. |
| 3256 | */ | 3281 | */ |
| 3257 | void | 3282 | static void |
| 3258 | default_C_entries (inf) | 3283 | default_C_entries (inf) |
| 3259 | FILE *inf; | 3284 | FILE *inf; |
| 3260 | { | 3285 | { |
| @@ -3262,7 +3287,7 @@ default_C_entries (inf) | |||
| 3262 | } | 3287 | } |
| 3263 | 3288 | ||
| 3264 | /* Always do plain ANSI C. */ | 3289 | /* Always do plain ANSI C. */ |
| 3265 | void | 3290 | static void |
| 3266 | plain_C_entries (inf) | 3291 | plain_C_entries (inf) |
| 3267 | FILE *inf; | 3292 | FILE *inf; |
| 3268 | { | 3293 | { |
| @@ -3270,7 +3295,7 @@ plain_C_entries (inf) | |||
| 3270 | } | 3295 | } |
| 3271 | 3296 | ||
| 3272 | /* Always do C++. */ | 3297 | /* Always do C++. */ |
| 3273 | void | 3298 | static void |
| 3274 | Cplusplus_entries (inf) | 3299 | Cplusplus_entries (inf) |
| 3275 | FILE *inf; | 3300 | FILE *inf; |
| 3276 | { | 3301 | { |
| @@ -3278,7 +3303,7 @@ Cplusplus_entries (inf) | |||
| 3278 | } | 3303 | } |
| 3279 | 3304 | ||
| 3280 | /* Always do Java. */ | 3305 | /* Always do Java. */ |
| 3281 | void | 3306 | static void |
| 3282 | Cjava_entries (inf) | 3307 | Cjava_entries (inf) |
| 3283 | FILE *inf; | 3308 | FILE *inf; |
| 3284 | { | 3309 | { |
| @@ -3286,7 +3311,7 @@ Cjava_entries (inf) | |||
| 3286 | } | 3311 | } |
| 3287 | 3312 | ||
| 3288 | /* Always do C*. */ | 3313 | /* Always do C*. */ |
| 3289 | void | 3314 | static void |
| 3290 | Cstar_entries (inf) | 3315 | Cstar_entries (inf) |
| 3291 | FILE *inf; | 3316 | FILE *inf; |
| 3292 | { | 3317 | { |
| @@ -3294,7 +3319,7 @@ Cstar_entries (inf) | |||
| 3294 | } | 3319 | } |
| 3295 | 3320 | ||
| 3296 | /* Always do Yacc. */ | 3321 | /* Always do Yacc. */ |
| 3297 | void | 3322 | static void |
| 3298 | Yacc_entries (inf) | 3323 | Yacc_entries (inf) |
| 3299 | FILE *inf; | 3324 | FILE *inf; |
| 3300 | { | 3325 | { |
| @@ -3317,7 +3342,7 @@ Yacc_entries (inf) | |||
| 3317 | * Read a file, but do no processing. This is used to do regexp | 3342 | * Read a file, but do no processing. This is used to do regexp |
| 3318 | * matching on files that have no language defined. | 3343 | * matching on files that have no language defined. |
| 3319 | */ | 3344 | */ |
| 3320 | void | 3345 | static void |
| 3321 | just_read_file (inf) | 3346 | just_read_file (inf) |
| 3322 | FILE *inf; | 3347 | FILE *inf; |
| 3323 | { | 3348 | { |
| @@ -3329,7 +3354,7 @@ just_read_file (inf) | |||
| 3329 | 3354 | ||
| 3330 | /* Fortran parsing */ | 3355 | /* Fortran parsing */ |
| 3331 | 3356 | ||
| 3332 | bool | 3357 | static bool |
| 3333 | tail (cp) | 3358 | tail (cp) |
| 3334 | char *cp; | 3359 | char *cp; |
| 3335 | { | 3360 | { |
| @@ -3345,7 +3370,7 @@ tail (cp) | |||
| 3345 | return FALSE; | 3370 | return FALSE; |
| 3346 | } | 3371 | } |
| 3347 | 3372 | ||
| 3348 | void | 3373 | static void |
| 3349 | takeprec () | 3374 | takeprec () |
| 3350 | { | 3375 | { |
| 3351 | dbp = skip_spaces (dbp); | 3376 | dbp = skip_spaces (dbp); |
| @@ -3368,7 +3393,7 @@ takeprec () | |||
| 3368 | while (isdigit (*dbp)); | 3393 | while (isdigit (*dbp)); |
| 3369 | } | 3394 | } |
| 3370 | 3395 | ||
| 3371 | void | 3396 | static void |
| 3372 | getit (inf) | 3397 | getit (inf) |
| 3373 | FILE *inf; | 3398 | FILE *inf; |
| 3374 | { | 3399 | { |
| @@ -3395,7 +3420,7 @@ getit (inf) | |||
| 3395 | } | 3420 | } |
| 3396 | 3421 | ||
| 3397 | 3422 | ||
| 3398 | void | 3423 | static void |
| 3399 | Fortran_functions (inf) | 3424 | Fortran_functions (inf) |
| 3400 | FILE *inf; | 3425 | FILE *inf; |
| 3401 | { | 3426 | { |
| @@ -3474,7 +3499,7 @@ Fortran_functions (inf) | |||
| 3474 | */ | 3499 | */ |
| 3475 | /* Once we are positioned after an "interesting" keyword, let's get | 3500 | /* Once we are positioned after an "interesting" keyword, let's get |
| 3476 | the real tag value necessary. */ | 3501 | the real tag value necessary. */ |
| 3477 | void | 3502 | static void |
| 3478 | adagetit (inf, name_qualifier) | 3503 | adagetit (inf, name_qualifier) |
| 3479 | FILE *inf; | 3504 | FILE *inf; |
| 3480 | char *name_qualifier; | 3505 | char *name_qualifier; |
| @@ -3541,7 +3566,7 @@ adagetit (inf, name_qualifier) | |||
| 3541 | } | 3566 | } |
| 3542 | } | 3567 | } |
| 3543 | 3568 | ||
| 3544 | void | 3569 | static void |
| 3545 | Ada_funcs (inf) | 3570 | Ada_funcs (inf) |
| 3546 | FILE *inf; | 3571 | FILE *inf; |
| 3547 | { | 3572 | { |
| @@ -3638,7 +3663,7 @@ Ada_funcs (inf) | |||
| 3638 | * Unix and microcontroller assembly tag handling | 3663 | * Unix and microcontroller assembly tag handling |
| 3639 | * look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]' | 3664 | * look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]' |
| 3640 | */ | 3665 | */ |
| 3641 | void | 3666 | static void |
| 3642 | Asm_labels (inf) | 3667 | Asm_labels (inf) |
| 3643 | FILE *inf; | 3668 | FILE *inf; |
| 3644 | { | 3669 | { |
| @@ -3670,7 +3695,7 @@ Asm_labels (inf) | |||
| 3670 | * Perl sub names: look for /^sub[ \t\n]+[^ \t\n{]+/ | 3695 | * Perl sub names: look for /^sub[ \t\n]+[^ \t\n{]+/ |
| 3671 | * Perl variable names: /^(my|local).../ | 3696 | * Perl variable names: /^(my|local).../ |
| 3672 | */ | 3697 | */ |
| 3673 | void | 3698 | static void |
| 3674 | Perl_functions (inf) | 3699 | Perl_functions (inf) |
| 3675 | FILE *inf; | 3700 | FILE *inf; |
| 3676 | { | 3701 | { |
| @@ -3736,7 +3761,7 @@ Perl_functions (inf) | |||
| 3736 | * Python support by Eric S. Raymond <esr@thyrsus.com> | 3761 | * Python support by Eric S. Raymond <esr@thyrsus.com> |
| 3737 | * Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/ | 3762 | * Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/ |
| 3738 | */ | 3763 | */ |
| 3739 | void | 3764 | static void |
| 3740 | Python_functions (inf) | 3765 | Python_functions (inf) |
| 3741 | FILE *inf; | 3766 | FILE *inf; |
| 3742 | { | 3767 | { |
| @@ -3776,7 +3801,7 @@ Python_functions (inf) | |||
| 3776 | * We could look for anything that could be a paragraph name. | 3801 | * We could look for anything that could be a paragraph name. |
| 3777 | * i.e. anything that starts in column 8 is one word and ends in a full stop. | 3802 | * i.e. anything that starts in column 8 is one word and ends in a full stop. |
| 3778 | */ | 3803 | */ |
| 3779 | void | 3804 | static void |
| 3780 | Cobol_paragraphs (inf) | 3805 | Cobol_paragraphs (inf) |
| 3781 | FILE *inf; | 3806 | FILE *inf; |
| 3782 | { | 3807 | { |
| @@ -3809,7 +3834,7 @@ Cobol_paragraphs (inf) | |||
| 3809 | * "forward" immediately following the procedure statement; if found, | 3834 | * "forward" immediately following the procedure statement; if found, |
| 3810 | * the tag is skipped. | 3835 | * the tag is skipped. |
| 3811 | */ | 3836 | */ |
| 3812 | void | 3837 | static void |
| 3813 | Pascal_functions (inf) | 3838 | Pascal_functions (inf) |
| 3814 | FILE *inf; | 3839 | FILE *inf; |
| 3815 | { | 3840 | { |
| @@ -3986,7 +4011,7 @@ Pascal_functions (inf) | |||
| 3986 | * lisp tag functions | 4011 | * lisp tag functions |
| 3987 | * look for (def or (DEF, quote or QUOTE | 4012 | * look for (def or (DEF, quote or QUOTE |
| 3988 | */ | 4013 | */ |
| 3989 | int | 4014 | static int |
| 3990 | L_isdef (strp) | 4015 | L_isdef (strp) |
| 3991 | register char *strp; | 4016 | register char *strp; |
| 3992 | { | 4017 | { |
| @@ -3995,7 +4020,7 @@ L_isdef (strp) | |||
| 3995 | && (strp[3] == 'f' || strp[3] == 'F')); | 4020 | && (strp[3] == 'f' || strp[3] == 'F')); |
| 3996 | } | 4021 | } |
| 3997 | 4022 | ||
| 3998 | int | 4023 | static int |
| 3999 | L_isquote (strp) | 4024 | L_isquote (strp) |
| 4000 | register char *strp; | 4025 | register char *strp; |
| 4001 | { | 4026 | { |
| @@ -4007,7 +4032,7 @@ L_isquote (strp) | |||
| 4007 | && isspace (*++strp)); | 4032 | && isspace (*++strp)); |
| 4008 | } | 4033 | } |
| 4009 | 4034 | ||
| 4010 | void | 4035 | static void |
| 4011 | L_getit () | 4036 | L_getit () |
| 4012 | { | 4037 | { |
| 4013 | register char *cp; | 4038 | register char *cp; |
| @@ -4034,7 +4059,7 @@ L_getit () | |||
| 4034 | lb.buffer, cp - lb.buffer + 1, lineno, linecharno); | 4059 | lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
| 4035 | } | 4060 | } |
| 4036 | 4061 | ||
| 4037 | void | 4062 | static void |
| 4038 | Lisp_functions (inf) | 4063 | Lisp_functions (inf) |
| 4039 | FILE *inf; | 4064 | FILE *inf; |
| 4040 | { | 4065 | { |
| @@ -4080,7 +4105,7 @@ Lisp_functions (inf) | |||
| 4080 | * Also look at "defineps" for PSWrap | 4105 | * Also look at "defineps" for PSWrap |
| 4081 | * suggested by Masatake YAMATO <masata-y@is.aist-nara.ac.jp> | 4106 | * suggested by Masatake YAMATO <masata-y@is.aist-nara.ac.jp> |
| 4082 | */ | 4107 | */ |
| 4083 | void | 4108 | static void |
| 4084 | Postscript_functions (inf) | 4109 | Postscript_functions (inf) |
| 4085 | FILE *inf; | 4110 | FILE *inf; |
| 4086 | { | 4111 | { |
| @@ -4115,7 +4140,7 @@ Postscript_functions (inf) | |||
| 4115 | * look for (set! xyzzy | 4140 | * look for (set! xyzzy |
| 4116 | */ | 4141 | */ |
| 4117 | 4142 | ||
| 4118 | void | 4143 | static void |
| 4119 | Scheme_functions (inf) | 4144 | Scheme_functions (inf) |
| 4120 | FILE *inf; | 4145 | FILE *inf; |
| 4121 | { | 4146 | { |
| @@ -4168,9 +4193,9 @@ char *TEX_defenv = "\ | |||
| 4168 | :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ | 4193 | :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ |
| 4169 | :part:appendix:entry:index"; | 4194 | :part:appendix:entry:index"; |
| 4170 | 4195 | ||
| 4171 | void TEX_mode (); | 4196 | static void TEX_mode P_((FILE *inf)); |
| 4172 | struct TEX_tabent *TEX_decode_env (); | 4197 | static struct TEX_tabent *TEX_decode_env P_((char *evarname, char *defenv)); |
| 4173 | int TEX_Token (); | 4198 | static int TEX_Token P_((char *cp)); |
| 4174 | 4199 | ||
| 4175 | char TEX_esc = '\\'; | 4200 | char TEX_esc = '\\'; |
| 4176 | char TEX_opgrp = '{'; | 4201 | char TEX_opgrp = '{'; |
| @@ -4179,7 +4204,7 @@ char TEX_clgrp = '}'; | |||
| 4179 | /* | 4204 | /* |
| 4180 | * TeX/LaTeX scanning loop. | 4205 | * TeX/LaTeX scanning loop. |
| 4181 | */ | 4206 | */ |
| 4182 | void | 4207 | static void |
| 4183 | TeX_functions (inf) | 4208 | TeX_functions (inf) |
| 4184 | FILE *inf; | 4209 | FILE *inf; |
| 4185 | { | 4210 | { |
| @@ -4226,7 +4251,7 @@ TeX_functions (inf) | |||
| 4226 | 4251 | ||
| 4227 | /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping | 4252 | /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping |
| 4228 | chars accordingly. */ | 4253 | chars accordingly. */ |
| 4229 | void | 4254 | static void |
| 4230 | TEX_mode (inf) | 4255 | TEX_mode (inf) |
| 4231 | FILE *inf; | 4256 | FILE *inf; |
| 4232 | { | 4257 | { |
| @@ -4261,7 +4286,7 @@ TEX_mode (inf) | |||
| 4261 | 4286 | ||
| 4262 | /* Read environment and prepend it to the default string. | 4287 | /* Read environment and prepend it to the default string. |
| 4263 | Build token table. */ | 4288 | Build token table. */ |
| 4264 | struct TEX_tabent * | 4289 | static struct TEX_tabent * |
| 4265 | TEX_decode_env (evarname, defenv) | 4290 | TEX_decode_env (evarname, defenv) |
| 4266 | char *evarname; | 4291 | char *evarname; |
| 4267 | char *defenv; | 4292 | char *defenv; |
| @@ -4318,7 +4343,7 @@ TEX_decode_env (evarname, defenv) | |||
| 4318 | Otherwise return -1. | 4343 | Otherwise return -1. |
| 4319 | Keep the capital `T' in `token' for dumb truncating compilers | 4344 | Keep the capital `T' in `token' for dumb truncating compilers |
| 4320 | (this distinguishes it from `TEX_toktab' */ | 4345 | (this distinguishes it from `TEX_toktab' */ |
| 4321 | int | 4346 | static int |
| 4322 | TEX_Token (cp) | 4347 | TEX_Token (cp) |
| 4323 | char *cp; | 4348 | char *cp; |
| 4324 | { | 4349 | { |
| @@ -4336,11 +4361,11 @@ TEX_Token (cp) | |||
| 4336 | * Assumes that the predicate starts at column 0. | 4361 | * Assumes that the predicate starts at column 0. |
| 4337 | * Only the first clause of a predicate is added. | 4362 | * Only the first clause of a predicate is added. |
| 4338 | */ | 4363 | */ |
| 4339 | int prolog_pred (); | 4364 | static int prolog_pred P_((char *s, char *last)); |
| 4340 | void prolog_skip_comment (); | 4365 | static void prolog_skip_comment P_((linebuffer *plb, FILE *inf)); |
| 4341 | int prolog_atom (); | 4366 | static int prolog_atom P_((char *s, int pos)); |
| 4342 | 4367 | ||
| 4343 | void | 4368 | static void |
| 4344 | Prolog_functions (inf) | 4369 | Prolog_functions (inf) |
| 4345 | FILE *inf; | 4370 | FILE *inf; |
| 4346 | { | 4371 | { |
| @@ -4376,7 +4401,7 @@ Prolog_functions (inf) | |||
| 4376 | } | 4401 | } |
| 4377 | 4402 | ||
| 4378 | 4403 | ||
| 4379 | void | 4404 | static void |
| 4380 | prolog_skip_comment (plb, inf) | 4405 | prolog_skip_comment (plb, inf) |
| 4381 | linebuffer *plb; | 4406 | linebuffer *plb; |
| 4382 | FILE *inf; | 4407 | FILE *inf; |
| @@ -4445,7 +4470,7 @@ prolog_pred (s, last) | |||
| 4445 | * - A quoted arbitrary string. Single quotes can escape themselves. | 4470 | * - A quoted arbitrary string. Single quotes can escape themselves. |
| 4446 | * Backslash quotes everything. | 4471 | * Backslash quotes everything. |
| 4447 | */ | 4472 | */ |
| 4448 | int | 4473 | static int |
| 4449 | prolog_atom (s, pos) | 4474 | prolog_atom (s, pos) |
| 4450 | char *s; | 4475 | char *s; |
| 4451 | int pos; | 4476 | int pos; |
| @@ -4502,11 +4527,11 @@ prolog_atom (s, pos) | |||
| 4502 | * | 4527 | * |
| 4503 | * Assumes that Erlang functions start at column 0. | 4528 | * Assumes that Erlang functions start at column 0. |
| 4504 | */ | 4529 | */ |
| 4505 | int erlang_func (); | 4530 | static int erlang_func P_((char *s, char *last)); |
| 4506 | void erlang_attribute (); | 4531 | static void erlang_attribute P_((char *s)); |
| 4507 | int erlang_atom (); | 4532 | static int erlang_atom P_((char *s, int pos)); |
| 4508 | 4533 | ||
| 4509 | void | 4534 | static void |
| 4510 | Erlang_functions (inf) | 4535 | Erlang_functions (inf) |
| 4511 | FILE *inf; | 4536 | FILE *inf; |
| 4512 | { | 4537 | { |
| @@ -4599,7 +4624,7 @@ erlang_func (s, last) | |||
| 4599 | * -define(Foo(M, N), M+N). | 4624 | * -define(Foo(M, N), M+N). |
| 4600 | * -record(graph, {vtab = notable, cyclic = true}). | 4625 | * -record(graph, {vtab = notable, cyclic = true}). |
| 4601 | */ | 4626 | */ |
| 4602 | void | 4627 | static void |
| 4603 | erlang_attribute (s) | 4628 | erlang_attribute (s) |
| 4604 | char *s; | 4629 | char *s; |
| 4605 | { | 4630 | { |
| @@ -4626,7 +4651,7 @@ erlang_attribute (s) | |||
| 4626 | * Consume an Erlang atom (or variable). | 4651 | * Consume an Erlang atom (or variable). |
| 4627 | * Return the number of bytes consumed, or -1 if there was an error. | 4652 | * Return the number of bytes consumed, or -1 if there was an error. |
| 4628 | */ | 4653 | */ |
| 4629 | int | 4654 | static int |
| 4630 | erlang_atom (s, pos) | 4655 | erlang_atom (s, pos) |
| 4631 | char *s; | 4656 | char *s; |
| 4632 | int pos; | 4657 | int pos; |
| @@ -4680,7 +4705,7 @@ erlang_atom (s, pos) | |||
| 4680 | an unquoted separator. Also turns "\t" into a Tab character. | 4705 | an unquoted separator. Also turns "\t" into a Tab character. |
| 4681 | Returns pointer to terminating separator. Works in place. Null | 4706 | Returns pointer to terminating separator. Works in place. Null |
| 4682 | terminates name string. */ | 4707 | terminates name string. */ |
| 4683 | char * | 4708 | static char * |
| 4684 | scan_separators (name) | 4709 | scan_separators (name) |
| 4685 | char *name; | 4710 | char *name; |
| 4686 | { | 4711 | { |
| @@ -4719,7 +4744,7 @@ scan_separators (name) | |||
| 4719 | 4744 | ||
| 4720 | /* Look at the argument of --regex or --no-regex and do the right | 4745 | /* Look at the argument of --regex or --no-regex and do the right |
| 4721 | thing. Same for each line of a regexp file. */ | 4746 | thing. Same for each line of a regexp file. */ |
| 4722 | void | 4747 | static void |
| 4723 | analyse_regex (regex_arg, ignore_case) | 4748 | analyse_regex (regex_arg, ignore_case) |
| 4724 | char *regex_arg; | 4749 | char *regex_arg; |
| 4725 | bool ignore_case; | 4750 | bool ignore_case; |
| @@ -4789,7 +4814,7 @@ analyse_regex (regex_arg, ignore_case) | |||
| 4789 | 4814 | ||
| 4790 | /* Turn a name, which is an ed-style (but Emacs syntax) regular | 4815 | /* Turn a name, which is an ed-style (but Emacs syntax) regular |
| 4791 | expression, into a real regular expression by compiling it. */ | 4816 | expression, into a real regular expression by compiling it. */ |
| 4792 | void | 4817 | static void |
| 4793 | add_regex (regexp_pattern, ignore_case, lang) | 4818 | add_regex (regexp_pattern, ignore_case, lang) |
| 4794 | char *regexp_pattern; | 4819 | char *regexp_pattern; |
| 4795 | bool ignore_case; | 4820 | bool ignore_case; |
| @@ -4842,7 +4867,7 @@ add_regex (regexp_pattern, ignore_case, lang) | |||
| 4842 | * Do the substitutions indicated by the regular expression and | 4867 | * Do the substitutions indicated by the regular expression and |
| 4843 | * arguments. | 4868 | * arguments. |
| 4844 | */ | 4869 | */ |
| 4845 | char * | 4870 | static char * |
| 4846 | substitute (in, out, regs) | 4871 | substitute (in, out, regs) |
| 4847 | char *in, *out; | 4872 | char *in, *out; |
| 4848 | struct re_registers *regs; | 4873 | struct re_registers *regs; |
| @@ -4891,7 +4916,7 @@ substitute (in, out, regs) | |||
| 4891 | } | 4916 | } |
| 4892 | 4917 | ||
| 4893 | /* Deallocate all patterns. */ | 4918 | /* Deallocate all patterns. */ |
| 4894 | void | 4919 | static void |
| 4895 | free_patterns () | 4920 | free_patterns () |
| 4896 | { | 4921 | { |
| 4897 | pattern *pp; | 4922 | pattern *pp; |
| @@ -4906,7 +4931,7 @@ free_patterns () | |||
| 4906 | return; | 4931 | return; |
| 4907 | } | 4932 | } |
| 4908 | 4933 | ||
| 4909 | void | 4934 | static void |
| 4910 | get_tag (bp) | 4935 | get_tag (bp) |
| 4911 | register char *bp; | 4936 | register char *bp; |
| 4912 | { | 4937 | { |
| @@ -4925,7 +4950,7 @@ get_tag (bp) | |||
| 4925 | 4950 | ||
| 4926 | #endif /* ETAGS_REGEXPS */ | 4951 | #endif /* ETAGS_REGEXPS */ |
| 4927 | /* Initialize a linebuffer for use */ | 4952 | /* Initialize a linebuffer for use */ |
| 4928 | void | 4953 | static void |
| 4929 | initbuffer (lbp) | 4954 | initbuffer (lbp) |
| 4930 | linebuffer *lbp; | 4955 | linebuffer *lbp; |
| 4931 | { | 4956 | { |
| @@ -4943,7 +4968,7 @@ initbuffer (lbp) | |||
| 4943 | * platforms (for text files, it translates CR-NL to NL as it reads in the | 4968 | * platforms (for text files, it translates CR-NL to NL as it reads in the |
| 4944 | * file). | 4969 | * file). |
| 4945 | */ | 4970 | */ |
| 4946 | long | 4971 | static long |
| 4947 | readline_internal (lbp, stream) | 4972 | readline_internal (lbp, stream) |
| 4948 | linebuffer *lbp; | 4973 | linebuffer *lbp; |
| 4949 | register FILE *stream; | 4974 | register FILE *stream; |
| @@ -5007,7 +5032,7 @@ readline_internal (lbp, stream) | |||
| 5007 | * Like readline_internal, above, but in addition try to match the | 5032 | * Like readline_internal, above, but in addition try to match the |
| 5008 | * input line against relevant regular expressions. | 5033 | * input line against relevant regular expressions. |
| 5009 | */ | 5034 | */ |
| 5010 | long | 5035 | static long |
| 5011 | readline (lbp, stream) | 5036 | readline (lbp, stream) |
| 5012 | linebuffer *lbp; | 5037 | linebuffer *lbp; |
| 5013 | FILE *stream; | 5038 | FILE *stream; |
| @@ -5068,7 +5093,7 @@ readline (lbp, stream) | |||
| 5068 | * Return a pointer to a space of size strlen(cp)+1 allocated | 5093 | * Return a pointer to a space of size strlen(cp)+1 allocated |
| 5069 | * with xnew where the string CP has been copied. | 5094 | * with xnew where the string CP has been copied. |
| 5070 | */ | 5095 | */ |
| 5071 | char * | 5096 | static char * |
| 5072 | savestr (cp) | 5097 | savestr (cp) |
| 5073 | char *cp; | 5098 | char *cp; |
| 5074 | { | 5099 | { |
| @@ -5079,7 +5104,7 @@ savestr (cp) | |||
| 5079 | * Return a pointer to a space of size LEN+1 allocated with xnew where | 5104 | * Return a pointer to a space of size LEN+1 allocated with xnew where |
| 5080 | * the string CP has been copied for at most the first LEN characters. | 5105 | * the string CP has been copied for at most the first LEN characters. |
| 5081 | */ | 5106 | */ |
| 5082 | char * | 5107 | static char * |
| 5083 | savenstr (cp, len) | 5108 | savenstr (cp, len) |
| 5084 | char *cp; | 5109 | char *cp; |
| 5085 | int len; | 5110 | int len; |
| @@ -5096,13 +5121,14 @@ savenstr (cp, len) | |||
| 5096 | * Return the ptr in sp at which the character c last | 5121 | * Return the ptr in sp at which the character c last |
| 5097 | * appears; NULL if not found | 5122 | * appears; NULL if not found |
| 5098 | * | 5123 | * |
| 5099 | * Identical to System V strrchr, included for portability. | 5124 | * Identical to POSIX strrchr, included for portability. |
| 5100 | */ | 5125 | */ |
| 5101 | char * | 5126 | static char * |
| 5102 | etags_strrchr (sp, c) | 5127 | etags_strrchr (sp, c) |
| 5103 | register char *sp, c; | 5128 | register const char *sp; |
| 5129 | register int c; | ||
| 5104 | { | 5130 | { |
| 5105 | register char *r; | 5131 | register const char *r; |
| 5106 | 5132 | ||
| 5107 | r = NULL; | 5133 | r = NULL; |
| 5108 | do | 5134 | do |
| @@ -5110,7 +5136,7 @@ etags_strrchr (sp, c) | |||
| 5110 | if (*sp == c) | 5136 | if (*sp == c) |
| 5111 | r = sp; | 5137 | r = sp; |
| 5112 | } while (*sp++); | 5138 | } while (*sp++); |
| 5113 | return r; | 5139 | return (char *)r; |
| 5114 | } | 5140 | } |
| 5115 | 5141 | ||
| 5116 | 5142 | ||
| @@ -5118,22 +5144,23 @@ etags_strrchr (sp, c) | |||
| 5118 | * Return the ptr in sp at which the character c first | 5144 | * Return the ptr in sp at which the character c first |
| 5119 | * appears; NULL if not found | 5145 | * appears; NULL if not found |
| 5120 | * | 5146 | * |
| 5121 | * Identical to System V strchr, included for portability. | 5147 | * Identical to POSIX strchr, included for portability. |
| 5122 | */ | 5148 | */ |
| 5123 | char * | 5149 | static char * |
| 5124 | etags_strchr (sp, c) | 5150 | etags_strchr (sp, c) |
| 5125 | register char *sp, c; | 5151 | register const char *sp; |
| 5152 | register int c; | ||
| 5126 | { | 5153 | { |
| 5127 | do | 5154 | do |
| 5128 | { | 5155 | { |
| 5129 | if (*sp == c) | 5156 | if (*sp == c) |
| 5130 | return sp; | 5157 | return (char *)sp; |
| 5131 | } while (*sp++); | 5158 | } while (*sp++); |
| 5132 | return NULL; | 5159 | return NULL; |
| 5133 | } | 5160 | } |
| 5134 | 5161 | ||
| 5135 | /* Skip spaces, return new pointer. */ | 5162 | /* Skip spaces, return new pointer. */ |
| 5136 | char * | 5163 | static char * |
| 5137 | skip_spaces (cp) | 5164 | skip_spaces (cp) |
| 5138 | char *cp; | 5165 | char *cp; |
| 5139 | { | 5166 | { |
| @@ -5143,7 +5170,7 @@ skip_spaces (cp) | |||
| 5143 | } | 5170 | } |
| 5144 | 5171 | ||
| 5145 | /* Skip non spaces, return new pointer. */ | 5172 | /* Skip non spaces, return new pointer. */ |
| 5146 | char * | 5173 | static char * |
| 5147 | skip_non_spaces (cp) | 5174 | skip_non_spaces (cp) |
| 5148 | char *cp; | 5175 | char *cp; |
| 5149 | { | 5176 | { |
| @@ -5153,7 +5180,7 @@ skip_non_spaces (cp) | |||
| 5153 | } | 5180 | } |
| 5154 | 5181 | ||
| 5155 | /* Print error message and exit. */ | 5182 | /* Print error message and exit. */ |
| 5156 | void | 5183 | static void |
| 5157 | fatal (s1, s2) | 5184 | fatal (s1, s2) |
| 5158 | char *s1, *s2; | 5185 | char *s1, *s2; |
| 5159 | { | 5186 | { |
| @@ -5161,7 +5188,7 @@ fatal (s1, s2) | |||
| 5161 | exit (BAD); | 5188 | exit (BAD); |
| 5162 | } | 5189 | } |
| 5163 | 5190 | ||
| 5164 | void | 5191 | static void |
| 5165 | pfatal (s1) | 5192 | pfatal (s1) |
| 5166 | char *s1; | 5193 | char *s1; |
| 5167 | { | 5194 | { |
| @@ -5169,7 +5196,7 @@ pfatal (s1) | |||
| 5169 | exit (BAD); | 5196 | exit (BAD); |
| 5170 | } | 5197 | } |
| 5171 | 5198 | ||
| 5172 | void | 5199 | static void |
| 5173 | suggest_asking_for_help () | 5200 | suggest_asking_for_help () |
| 5174 | { | 5201 | { |
| 5175 | fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", | 5202 | fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", |
| @@ -5184,9 +5211,9 @@ suggest_asking_for_help () | |||
| 5184 | } | 5211 | } |
| 5185 | 5212 | ||
| 5186 | /* Print error message. `s1' is printf control string, `s2' is arg for it. */ | 5213 | /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
| 5187 | void | 5214 | static void |
| 5188 | error (s1, s2) | 5215 | error (s1, s2) |
| 5189 | char *s1, *s2; | 5216 | const char *s1, *s2; |
| 5190 | { | 5217 | { |
| 5191 | fprintf (stderr, "%s: ", progname); | 5218 | fprintf (stderr, "%s: ", progname); |
| 5192 | fprintf (stderr, s1, s2); | 5219 | fprintf (stderr, s1, s2); |
| @@ -5195,7 +5222,7 @@ error (s1, s2) | |||
| 5195 | 5222 | ||
| 5196 | /* Return a newly-allocated string whose contents | 5223 | /* Return a newly-allocated string whose contents |
| 5197 | concatenate those of s1, s2, s3. */ | 5224 | concatenate those of s1, s2, s3. */ |
| 5198 | char * | 5225 | static char * |
| 5199 | concat (s1, s2, s3) | 5226 | concat (s1, s2, s3) |
| 5200 | char *s1, *s2, *s3; | 5227 | char *s1, *s2, *s3; |
| 5201 | { | 5228 | { |
| @@ -5212,7 +5239,7 @@ concat (s1, s2, s3) | |||
| 5212 | 5239 | ||
| 5213 | /* Does the same work as the system V getcwd, but does not need to | 5240 | /* Does the same work as the system V getcwd, but does not need to |
| 5214 | guess the buffer size in advance. */ | 5241 | guess the buffer size in advance. */ |
| 5215 | char * | 5242 | static char * |
| 5216 | etags_getcwd () | 5243 | etags_getcwd () |
| 5217 | { | 5244 | { |
| 5218 | #ifdef HAVE_GETCWD | 5245 | #ifdef HAVE_GETCWD |
| @@ -5261,7 +5288,7 @@ etags_getcwd () | |||
| 5261 | 5288 | ||
| 5262 | /* Return a newly allocated string containing the file name of FILE | 5289 | /* Return a newly allocated string containing the file name of FILE |
| 5263 | relative to the absolute directory DIR (which should end with a slash). */ | 5290 | relative to the absolute directory DIR (which should end with a slash). */ |
| 5264 | char * | 5291 | static char * |
| 5265 | relative_filename (file, dir) | 5292 | relative_filename (file, dir) |
| 5266 | char *file, *dir; | 5293 | char *file, *dir; |
| 5267 | { | 5294 | { |
| @@ -5301,7 +5328,7 @@ relative_filename (file, dir) | |||
| 5301 | 5328 | ||
| 5302 | /* Return a newly allocated string containing the absolute file name | 5329 | /* Return a newly allocated string containing the absolute file name |
| 5303 | of FILE given DIR (which should end with a slash). */ | 5330 | of FILE given DIR (which should end with a slash). */ |
| 5304 | char * | 5331 | static char * |
| 5305 | absolute_filename (file, dir) | 5332 | absolute_filename (file, dir) |
| 5306 | char *file, *dir; | 5333 | char *file, *dir; |
| 5307 | { | 5334 | { |
| @@ -5363,7 +5390,7 @@ absolute_filename (file, dir) | |||
| 5363 | /* Return a newly allocated string containing the absolute | 5390 | /* Return a newly allocated string containing the absolute |
| 5364 | file name of dir where FILE resides given DIR (which should | 5391 | file name of dir where FILE resides given DIR (which should |
| 5365 | end with a slash). */ | 5392 | end with a slash). */ |
| 5366 | char * | 5393 | static char * |
| 5367 | absolute_dirname (file, dir) | 5394 | absolute_dirname (file, dir) |
| 5368 | char *file, *dir; | 5395 | char *file, *dir; |
| 5369 | { | 5396 | { |
| @@ -5384,7 +5411,7 @@ absolute_dirname (file, dir) | |||
| 5384 | 5411 | ||
| 5385 | /* Whether the argument string is an absolute file name. The argument | 5412 | /* Whether the argument string is an absolute file name. The argument |
| 5386 | string must have been canonicalized with canonicalize_filename. */ | 5413 | string must have been canonicalized with canonicalize_filename. */ |
| 5387 | bool | 5414 | static bool |
| 5388 | filename_is_absolute (fn) | 5415 | filename_is_absolute (fn) |
| 5389 | char *fn; | 5416 | char *fn; |
| 5390 | { | 5417 | { |
| @@ -5396,7 +5423,7 @@ filename_is_absolute (fn) | |||
| 5396 | } | 5423 | } |
| 5397 | 5424 | ||
| 5398 | /* Translate backslashes into slashes. Works in place. */ | 5425 | /* Translate backslashes into slashes. Works in place. */ |
| 5399 | void | 5426 | static void |
| 5400 | canonicalize_filename (fn) | 5427 | canonicalize_filename (fn) |
| 5401 | register char *fn; | 5428 | register char *fn; |
| 5402 | { | 5429 | { |
| @@ -5415,7 +5442,7 @@ canonicalize_filename (fn) | |||
| 5415 | } | 5442 | } |
| 5416 | 5443 | ||
| 5417 | /* Increase the size of a linebuffer. */ | 5444 | /* Increase the size of a linebuffer. */ |
| 5418 | void | 5445 | static void |
| 5419 | grow_linebuffer (lbp, toksize) | 5446 | grow_linebuffer (lbp, toksize) |
| 5420 | linebuffer *lbp; | 5447 | linebuffer *lbp; |
| 5421 | int toksize; | 5448 | int toksize; |
| @@ -5426,7 +5453,7 @@ grow_linebuffer (lbp, toksize) | |||
| 5426 | } | 5453 | } |
| 5427 | 5454 | ||
| 5428 | /* Like malloc but get fatal error if memory is exhausted. */ | 5455 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 5429 | long * | 5456 | static long * |
| 5430 | xmalloc (size) | 5457 | xmalloc (size) |
| 5431 | unsigned int size; | 5458 | unsigned int size; |
| 5432 | { | 5459 | { |
| @@ -5436,7 +5463,7 @@ xmalloc (size) | |||
| 5436 | return result; | 5463 | return result; |
| 5437 | } | 5464 | } |
| 5438 | 5465 | ||
| 5439 | long * | 5466 | static long * |
| 5440 | xrealloc (ptr, size) | 5467 | xrealloc (ptr, size) |
| 5441 | char *ptr; | 5468 | char *ptr; |
| 5442 | unsigned int size; | 5469 | unsigned int size; |