diff options
| author | Francesco Potortì | 2006-07-30 09:43:47 +0000 |
|---|---|---|
| committer | Francesco Potortì | 2006-07-30 09:43:47 +0000 |
| commit | 35a4c758b3e9c7014267c983ca01911f5cd69b24 (patch) | |
| tree | 729666f4aad00a41c51d2d33693d82de4da1ef0c /lib-src | |
| parent | fc185ae6a7d5204a123604821f593a8ac12c04a1 (diff) | |
| download | emacs-35a4c758b3e9c7014267c983ca01911f5cd69b24.tar.gz emacs-35a4c758b3e9c7014267c983ca01911f5cd69b24.zip | |
Adrian Aichner: <adrian@xemacs.org>
It's XEmacs, not Xemacs: change all the occurences.
[ETAGS_REGEXPS]: Now is unconditionally defined.
[LONG_OPTIONS]: Changed to NO_LONG_OPTIONS, which is undefined.
(Objc_suffixes): Suggest using --lang=c for full help.
(C_entries): Initialise savetoken to 0 to shut up the compiler.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 89 |
1 files changed, 25 insertions, 64 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index b5ff33c8b4c..d60c12c2bcc 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | * configuration file containing regexp definitions for etags. | 41 | * configuration file containing regexp definitions for etags. |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | char pot_etags_version[] = "@(#) pot revision number is 17.18"; | 44 | char pot_etags_version[] = "@(#) pot revision number is 17.20"; |
| 45 | 45 | ||
| 46 | #define TRUE 1 | 46 | #define TRUE 1 |
| 47 | #define FALSE 0 | 47 | #define FALSE 0 |
| @@ -59,12 +59,10 @@ char pot_etags_version[] = "@(#) pot revision number is 17.18"; | |||
| 59 | /* On some systems, Emacs defines static as nothing for the sake | 59 | /* On some systems, Emacs defines static as nothing for the sake |
| 60 | of unexec. We don't want that here since we don't use unexec. */ | 60 | of unexec. We don't want that here since we don't use unexec. */ |
| 61 | # undef static | 61 | # undef static |
| 62 | # define ETAGS_REGEXPS /* use the regexp features */ | 62 | # ifndef PTR /* for XEmacs */ |
| 63 | # define LONG_OPTIONS /* accept long options */ | ||
| 64 | # ifndef PTR /* for Xemacs */ | ||
| 65 | # define PTR void * | 63 | # define PTR void * |
| 66 | # endif | 64 | # endif |
| 67 | # ifndef __P /* for Xemacs */ | 65 | # ifndef __P /* for XEmacs */ |
| 68 | # define __P(args) args | 66 | # define __P(args) args |
| 69 | # endif | 67 | # endif |
| 70 | #else /* no config.h */ | 68 | #else /* no config.h */ |
| @@ -82,14 +80,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.18"; | |||
| 82 | # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ | 80 | # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ |
| 83 | #endif | 81 | #endif |
| 84 | 82 | ||
| 85 | #ifdef LONG_OPTIONS | 83 | /* WIN32_NATIVE is for XEmacs. |
| 86 | # undef LONG_OPTIONS | ||
| 87 | # define LONG_OPTIONS TRUE | ||
| 88 | #else | ||
| 89 | # define LONG_OPTIONS FALSE | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* WIN32_NATIVE is for Xemacs. | ||
| 93 | MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ | 84 | MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ |
| 94 | #ifdef WIN32_NATIVE | 85 | #ifdef WIN32_NATIVE |
| 95 | # undef MSDOS | 86 | # undef MSDOS |
| @@ -167,25 +158,25 @@ char pot_etags_version[] = "@(#) pot revision number is 17.18"; | |||
| 167 | # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | 158 | # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
| 168 | #endif | 159 | #endif |
| 169 | 160 | ||
| 170 | #if LONG_OPTIONS | 161 | #ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ |
| 171 | # include <getopt.h> | 162 | # define NO_LONG_OPTIONS TRUE |
| 172 | #else | ||
| 173 | # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) | 163 | # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) |
| 174 | extern char *optarg; | 164 | extern char *optarg; |
| 175 | extern int optind, opterr; | 165 | extern int optind, opterr; |
| 176 | #endif /* LONG_OPTIONS */ | 166 | #else |
| 167 | # define NO_LONG_OPTIONS FALSE | ||
| 168 | # include <getopt.h> | ||
| 169 | #endif /* NO_LONG_OPTIONS */ | ||
| 177 | 170 | ||
| 178 | #ifdef ETAGS_REGEXPS | 171 | #ifndef HAVE_CONFIG_H /* this is a standalone compilation */ |
| 179 | # ifndef HAVE_CONFIG_H /* this is a standalone compilation */ | 172 | # ifdef __CYGWIN__ /* compiling on Cygwin */ |
| 180 | # ifdef __CYGWIN__ /* compiling on Cygwin */ | ||
| 181 | !!! NOTICE !!! | 173 | !!! NOTICE !!! |
| 182 | the regex.h distributed with Cygwin is not compatible with etags, alas! | 174 | the regex.h distributed with Cygwin is not compatible with etags, alas! |
| 183 | If you want regular expression support, you should delete this notice and | 175 | If you want regular expression support, you should delete this notice and |
| 184 | arrange to use the GNU regex.h and regex.c. | 176 | arrange to use the GNU regex.h and regex.c. |
| 185 | # endif | ||
| 186 | # endif | 177 | # endif |
| 187 | # include <regex.h> | 178 | #endif |
| 188 | #endif /* ETAGS_REGEXPS */ | 179 | #include <regex.h> |
| 189 | 180 | ||
| 190 | /* Define CTAGS to make the program "ctags" compatible with the usual one. | 181 | /* Define CTAGS to make the program "ctags" compatible with the usual one. |
| 191 | Leave it undefined to make the program "etags", which makes emacs-style | 182 | Leave it undefined to make the program "etags", which makes emacs-style |
| @@ -312,7 +303,6 @@ typedef struct | |||
| 312 | char *what; /* the argument itself */ | 303 | char *what; /* the argument itself */ |
| 313 | } argument; | 304 | } argument; |
| 314 | 305 | ||
| 315 | #ifdef ETAGS_REGEXPS | ||
| 316 | /* Structure defining a regular expression. */ | 306 | /* Structure defining a regular expression. */ |
| 317 | typedef struct regexp | 307 | typedef struct regexp |
| 318 | { | 308 | { |
| @@ -327,7 +317,6 @@ typedef struct regexp | |||
| 327 | bool ignore_case; /* ignore case when matching */ | 317 | bool ignore_case; /* ignore case when matching */ |
| 328 | bool multi_line; /* do a multi-line match on the whole file */ | 318 | bool multi_line; /* do a multi-line match on the whole file */ |
| 329 | } regexp; | 319 | } regexp; |
| 330 | #endif /* ETAGS_REGEXPS */ | ||
| 331 | 320 | ||
| 332 | 321 | ||
| 333 | /* Many compilers barf on this: | 322 | /* Many compilers barf on this: |
| @@ -375,11 +364,9 @@ static long readline_internal __P((linebuffer *, FILE *)); | |||
| 375 | static bool nocase_tail __P((char *)); | 364 | static bool nocase_tail __P((char *)); |
| 376 | static void get_tag __P((char *, char **)); | 365 | static void get_tag __P((char *, char **)); |
| 377 | 366 | ||
| 378 | #ifdef ETAGS_REGEXPS | ||
| 379 | static void analyse_regex __P((char *)); | 367 | static void analyse_regex __P((char *)); |
| 380 | static void free_regexps __P((void)); | 368 | static void free_regexps __P((void)); |
| 381 | static void regex_tag_multiline __P((void)); | 369 | static void regex_tag_multiline __P((void)); |
| 382 | #endif /* ETAGS_REGEXPS */ | ||
| 383 | static void error __P((const char *, const char *)); | 370 | static void error __P((const char *, const char *)); |
| 384 | static void suggest_asking_for_help __P((void)); | 371 | static void suggest_asking_for_help __P((void)); |
| 385 | void fatal __P((char *, char *)); | 372 | void fatal __P((char *, char *)); |
| @@ -485,14 +472,9 @@ static bool packages_only; /* --packages-only: in Ada, only tag packages*/ | |||
| 485 | #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ | 472 | #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ |
| 486 | static bool parsing_stdin; /* --parse-stdin used */ | 473 | static bool parsing_stdin; /* --parse-stdin used */ |
| 487 | 474 | ||
| 488 | #ifdef ETAGS_REGEXPS | ||
| 489 | static regexp *p_head; /* list of all regexps */ | 475 | static regexp *p_head; /* list of all regexps */ |
| 490 | static bool need_filebuf; /* some regexes are multi-line */ | 476 | static bool need_filebuf; /* some regexes are multi-line */ |
| 491 | #else | ||
| 492 | # define need_filebuf FALSE | ||
| 493 | #endif /* ETAGS_REGEXPS */ | ||
| 494 | 477 | ||
| 495 | #if LONG_OPTIONS | ||
| 496 | static struct option longopts[] = | 478 | static struct option longopts[] = |
| 497 | { | 479 | { |
| 498 | { "append", no_argument, NULL, 'a' }, | 480 | { "append", no_argument, NULL, 'a' }, |
| @@ -507,11 +489,9 @@ static struct option longopts[] = | |||
| 507 | { "members", no_argument, &members, TRUE }, | 489 | { "members", no_argument, &members, TRUE }, |
| 508 | { "no-members", no_argument, &members, FALSE }, | 490 | { "no-members", no_argument, &members, FALSE }, |
| 509 | { "output", required_argument, NULL, 'o' }, | 491 | { "output", required_argument, NULL, 'o' }, |
| 510 | #ifdef ETAGS_REGEXPS | ||
| 511 | { "regex", required_argument, NULL, 'r' }, | 492 | { "regex", required_argument, NULL, 'r' }, |
| 512 | { "no-regex", no_argument, NULL, 'R' }, | 493 | { "no-regex", no_argument, NULL, 'R' }, |
| 513 | { "ignore-case-regex", required_argument, NULL, 'c' }, | 494 | { "ignore-case-regex", required_argument, NULL, 'c' }, |
| 514 | #endif /* ETAGS_REGEXPS */ | ||
| 515 | { "parse-stdin", required_argument, NULL, STDIN }, | 495 | { "parse-stdin", required_argument, NULL, STDIN }, |
| 516 | { "version", no_argument, NULL, 'V' }, | 496 | { "version", no_argument, NULL, 'V' }, |
| 517 | 497 | ||
| @@ -533,7 +513,6 @@ static struct option longopts[] = | |||
| 533 | #endif | 513 | #endif |
| 534 | { NULL } | 514 | { NULL } |
| 535 | }; | 515 | }; |
| 536 | #endif /* LONG_OPTIONS */ | ||
| 537 | 516 | ||
| 538 | static compressor compressors[] = | 517 | static compressor compressors[] = |
| 539 | { | 518 | { |
| @@ -681,13 +660,15 @@ static char *Objc_suffixes [] = | |||
| 681 | static char Objc_help [] = | 660 | static char Objc_help [] = |
| 682 | "In Objective C code, tags include Objective C definitions for classes,\n\ | 661 | "In Objective C code, tags include Objective C definitions for classes,\n\ |
| 683 | class categories, methods and protocols. Tags for variables and\n\ | 662 | class categories, methods and protocols. Tags for variables and\n\ |
| 684 | functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'."; | 663 | functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\ |
| 664 | (Use --help --lang=c --lang=objc --lang=java for full help.)"; | ||
| 685 | 665 | ||
| 686 | static char *Pascal_suffixes [] = | 666 | static char *Pascal_suffixes [] = |
| 687 | { "p", "pas", NULL }; | 667 | { "p", "pas", NULL }; |
| 688 | static char Pascal_help [] = | 668 | static char Pascal_help [] = |
| 689 | "In Pascal code, the tags are the functions and procedures defined\n\ | 669 | "In Pascal code, the tags are the functions and procedures defined\n\ |
| 690 | in the file."; | 670 | in the file."; |
| 671 | /* " // this is for working around an Emacs highlighting bug... */ | ||
| 691 | 672 | ||
| 692 | static char *Perl_suffixes [] = | 673 | static char *Perl_suffixes [] = |
| 693 | { "pl", "pm", NULL }; | 674 | { "pl", "pm", NULL }; |
| @@ -885,11 +866,11 @@ print_help (argbuffer) | |||
| 885 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ | 866 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ |
| 886 | \n\ | 867 | \n\ |
| 887 | These are the options accepted by %s.\n", progname, progname); | 868 | These are the options accepted by %s.\n", progname, progname); |
| 888 | if (LONG_OPTIONS) | 869 | if (NO_LONG_OPTIONS) |
| 889 | puts ("You may use unambiguous abbreviations for the long option names."); | 870 | puts ("WARNING: long option names do not work with this executable,\n\ |
| 871 | as it is not linked with GNU getopt."); | ||
| 890 | else | 872 | else |
| 891 | puts ("Long option names do not work with this executable, as it is not\n\ | 873 | puts ("You may use unambiguous abbreviations for the long option names."); |
| 892 | linked with GNU getopt."); | ||
| 893 | puts (" A - as file name means read names from stdin (one per line).\n\ | 874 | puts (" A - as file name means read names from stdin (one per line).\n\ |
| 894 | Absolute names are stored in the output file as they are.\n\ | 875 | Absolute names are stored in the output file as they are.\n\ |
| 895 | Relative ones are stored relative to the output file's directory.\n"); | 876 | Relative ones are stored relative to the output file's directory.\n"); |
| @@ -949,7 +930,6 @@ Relative ones are stored relative to the output file's directory.\n"); | |||
| 949 | puts ("--members\n\ | 930 | puts ("--members\n\ |
| 950 | Create tag entries for members of structures in some languages."); | 931 | Create tag entries for members of structures in some languages."); |
| 951 | 932 | ||
| 952 | #ifdef ETAGS_REGEXPS | ||
| 953 | puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\ | 933 | puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\ |
| 954 | Make a tag for each line matching a regular expression pattern\n\ | 934 | Make a tag for each line matching a regular expression pattern\n\ |
| 955 | in the following files. {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\ | 935 | in the following files. {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\ |
| @@ -964,7 +944,6 @@ Relative ones are stored relative to the output file's directory.\n"); | |||
| 964 | causes dot to match any character, including newline."); | 944 | causes dot to match any character, including newline."); |
| 965 | puts ("-R, --no-regex\n\ | 945 | puts ("-R, --no-regex\n\ |
| 966 | Don't create tags from regexps for the following files."); | 946 | Don't create tags from regexps for the following files."); |
| 967 | #endif /* ETAGS_REGEXPS */ | ||
| 968 | puts ("-I, --ignore-indentation\n\ | 947 | puts ("-I, --ignore-indentation\n\ |
| 969 | In C and C++ do not assume that a closing brace in the first\n\ | 948 | In C and C++ do not assume that a closing brace in the first\n\ |
| 970 | column is the final brace of a function or structure definition."); | 949 | column is the final brace of a function or structure definition."); |
| @@ -1194,14 +1173,8 @@ main (argc, argv) | |||
| 1194 | 1173 | ||
| 1195 | /* When the optstring begins with a '-' getopt_long does not rearrange the | 1174 | /* When the optstring begins with a '-' getopt_long does not rearrange the |
| 1196 | non-options arguments to be at the end, but leaves them alone. */ | 1175 | non-options arguments to be at the end, but leaves them alone. */ |
| 1197 | optstring = "-"; | 1176 | optstring = concat (NO_LONG_OPTIONS ? "" : "-", |
| 1198 | #ifdef ETAGS_REGEXPS | 1177 | "ac:Cf:Il:o:r:RSVhH", |
| 1199 | optstring = "-r:Rc:"; | ||
| 1200 | #endif /* ETAGS_REGEXPS */ | ||
| 1201 | if (!LONG_OPTIONS) | ||
| 1202 | optstring += 1; /* remove the initial '-' */ | ||
| 1203 | optstring = concat (optstring, | ||
| 1204 | "aCf:Il:o:SVhH", | ||
| 1205 | (CTAGS) ? "BxdtTuvw" : "Di:"); | 1178 | (CTAGS) ? "BxdtTuvw" : "Di:"); |
| 1206 | 1179 | ||
| 1207 | while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) | 1180 | while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) |
| @@ -1375,11 +1348,9 @@ main (argc, argv) | |||
| 1375 | case at_language: | 1348 | case at_language: |
| 1376 | lang = argbuffer[i].lang; | 1349 | lang = argbuffer[i].lang; |
| 1377 | break; | 1350 | break; |
| 1378 | #ifdef ETAGS_REGEXPS | ||
| 1379 | case at_regexp: | 1351 | case at_regexp: |
| 1380 | analyse_regex (argbuffer[i].what); | 1352 | analyse_regex (argbuffer[i].what); |
| 1381 | break; | 1353 | break; |
| 1382 | #endif | ||
| 1383 | case at_filename: | 1354 | case at_filename: |
| 1384 | #ifdef VMS | 1355 | #ifdef VMS |
| 1385 | while ((this_file = gfnames (argbuffer[i].what, &got_err)) != NULL) | 1356 | while ((this_file = gfnames (argbuffer[i].what, &got_err)) != NULL) |
| @@ -1419,9 +1390,7 @@ main (argc, argv) | |||
| 1419 | } | 1390 | } |
| 1420 | } | 1391 | } |
| 1421 | 1392 | ||
| 1422 | #ifdef ETAGS_REGEXPS | ||
| 1423 | free_regexps (); | 1393 | free_regexps (); |
| 1424 | #endif /* ETAGS_REGEXPS */ | ||
| 1425 | free (lb.buffer); | 1394 | free (lb.buffer); |
| 1426 | free (filebuf.buffer); | 1395 | free (filebuf.buffer); |
| 1427 | free (token_name.buffer); | 1396 | free (token_name.buffer); |
| @@ -1979,9 +1948,7 @@ find_entries (inf) | |||
| 1979 | 1948 | ||
| 1980 | parser (inf); | 1949 | parser (inf); |
| 1981 | 1950 | ||
| 1982 | #ifdef ETAGS_REGEXPS | ||
| 1983 | regex_tag_multiline (); | 1951 | regex_tag_multiline (); |
| 1984 | #endif /* ETAGS_REGEXPS */ | ||
| 1985 | } | 1952 | } |
| 1986 | 1953 | ||
| 1987 | 1954 | ||
| @@ -3239,7 +3206,7 @@ C_entries (c_ext, inf) | |||
| 3239 | int typdefbracelev; /* bracelev where a typedef struct body begun */ | 3206 | int typdefbracelev; /* bracelev where a typedef struct body begun */ |
| 3240 | bool incomm, inquote, inchar, quotednl, midtoken; | 3207 | bool incomm, inquote, inchar, quotednl, midtoken; |
| 3241 | bool yacc_rules; /* in the rules part of a yacc file */ | 3208 | bool yacc_rules; /* in the rules part of a yacc file */ |
| 3242 | struct tok savetoken; /* token saved during preprocessor handling */ | 3209 | struct tok savetoken = {0}; /* token saved during preprocessor handling */ |
| 3243 | 3210 | ||
| 3244 | 3211 | ||
| 3245 | linebuffer_init (&lbs[0].lb); | 3212 | linebuffer_init (&lbs[0].lb); |
| @@ -5735,8 +5702,6 @@ erlang_atom (s) | |||
| 5735 | } | 5702 | } |
| 5736 | 5703 | ||
| 5737 | 5704 | ||
| 5738 | #ifdef ETAGS_REGEXPS | ||
| 5739 | |||
| 5740 | static char *scan_separators __P((char *)); | 5705 | static char *scan_separators __P((char *)); |
| 5741 | static void add_regex __P((char *, language *)); | 5706 | static void add_regex __P((char *, language *)); |
| 5742 | static char *substitute __P((char *, char *, struct re_registers *)); | 5707 | static char *substitute __P((char *, char *, struct re_registers *)); |
| @@ -6141,8 +6106,6 @@ regex_tag_multiline () | |||
| 6141 | } | 6106 | } |
| 6142 | } | 6107 | } |
| 6143 | 6108 | ||
| 6144 | #endif /* ETAGS_REGEXPS */ | ||
| 6145 | |||
| 6146 | 6109 | ||
| 6147 | static bool | 6110 | static bool |
| 6148 | nocase_tail (cp) | 6111 | nocase_tail (cp) |
| @@ -6405,7 +6368,6 @@ readline (lbp, stream) | |||
| 6405 | } | 6368 | } |
| 6406 | } /* if #line directives should be considered */ | 6369 | } /* if #line directives should be considered */ |
| 6407 | 6370 | ||
| 6408 | #ifdef ETAGS_REGEXPS | ||
| 6409 | { | 6371 | { |
| 6410 | int match; | 6372 | int match; |
| 6411 | regexp *rp; | 6373 | regexp *rp; |
| @@ -6462,7 +6424,6 @@ readline (lbp, stream) | |||
| 6462 | } | 6424 | } |
| 6463 | } | 6425 | } |
| 6464 | } | 6426 | } |
| 6465 | #endif /* ETAGS_REGEXPS */ | ||
| 6466 | } | 6427 | } |
| 6467 | 6428 | ||
| 6468 | 6429 | ||
| @@ -6623,7 +6584,7 @@ static void | |||
| 6623 | suggest_asking_for_help () | 6584 | suggest_asking_for_help () |
| 6624 | { | 6585 | { |
| 6625 | fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", | 6586 | fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", |
| 6626 | progname, LONG_OPTIONS ? "--help" : "-h"); | 6587 | progname, NO_LONG_OPTIONS ? "-h" : "--help"); |
| 6627 | exit (EXIT_FAILURE); | 6588 | exit (EXIT_FAILURE); |
| 6628 | } | 6589 | } |
| 6629 | 6590 | ||