diff options
| author | Francesco Potortì | 1995-11-02 16:30:14 +0000 |
|---|---|---|
| committer | Francesco Potortì | 1995-11-02 16:30:14 +0000 |
| commit | c5007f46720e9b796ea7e300b810723adc641b46 (patch) | |
| tree | 750468e84e80711af4f75fdaf3f60c7a993e2d09 /lib-src | |
| parent | 99e76ddadef34ac2a6821c530b0d2fd97f239664 (diff) | |
| download | emacs-c5007f46720e9b796ea7e300b810723adc641b46.tar.gz emacs-c5007f46720e9b796ea7e300b810723adc641b46.zip | |
* etags.c (lowcase): Use the standard tolower function.
(substitute): Remove some wrong and some useless code related with
escape `\` character in regexp replacement string.
(TEX_defenv): Added part, appendix, entry, index. Removed typeout.
(lang_suffixes): New suffixes: .hpp for C++; .f90 for Fortran;
.bib, .ltx, .TeX for TeX (.bbl, .dtx removed); .ml for Lisp;
.prolog for prolog (.pl removed).
(massage_name, etags_getcwd): Use lowcase instead of tolower.
(regex.h): Don't include it if REGEX_IN_LIBC is defined.
(C_entries, find_entries): Added comments about memory leakage.
(add_node): Dead code removed.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 177 |
1 files changed, 81 insertions, 96 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 1e4875305a7..d53bf286aa6 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -32,7 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 32 | * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer. | 32 | * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer. |
| 33 | */ | 33 | */ |
| 34 | 34 | ||
| 35 | char pot_etags_version[] = "@(#) pot revision number is 11.30"; | 35 | char pot_etags_version[] = "@(#) pot revision number is 11.42"; |
| 36 | 36 | ||
| 37 | #define TRUE 1 | 37 | #define TRUE 1 |
| 38 | #define FALSE 0 | 38 | #define FALSE 0 |
| @@ -105,7 +105,7 @@ extern int errno; | |||
| 105 | #define streq(s,t) (strcmp (s, t) == 0) | 105 | #define streq(s,t) (strcmp (s, t) == 0) |
| 106 | #define strneq(s,t,n) (strncmp (s, t, n) == 0) | 106 | #define strneq(s,t,n) (strncmp (s, t, n) == 0) |
| 107 | 107 | ||
| 108 | #define lowcase(c) ((c) | ' ') | 108 | #define lowcase(c) tolower ((unsigned char)c) |
| 109 | 109 | ||
| 110 | #define iswhite(arg) (_wht[arg]) /* T if char is white */ | 110 | #define iswhite(arg) (_wht[arg]) /* T if char is white */ |
| 111 | #define begtoken(arg) (_btk[arg]) /* T if char can start token */ | 111 | #define begtoken(arg) (_btk[arg]) /* T if char can start token */ |
| @@ -263,12 +263,11 @@ logical no_warnings; /* -w: suppress warnings */ | |||
| 263 | logical cxref_style; /* -x: create cxref style output */ | 263 | logical cxref_style; /* -x: create cxref style output */ |
| 264 | logical cplusplus; /* .[hc] means C++, not C */ | 264 | logical cplusplus; /* .[hc] means C++, not C */ |
| 265 | logical noindentypedefs; /* -I: ignore indentation in C */ | 265 | logical noindentypedefs; /* -I: ignore indentation in C */ |
| 266 | #define permit_duplicates TRUE /* allow duplicate tags */ | ||
| 267 | 266 | ||
| 268 | struct option longopts[] = | 267 | struct option longopts[] = |
| 269 | { | 268 | { |
| 270 | { "append", no_argument, NULL, 'a' }, | 269 | { "append", no_argument, NULL, 'a' }, |
| 271 | { "backward-search", no_argument, NULL, 'B' }, | 270 | { "backward-search", no_argument, NULL, 'B' }, |
| 272 | { "c++", no_argument, NULL, 'C' }, | 271 | { "c++", no_argument, NULL, 'C' }, |
| 273 | { "cxref", no_argument, NULL, 'x' }, | 272 | { "cxref", no_argument, NULL, 'x' }, |
| 274 | { "defines", no_argument, NULL, 'd' }, | 273 | { "defines", no_argument, NULL, 'd' }, |
| @@ -284,14 +283,14 @@ struct option longopts[] = | |||
| 284 | { "regex", required_argument, NULL, 'r' }, | 283 | { "regex", required_argument, NULL, 'r' }, |
| 285 | { "typedefs", no_argument, NULL, 't' }, | 284 | { "typedefs", no_argument, NULL, 't' }, |
| 286 | { "typedefs-and-c++", no_argument, NULL, 'T' }, | 285 | { "typedefs-and-c++", no_argument, NULL, 'T' }, |
| 287 | { "update", no_argument, NULL, 'u' }, | 286 | { "update", no_argument, NULL, 'u' }, |
| 288 | { "version", no_argument, NULL, 'V' }, | 287 | { "version", no_argument, NULL, 'V' }, |
| 289 | { "vgrind", no_argument, NULL, 'v' }, | 288 | { "vgrind", no_argument, NULL, 'v' }, |
| 290 | { 0 } | 289 | { 0 } |
| 291 | }; | 290 | }; |
| 292 | 291 | ||
| 293 | #ifdef ETAGS_REGEXPS | 292 | #ifdef ETAGS_REGEXPS |
| 294 | /* Structure defining a regular expression. Elements are | 293 | /* Structure defining a regular expression. Elements are |
| 295 | the compiled pattern, and the name string. */ | 294 | the compiled pattern, and the name string. */ |
| 296 | struct pattern | 295 | struct pattern |
| 297 | { | 296 | { |
| @@ -338,8 +337,7 @@ struct lang_entry lang_names[] = | |||
| 338 | /* Table of file name suffixes and corresponding language functions. */ | 337 | /* Table of file name suffixes and corresponding language functions. */ |
| 339 | struct lang_entry lang_suffixes[] = | 338 | struct lang_entry lang_suffixes[] = |
| 340 | { | 339 | { |
| 341 | /* Assume that ".s" or ".a" is assembly code. -wolfgang. | 340 | /* Assembly code */ |
| 342 | Or even ".sa". */ | ||
| 343 | { "a", Asm_labels }, /* Unix assembler */ | 341 | { "a", Asm_labels }, /* Unix assembler */ |
| 344 | { "asm", Asm_labels }, /* Microcontroller assembly */ | 342 | { "asm", Asm_labels }, /* Microcontroller assembly */ |
| 345 | { "def", Asm_labels }, /* BSO/Tasking definition includes */ | 343 | { "def", Asm_labels }, /* BSO/Tasking definition includes */ |
| @@ -349,24 +347,25 @@ struct lang_entry lang_suffixes[] = | |||
| 349 | { "sa", Asm_labels }, /* Unix assembler */ | 347 | { "sa", Asm_labels }, /* Unix assembler */ |
| 350 | { "src", Asm_labels }, /* BSO/Tasking C compiler output */ | 348 | { "src", Asm_labels }, /* BSO/Tasking C compiler output */ |
| 351 | 349 | ||
| 352 | /* .aux, .bbl, .clo, .cls, .dtx or .tex implies LaTeX source code. */ | 350 | /* LaTeX source code */ |
| 353 | { "aux", TeX_functions }, | 351 | { "bib", TeX_functions }, |
| 354 | { "bbl", TeX_functions }, | ||
| 355 | { "clo", TeX_functions }, | 352 | { "clo", TeX_functions }, |
| 356 | { "cls", TeX_functions }, | 353 | { "cls", TeX_functions }, |
| 357 | { "dtx", TeX_functions }, | 354 | { "ltx", TeX_functions }, |
| 358 | { "sty", TeX_functions }, | 355 | { "sty", TeX_functions }, |
| 356 | { "TeX", TeX_functions }, | ||
| 359 | { "tex", TeX_functions }, | 357 | { "tex", TeX_functions }, |
| 360 | 358 | ||
| 361 | /* .l or .el or .lisp (or .cl or .clisp or ...) implies lisp source code */ | 359 | /* Lisp source code */ |
| 362 | { "cl", Lisp_functions }, | 360 | { "cl", Lisp_functions }, |
| 363 | { "clisp", Lisp_functions }, | 361 | { "clisp", Lisp_functions }, |
| 364 | { "el", Lisp_functions }, | 362 | { "el", Lisp_functions }, |
| 365 | { "l", Lisp_functions }, | 363 | { "l", Lisp_functions }, |
| 366 | { "lisp", Lisp_functions }, | 364 | { "lisp", Lisp_functions }, |
| 367 | { "lsp", Lisp_functions }, | 365 | { "lsp", Lisp_functions }, |
| 366 | { "ml", Lisp_functions }, | ||
| 368 | 367 | ||
| 369 | /* .scm or .sm or .scheme implies scheme source code */ | 368 | /* Scheme source code */ |
| 370 | { "SCM", Scheme_functions }, | 369 | { "SCM", Scheme_functions }, |
| 371 | { "SM", Scheme_functions }, | 370 | { "SM", Scheme_functions }, |
| 372 | { "oak", Scheme_functions }, | 371 | { "oak", Scheme_functions }, |
| @@ -382,11 +381,10 @@ struct lang_entry lang_suffixes[] = | |||
| 382 | { "c", default_C_entries }, | 381 | { "c", default_C_entries }, |
| 383 | { "h", default_C_entries }, | 382 | { "h", default_C_entries }, |
| 384 | 383 | ||
| 385 | /* .pc is a Pro*C file. */ | 384 | /* Pro*C file. */ |
| 386 | { "pc", plain_C_entries }, | 385 | { "pc", plain_C_entries }, |
| 387 | 386 | ||
| 388 | /* .C or .H or .c++ or .cc or .cpp or .cxx or .h++ or .hh or .hxx: | 387 | /* C++ file */ |
| 389 | a C++ file */ | ||
| 390 | { "C", Cplusplus_entries }, | 388 | { "C", Cplusplus_entries }, |
| 391 | { "H", Cplusplus_entries }, | 389 | { "H", Cplusplus_entries }, |
| 392 | { "c++", Cplusplus_entries }, | 390 | { "c++", Cplusplus_entries }, |
| @@ -395,24 +393,26 @@ struct lang_entry lang_suffixes[] = | |||
| 395 | { "cxx", Cplusplus_entries }, | 393 | { "cxx", Cplusplus_entries }, |
| 396 | { "h++", Cplusplus_entries }, | 394 | { "h++", Cplusplus_entries }, |
| 397 | { "hh", Cplusplus_entries }, | 395 | { "hh", Cplusplus_entries }, |
| 396 | { "hpp", Cplusplus_entries }, | ||
| 398 | { "hxx", Cplusplus_entries }, | 397 | { "hxx", Cplusplus_entries }, |
| 399 | 398 | ||
| 400 | /* .y: a yacc file */ | 399 | /* Yacc file */ |
| 401 | { "y", Yacc_entries }, | 400 | { "y", Yacc_entries }, |
| 402 | 401 | ||
| 403 | /* .cs or .hs: a C* file */ | 402 | /* C* file */ |
| 404 | { "cs", Cstar_entries }, | 403 | { "cs", Cstar_entries }, |
| 405 | { "hs", Cstar_entries }, | 404 | { "hs", Cstar_entries }, |
| 406 | 405 | ||
| 407 | /* .F, .f and .for are FORTRAN. */ | 406 | /* Fortran */ |
| 408 | { "F", Fortran_functions }, | 407 | { "F", Fortran_functions }, |
| 409 | { "f", Fortran_functions }, | 408 | { "f", Fortran_functions }, |
| 409 | { "f90", Fortran_functions }, | ||
| 410 | { "for", Fortran_functions }, | 410 | { "for", Fortran_functions }, |
| 411 | 411 | ||
| 412 | /* .pl implies prolog source code */ | 412 | /* Prolog source code */ |
| 413 | { "pl", Prolog_functions }, | 413 | { "prolog", Prolog_functions }, |
| 414 | 414 | ||
| 415 | /* .p or .pas: a Pascal file */ | 415 | /* Pascal file */ |
| 416 | { "p", Pascal_functions }, | 416 | { "p", Pascal_functions }, |
| 417 | { "pas", Pascal_functions }, | 417 | { "pas", Pascal_functions }, |
| 418 | 418 | ||
| @@ -444,14 +444,13 @@ If no language is specified and no matching suffix is found,\n\ | |||
| 444 | Fortran is tried first; if no tags are found, C is tried next."); | 444 | Fortran is tried first; if no tags are found, C is tried next."); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | #ifndef VERSION | ||
| 448 | # define VERSION "19" | ||
| 449 | #endif | ||
| 447 | void | 450 | void |
| 448 | print_version () | 451 | print_version () |
| 449 | { | 452 | { |
| 450 | #ifdef VERSION | 453 | printf ("%s for Emacs version %s\n", (CTAGS) ? "ctags" : "etags", VERSION); |
| 451 | printf ("%s for Emacs version %s.\n", (CTAGS) ? "CTAGS" : "ETAGS", VERSION); | ||
| 452 | #else | ||
| 453 | printf ("%s for Emacs version 19.\n", (CTAGS) ? "CTAGS" : "ETAGS"); | ||
| 454 | #endif | ||
| 455 | 454 | ||
| 456 | exit (GOOD); | 455 | exit (GOOD); |
| 457 | } | 456 | } |
| @@ -584,14 +583,14 @@ typedef struct { | |||
| 584 | to it will be processed to completion; in particular, up to and | 583 | to it will be processed to completion; in particular, up to and |
| 585 | including the call following that in which the last matching name | 584 | including the call following that in which the last matching name |
| 586 | is returned, the function ignores the value of in_spec, and will | 585 | is returned, the function ignores the value of in_spec, and will |
| 587 | only start processing a new spec with the following call. | 586 | only start processing a new spec with the following call. |
| 588 | If an error occurs, on return out_spec contains the value | 587 | If an error occurs, on return out_spec contains the value |
| 589 | of in_spec when the error occurred. | 588 | of in_spec when the error occurred. |
| 590 | 589 | ||
| 591 | With each successive filename returned in out_spec, the | 590 | With each successive filename returned in out_spec, the |
| 592 | function's return value is one. When there are no more matching | 591 | function's return value is one. When there are no more matching |
| 593 | names the function returns zero. If on the first call no file | 592 | names the function returns zero. If on the first call no file |
| 594 | matches in_spec, or there is any other error, -1 is returned. | 593 | matches in_spec, or there is any other error, -1 is returned. |
| 595 | */ | 594 | */ |
| 596 | 595 | ||
| 597 | #include <rmsdef.h> | 596 | #include <rmsdef.h> |
| @@ -636,10 +635,10 @@ fn_exp (out, in) | |||
| 636 | lib$find_file_end(&context); | 635 | lib$find_file_end(&context); |
| 637 | pass1 = TRUE; | 636 | pass1 = TRUE; |
| 638 | return retval; | 637 | return retval; |
| 639 | } | 638 | } |
| 640 | 639 | ||
| 641 | /* | 640 | /* |
| 642 | v1.01 nmm 19-Aug-85 gfnames - return in successive calls the | 641 | v1.01 nmm 19-Aug-85 gfnames - return in successive calls the |
| 643 | name of each file specified by the provided arg expanding wildcards. | 642 | name of each file specified by the provided arg expanding wildcards. |
| 644 | */ | 643 | */ |
| 645 | char * | 644 | char * |
| @@ -675,7 +674,7 @@ system (cmd) | |||
| 675 | char *massage_name (s) | 674 | char *massage_name (s) |
| 676 | char *s; | 675 | char *s; |
| 677 | { | 676 | { |
| 678 | char *start = s; | 677 | char *start = s; |
| 679 | 678 | ||
| 680 | for ( ; *s; s++) | 679 | for ( ; *s; s++) |
| 681 | if (*s == VERSION_DELIM) | 680 | if (*s == VERSION_DELIM) |
| @@ -684,7 +683,7 @@ char *massage_name (s) | |||
| 684 | break; | 683 | break; |
| 685 | } | 684 | } |
| 686 | else | 685 | else |
| 687 | *s = tolower(*s); | 686 | *s = lowcase (*s); |
| 688 | return start; | 687 | return start; |
| 689 | } | 688 | } |
| 690 | #endif /* VMS */ | 689 | #endif /* VMS */ |
| @@ -705,7 +704,7 @@ main (argc, argv) | |||
| 705 | #ifdef VMS | 704 | #ifdef VMS |
| 706 | logical got_err; | 705 | logical got_err; |
| 707 | #endif | 706 | #endif |
| 708 | 707 | ||
| 709 | #ifdef DOS_NT | 708 | #ifdef DOS_NT |
| 710 | _fmode = O_BINARY; /* all of files are treated as binary files */ | 709 | _fmode = O_BINARY; /* all of files are treated as binary files */ |
| 711 | #endif /* DOS_NT */ | 710 | #endif /* DOS_NT */ |
| @@ -1108,7 +1107,9 @@ find_entries (file, inf) | |||
| 1108 | NODE *old_last_node; | 1107 | NODE *old_last_node; |
| 1109 | extern NODE *last_node; | 1108 | extern NODE *last_node; |
| 1110 | 1109 | ||
| 1111 | /* The memory block pointed by curfile is never released for simplicity. */ | 1110 | /* Memory leakage here: the memory block pointed by curfile is never |
| 1111 | released. The amount of memory leaked here is the sum of the | ||
| 1112 | lengths of the input file names. */ | ||
| 1112 | curfile = savestr (file); | 1113 | curfile = savestr (file); |
| 1113 | cp = etags_strrchr (file, '.'); | 1114 | cp = etags_strrchr (file, '.'); |
| 1114 | 1115 | ||
| @@ -1257,26 +1258,18 @@ add_node (node, cur_node_p) | |||
| 1257 | node->file, lineno, node->name); | 1258 | node->file, lineno, node->name); |
| 1258 | fprintf (stderr, "Second entry ignored\n"); | 1259 | fprintf (stderr, "Second entry ignored\n"); |
| 1259 | } | 1260 | } |
| 1260 | return; | ||
| 1261 | } | 1261 | } |
| 1262 | if (!cur_node->been_warned && !no_warnings) | 1262 | else if (!cur_node->been_warned && !no_warnings) |
| 1263 | { | 1263 | { |
| 1264 | fprintf (stderr, | 1264 | fprintf |
| 1265 | "Duplicate entry in files %s and %s: %s (Warning only)\n", | 1265 | (stderr, |
| 1266 | node->file, cur_node->file, node->name); | 1266 | "Duplicate entry in files %s and %s: %s (Warning only)\n", |
| 1267 | node->file, cur_node->file, node->name); | ||
| 1268 | cur_node->been_warned = TRUE; | ||
| 1267 | } | 1269 | } |
| 1268 | cur_node->been_warned = TRUE; | ||
| 1269 | return; | 1270 | return; |
| 1270 | } | 1271 | } |
| 1271 | 1272 | ||
| 1272 | /* Maybe refuse to add duplicate nodes. */ | ||
| 1273 | if (!permit_duplicates) | ||
| 1274 | { | ||
| 1275 | if (streq (node->name, cur_node->name) | ||
| 1276 | && streq (node->file, cur_node->file)) | ||
| 1277 | return; | ||
| 1278 | } | ||
| 1279 | |||
| 1280 | /* Actually add the node */ | 1273 | /* Actually add the node */ |
| 1281 | add_node (node, dif < 0 ? &cur_node->left : &cur_node->right); | 1274 | add_node (node, dif < 0 ? &cur_node->left : &cur_node->right); |
| 1282 | } | 1275 | } |
| @@ -1469,41 +1462,41 @@ in_word_set (str, len) | |||
| 1469 | 1462 | ||
| 1470 | static struct C_stab_entry wordlist[] = | 1463 | static struct C_stab_entry wordlist[] = |
| 1471 | { | 1464 | { |
| 1472 | {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, | 1465 | {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, |
| 1473 | {"",}, | 1466 | {"",}, |
| 1474 | {"volatile", 0, st_C_typespec}, | 1467 | {"volatile", 0, st_C_typespec}, |
| 1475 | {"",}, | 1468 | {"",}, |
| 1476 | {"long", 0, st_C_typespec}, | 1469 | {"long", 0, st_C_typespec}, |
| 1477 | {"char", 0, st_C_typespec}, | 1470 | {"char", 0, st_C_typespec}, |
| 1478 | {"class", C_PLPL, st_C_struct}, | 1471 | {"class", C_PLPL, st_C_struct}, |
| 1479 | {"",}, {"",}, {"",}, {"",}, | 1472 | {"",}, {"",}, {"",}, {"",}, |
| 1480 | {"const", 0, st_C_typespec}, | 1473 | {"const", 0, st_C_typespec}, |
| 1481 | {"",}, {"",}, {"",}, {"",}, | 1474 | {"",}, {"",}, {"",}, {"",}, |
| 1482 | {"auto", 0, st_C_typespec}, | 1475 | {"auto", 0, st_C_typespec}, |
| 1483 | {"",}, {"",}, | 1476 | {"",}, {"",}, |
| 1484 | {"define", 0, st_C_define}, | 1477 | {"define", 0, st_C_define}, |
| 1485 | {"",}, | 1478 | {"",}, |
| 1486 | {"void", 0, st_C_typespec}, | 1479 | {"void", 0, st_C_typespec}, |
| 1487 | {"",}, {"",}, {"",}, | 1480 | {"",}, {"",}, {"",}, |
| 1488 | {"extern", 0, st_C_typespec}, | 1481 | {"extern", 0, st_C_typespec}, |
| 1489 | {"static", 0, st_C_typespec}, | 1482 | {"static", 0, st_C_typespec}, |
| 1490 | {"",}, | 1483 | {"",}, |
| 1491 | {"domain", C_STAR, st_C_struct}, | 1484 | {"domain", C_STAR, st_C_struct}, |
| 1492 | {"",}, | 1485 | {"",}, |
| 1493 | {"typedef", 0, st_C_typedef}, | 1486 | {"typedef", 0, st_C_typedef}, |
| 1494 | {"double", 0, st_C_typespec}, | 1487 | {"double", 0, st_C_typespec}, |
| 1495 | {"enum", 0, st_C_enum}, | 1488 | {"enum", 0, st_C_enum}, |
| 1496 | {"",}, {"",}, {"",}, {"",}, | 1489 | {"",}, {"",}, {"",}, {"",}, |
| 1497 | {"int", 0, st_C_typespec}, | 1490 | {"int", 0, st_C_typespec}, |
| 1498 | {"",}, | 1491 | {"",}, |
| 1499 | {"float", 0, st_C_typespec}, | 1492 | {"float", 0, st_C_typespec}, |
| 1500 | {"",}, {"",}, {"",}, | 1493 | {"",}, {"",}, {"",}, |
| 1501 | {"struct", 0, st_C_struct}, | 1494 | {"struct", 0, st_C_struct}, |
| 1502 | {"",}, {"",}, {"",}, {"",}, | 1495 | {"",}, {"",}, {"",}, {"",}, |
| 1503 | {"union", 0, st_C_struct}, | 1496 | {"union", 0, st_C_struct}, |
| 1504 | {"",}, | 1497 | {"",}, |
| 1505 | {"short", 0, st_C_typespec}, | 1498 | {"short", 0, st_C_typespec}, |
| 1506 | {"",}, {"",}, | 1499 | {"",}, {"",}, |
| 1507 | {"unsigned", 0, st_C_typespec}, | 1500 | {"unsigned", 0, st_C_typespec}, |
| 1508 | {"signed", 0, st_C_typespec}, | 1501 | {"signed", 0, st_C_typespec}, |
| 1509 | }; | 1502 | }; |
| @@ -1568,7 +1561,7 @@ typedef enum | |||
| 1568 | TYPEDST typdef; | 1561 | TYPEDST typdef; |
| 1569 | 1562 | ||
| 1570 | 1563 | ||
| 1571 | /* | 1564 | /* |
| 1572 | * struct-like structures (enum, struct and union) are recognized | 1565 | * struct-like structures (enum, struct and union) are recognized |
| 1573 | * using another simple finite automaton. `structdef' is its state | 1566 | * using another simple finite automaton. `structdef' is its state |
| 1574 | * variable. | 1567 | * variable. |
| @@ -1585,7 +1578,7 @@ STRUCTST structdef; | |||
| 1585 | 1578 | ||
| 1586 | /* | 1579 | /* |
| 1587 | * When structdef is stagseen, scolonseen, or sinbody, structtag is the | 1580 | * When structdef is stagseen, scolonseen, or sinbody, structtag is the |
| 1588 | * struct tag, and structtype is the type of the preceding struct-like | 1581 | * struct tag, and structtype is the type of the preceding struct-like |
| 1589 | * keyword. | 1582 | * keyword. |
| 1590 | */ | 1583 | */ |
| 1591 | char *structtag = "<uninited>"; | 1584 | char *structtag = "<uninited>"; |
| @@ -1730,9 +1723,9 @@ consider_token (str, len, c, c_ext, cblev, is_func) | |||
| 1730 | * file is plain C. This is because a struct tag may have the same | 1723 | * file is plain C. This is because a struct tag may have the same |
| 1731 | * name as another tag, and this loses with ctags. | 1724 | * name as another tag, and this loses with ctags. |
| 1732 | * | 1725 | * |
| 1733 | * This if statement deals with the typdef state machine as | 1726 | * This if statement deals with the typdef state machine as |
| 1734 | * follows: if typdef==ttypedseen and token is struct/union/class/enum, | 1727 | * follows: if typdef==ttypedseen and token is struct/union/class/enum, |
| 1735 | * return FALSE. All the other code here is for the structdef | 1728 | * return FALSE. All the other code here is for the structdef |
| 1736 | * state machine. | 1729 | * state machine. |
| 1737 | */ | 1730 | */ |
| 1738 | switch (toktype) | 1731 | switch (toktype) |
| @@ -1769,7 +1762,7 @@ consider_token (str, len, c, c_ext, cblev, is_func) | |||
| 1769 | /* Detect GNU macros. */ | 1762 | /* Detect GNU macros. */ |
| 1770 | if (definedef == dnone) | 1763 | if (definedef == dnone) |
| 1771 | if (strneq (str, "DEFUN", len) /* Used in emacs */ | 1764 | if (strneq (str, "DEFUN", len) /* Used in emacs */ |
| 1772 | #if FALSE | 1765 | #if FALSE |
| 1773 | These are defined inside C functions, so currently they | 1766 | These are defined inside C functions, so currently they |
| 1774 | are not met anyway. | 1767 | are not met anyway. |
| 1775 | || strneq (str, "EXFUN", len) /* Used in glibc */ | 1768 | || strneq (str, "EXFUN", len) /* Used in glibc */ |
| @@ -1968,7 +1961,7 @@ C_entries (c_ext, inf) | |||
| 1968 | } | 1961 | } |
| 1969 | continue; | 1962 | continue; |
| 1970 | } | 1963 | } |
| 1971 | else | 1964 | else |
| 1972 | switch (c) | 1965 | switch (c) |
| 1973 | { | 1966 | { |
| 1974 | case '"': | 1967 | case '"': |
| @@ -2333,9 +2326,13 @@ C_entries (c_ext, inf) | |||
| 2333 | { | 2326 | { |
| 2334 | if (typdef == tinbody) | 2327 | if (typdef == tinbody) |
| 2335 | typdef = tend; | 2328 | typdef = tend; |
| 2336 | if (FALSE) /* too risky */ | 2329 | /* Memory leakage here: the string pointed by structtag is |
| 2337 | if (structdef == sinbody) | 2330 | never released, because I fear to miss something and |
| 2338 | free (structtag); | 2331 | break things while freeing the area. The amount of |
| 2332 | memory leaked here is the sum of the lenghts of the | ||
| 2333 | struct tags. | ||
| 2334 | if (structdef == sinbody) | ||
| 2335 | free (structtag); */ | ||
| 2339 | 2336 | ||
| 2340 | structdef = snone; | 2337 | structdef = snone; |
| 2341 | structtag = "<error>"; | 2338 | structtag = "<error>"; |
| @@ -2788,7 +2785,7 @@ Pascal_functions (inf) | |||
| 2788 | } | 2785 | } |
| 2789 | } | 2786 | } |
| 2790 | } /* while not eof */ | 2787 | } /* while not eof */ |
| 2791 | 2788 | ||
| 2792 | free (tline.buffer); | 2789 | free (tline.buffer); |
| 2793 | } | 2790 | } |
| 2794 | 2791 | ||
| @@ -2836,7 +2833,7 @@ L_getit () | |||
| 2836 | continue; | 2833 | continue; |
| 2837 | if (cp == dbp) | 2834 | if (cp == dbp) |
| 2838 | return; | 2835 | return; |
| 2839 | 2836 | ||
| 2840 | pfnote (NULL, TRUE, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); | 2837 | pfnote (NULL, TRUE, lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
| 2841 | } | 2838 | } |
| 2842 | 2839 | ||
| @@ -2974,7 +2971,8 @@ struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */ | |||
| 2974 | The value of environment var TEXTAGS is prepended to this. */ | 2971 | The value of environment var TEXTAGS is prepended to this. */ |
| 2975 | 2972 | ||
| 2976 | char *TEX_defenv = "\ | 2973 | char *TEX_defenv = "\ |
| 2977 | :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem:typeout"; | 2974 | :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ |
| 2975 | :part:appendix:entry:index"; | ||
| 2978 | 2976 | ||
| 2979 | void TEX_mode (); | 2977 | void TEX_mode (); |
| 2980 | struct TEX_tabent *TEX_decode_env (); | 2978 | struct TEX_tabent *TEX_decode_env (); |
| @@ -3366,7 +3364,7 @@ add_regex (regexp_pattern) | |||
| 3366 | } | 3364 | } |
| 3367 | 3365 | ||
| 3368 | /* | 3366 | /* |
| 3369 | * Do the subtitutions indicated by the regular expression and | 3367 | * Do the substitutions indicated by the regular expression and |
| 3370 | * arguments. | 3368 | * arguments. |
| 3371 | */ | 3369 | */ |
| 3372 | char * | 3370 | char * |
| @@ -3414,20 +3412,7 @@ substitute (in, out, regs) | |||
| 3414 | size += regs->end[dig2] - regs->start[dig2]; | 3412 | size += regs->end[dig2] - regs->start[dig2]; |
| 3415 | } | 3413 | } |
| 3416 | else | 3414 | else |
| 3417 | { | 3415 | result[size++] = *out; |
| 3418 | switch (*out) | ||
| 3419 | { | ||
| 3420 | case '\t': | ||
| 3421 | result[size++] = '\t'; | ||
| 3422 | break; | ||
| 3423 | case '\\': | ||
| 3424 | *out = '\\'; | ||
| 3425 | break; | ||
| 3426 | default: | ||
| 3427 | result[size++] = *out; | ||
| 3428 | break; | ||
| 3429 | } | ||
| 3430 | } | ||
| 3431 | } | 3416 | } |
| 3432 | else | 3417 | else |
| 3433 | result[size++] = *out; | 3418 | result[size++] = *out; |
| @@ -3688,7 +3673,7 @@ concat (s1, s2, s3) | |||
| 3688 | } | 3673 | } |
| 3689 | 3674 | ||
| 3690 | /* Does the same work as the system V getcwd, but does not need to | 3675 | /* Does the same work as the system V getcwd, but does not need to |
| 3691 | guess buffer size in advance. */ | 3676 | guess the buffer size in advance. */ |
| 3692 | char * | 3677 | char * |
| 3693 | etags_getcwd () | 3678 | etags_getcwd () |
| 3694 | { | 3679 | { |
| @@ -3701,7 +3686,7 @@ etags_getcwd () | |||
| 3701 | if (*p == '\\') | 3686 | if (*p == '\\') |
| 3702 | *p++ = '/'; | 3687 | *p++ = '/'; |
| 3703 | else | 3688 | else |
| 3704 | *p++ = tolower (*p); | 3689 | *p++ = lowcase (*p); |
| 3705 | 3690 | ||
| 3706 | return strdup (path); | 3691 | return strdup (path); |
| 3707 | #else /* not DOS_NT */ | 3692 | #else /* not DOS_NT */ |