aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorFrancesco Potortì2002-08-29 14:42:56 +0000
committerFrancesco Potortì2002-08-29 14:42:56 +0000
commit3c04a71a2046fb1c547616e9f412c9aea05bd2d2 (patch)
tree5eca3fd4290f8c6df95bddd48b4984f343555dad /lib-src
parent09cd1a74974684e59b467421773177080dc8c7f5 (diff)
downloademacs-3c04a71a2046fb1c547616e9f412c9aea05bd2d2.tar.gz
emacs-3c04a71a2046fb1c547616e9f412c9aea05bd2d2.zip
(C_entries): Corrected a problem with const C++ funcs.
(ignoreindent): Renamed from noindentypedefs. (cjava, cplpl): They are now macros instead of local vars. (HTML_labels): Tag ID= also.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c105
1 files changed, 61 insertions, 44 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 2e3ac148379..4293ebd6fc8 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -35,7 +35,7 @@
35 * 35 *
36 */ 36 */
37 37
38char pot_etags_version[] = "@(#) pot revision number is 16.42"; 38char pot_etags_version[] = "@(#) pot revision number is 16.46";
39 39
40#define TRUE 1 40#define TRUE 1
41#define FALSE 0 41#define FALSE 0
@@ -459,7 +459,7 @@ static bool vgrind_style; /* -v: create vgrind style index output */
459static bool no_warnings; /* -w: suppress warnings */ 459static bool no_warnings; /* -w: suppress warnings */
460static bool cxref_style; /* -x: create cxref style output */ 460static bool cxref_style; /* -x: create cxref style output */
461static bool cplusplus; /* .[hc] means C++, not C */ 461static bool cplusplus; /* .[hc] means C++, not C */
462static bool noindentypedefs; /* -I: ignore indentation in C */ 462static bool ignoreindent; /* -I: ignore indentation in C */
463static bool packages_only; /* --packages-only: in Ada, only tag packages*/ 463static bool packages_only; /* --packages-only: in Ada, only tag packages*/
464 464
465#define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ 465#define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */
@@ -775,11 +775,11 @@ Relative ones are stored relative to the output file's directory.\n");
775 Do not create tag entries for global variables in some\n\ 775 Do not create tag entries for global variables in some\n\
776 languages. This makes the tags file smaller."); 776 languages. This makes the tags file smaller.");
777 puts ("--members\n\ 777 puts ("--members\n\
778 Create tag entries for member variables in C and derived languages."); 778 Create tag entries for member variables in some languages.");
779 779
780#ifdef ETAGS_REGEXPS 780#ifdef ETAGS_REGEXPS
781 puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\ 781 puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\
782 Make a tag for each line matching the regular expression pattern\n\ 782 Make a tag for each line matching a regular expression pattern\n\
783 in the following files. {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\ 783 in the following files. {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\
784 files only. REGEXFILE is a file containing one REGEXP per line.\n\ 784 files only. REGEXFILE is a file containing one REGEXP per line.\n\
785 REGEXP takes the form /TAGREGEXP/TAGNAME/MODS, where TAGNAME/ is\n\ 785 REGEXP takes the form /TAGREGEXP/TAGNAME/MODS, where TAGNAME/ is\n\
@@ -789,15 +789,13 @@ Relative ones are stored relative to the output file's directory.\n");
789 --regex=\"/proc[ \\t]+\\([^ \\t]+\\)/\\1/.\".\n\ 789 --regex=\"/proc[ \\t]+\\([^ \\t]+\\)/\\1/.\".\n\
790 MODS are optional one-letter modifiers: `i' means to ignore case,\n\ 790 MODS are optional one-letter modifiers: `i' means to ignore case,\n\
791 `m' means to allow multi-line matches, `s' implies `m' and\n\ 791 `m' means to allow multi-line matches, `s' implies `m' and\n\
792 causes dot to match the newline character as well."); 792 causes dot to match any character, including newline.");
793 puts ("-R, --no-regex\n\ 793 puts ("-R, --no-regex\n\
794 Don't create tags from regexps for the following files."); 794 Don't create tags from regexps for the following files.");
795#endif /* ETAGS_REGEXPS */ 795#endif /* ETAGS_REGEXPS */
796 puts ("-I, --ignore-indentation\n\ 796 puts ("-I, --ignore-indentation\n\
797 Don't rely on indentation quite as much as normal. Currently,\n\ 797 In C and C++ do not assume that a closing brace in the first\n\
798 this means not to assume that a closing brace in the first\n\ 798 column is the final brace of a function or structure definition.");
799 column is the final brace of a function or structure\n\
800 definition in C and C++.");
801 puts ("-o FILE, --output=FILE\n\ 799 puts ("-o FILE, --output=FILE\n\
802 Write the tags to FILE."); 800 Write the tags to FILE.");
803 puts ("--parse-stdin=NAME\n\ 801 puts ("--parse-stdin=NAME\n\
@@ -1070,7 +1068,7 @@ main (argc, argv)
1070 break; 1068 break;
1071 case 'I': 1069 case 'I':
1072 case 'S': /* for backward compatibility */ 1070 case 'S': /* for backward compatibility */
1073 noindentypedefs = TRUE; 1071 ignoreindent = TRUE;
1074 break; 1072 break;
1075 case 'l': 1073 case 'l':
1076 { 1074 {
@@ -2595,7 +2593,7 @@ static struct {
2595} cstack; /* stack for nested declaration tags */ 2593} cstack; /* stack for nested declaration tags */
2596/* Current struct nesting depth (namespace, class, struct, union, enum). */ 2594/* Current struct nesting depth (namespace, class, struct, union, enum). */
2597#define nestlev (cstack.nl) 2595#define nestlev (cstack.nl)
2598/* After struct keyword or in struct body, not inside an nested function. */ 2596/* After struct keyword or in struct body, not inside a nested function. */
2599#define instruct (structdef == snone && nestlev > 0 \ 2597#define instruct (structdef == snone && nestlev > 0 \
2600 && cblev == cstack.cblev[nestlev-1] + 1) 2598 && cblev == cstack.cblev[nestlev-1] + 1)
2601 2599
@@ -2988,6 +2986,9 @@ static struct
2988#define curlinepos (lbs[curndx].linepos) 2986#define curlinepos (lbs[curndx].linepos)
2989#define newlinepos (lbs[newndx].linepos) 2987#define newlinepos (lbs[newndx].linepos)
2990 2988
2989#define cplpl ((c_ext & C_PLPL) == C_PLPL)
2990#define cjava ((c_ext & C_JAVA) == C_JAVA)
2991
2991#define CNL_SAVE_DEFINEDEF() \ 2992#define CNL_SAVE_DEFINEDEF() \
2992do { \ 2993do { \
2993 curlinepos = charno; \ 2994 curlinepos = charno; \
@@ -3052,7 +3053,6 @@ C_entries (c_ext, inf)
3052 int parlev; /* current parenthesis level */ 3053 int parlev; /* current parenthesis level */
3053 int typdefcblev; /* cblev where a typedef struct body begun */ 3054 int typdefcblev; /* cblev where a typedef struct body begun */
3054 bool incomm, inquote, inchar, quotednl, midtoken; 3055 bool incomm, inquote, inchar, quotednl, midtoken;
3055 bool cplpl, cjava;
3056 bool yacc_rules; /* in the rules part of a yacc file */ 3056 bool yacc_rules; /* in the rules part of a yacc file */
3057 struct tok savetoken; /* token saved during preprocessor handling */ 3057 struct tok savetoken; /* token saved during preprocessor handling */
3058 3058
@@ -3079,8 +3079,6 @@ C_entries (c_ext, inf)
3079 token.valid = savetoken.valid = FALSE; 3079 token.valid = savetoken.valid = FALSE;
3080 cblev = 0; 3080 cblev = 0;
3081 parlev = 0; 3081 parlev = 0;
3082 cplpl = (c_ext & C_PLPL) == C_PLPL;
3083 cjava = (c_ext & C_JAVA) == C_JAVA;
3084 if (cjava) 3082 if (cjava)
3085 { qualifier = "."; qlen = 1; } 3083 { qualifier = "."; qlen = 1; }
3086 else 3084 else
@@ -3395,7 +3393,10 @@ C_entries (c_ext, inf)
3395 fvdef = finlist; 3393 fvdef = finlist;
3396 continue; 3394 continue;
3397 case flistseen: 3395 case flistseen:
3398 make_C_tag (TRUE); /* a function */ 3396#if 0
3397 if (!instruct || members)
3398#endif
3399 make_C_tag (TRUE); /* a function */
3399 fvdef = fignore; 3400 fvdef = fignore;
3400 break; 3401 break;
3401 case fvnameseen: 3402 case fvnameseen:
@@ -3449,7 +3450,18 @@ C_entries (c_ext, inf)
3449 break; 3450 break;
3450 } 3451 }
3451 if (structdef == stagseen) 3452 if (structdef == stagseen)
3452 structdef = scolonseen; 3453 {
3454 structdef = scolonseen;
3455 break;
3456 }
3457#if 0
3458 if (cplpl && fvdef == flistseen)
3459 {
3460 make_C_tag (TRUE); /* a function */
3461 fvdef = fignore;
3462 break;
3463 }
3464#endif
3453 break; 3465 break;
3454 case ';': 3466 case ';':
3455 if (definedef != dnone) 3467 if (definedef != dnone)
@@ -3468,7 +3480,7 @@ C_entries (c_ext, inf)
3468 switch (fvdef) 3480 switch (fvdef)
3469 { 3481 {
3470 case fignore: 3482 case fignore:
3471 if (typdef == tignore) 3483 if (typdef == tignore || cplpl)
3472 fvdef = fvnone; 3484 fvdef = fvnone;
3473 break; 3485 break;
3474 case fvnameseen: 3486 case fvnameseen:
@@ -3701,7 +3713,7 @@ C_entries (c_ext, inf)
3701 case '}': 3713 case '}':
3702 if (definedef != dnone) 3714 if (definedef != dnone)
3703 break; 3715 break;
3704 if (!noindentypedefs && lp == newlb.buffer + 1) 3716 if (!ignoreindent && lp == newlb.buffer + 1)
3705 { 3717 {
3706 cblev = 0; /* reset curly brace level if first column */ 3718 cblev = 0; /* reset curly brace level if first column */
3707 parlev = 0; /* also reset paren level, just in case... */ 3719 parlev = 0; /* also reset paren level, just in case... */
@@ -4986,44 +4998,45 @@ HTML_labels (inf)
4986 FILE * inf; 4998 FILE * inf;
4987{ 4999{
4988 bool getnext = FALSE; /* next text outside of HTML tags is a tag */ 5000 bool getnext = FALSE; /* next text outside of HTML tags is a tag */
4989 bool ignoretag = FALSE; /* skip to the end of the current HTML tag */ 5001 bool skiptag = FALSE; /* skip to the end of the current HTML tag */
4990 bool inanchor = FALSE; /* inside an A HTML tag, looking for NAME= */ 5002 bool intag = FALSE; /* inside an html tag, looking for ID= */
5003 bool inanchor = FALSE; /* when INTAG, is an anchor, look for NAME= */
4991 char *end; 5004 char *end;
4992 5005
4993 5006
4994 linebuffer_setlen (&token_name, 0); /* no name in buffer */ 5007 linebuffer_setlen (&token_name, 0); /* no name in buffer */
4995 5008
4996 LOOP_ON_INPUT_LINES (inf, lb, dbp) 5009 LOOP_ON_INPUT_LINES (inf, lb, dbp)
4997 { 5010 for (;;) /* loop on the same line */
4998 for (;;) /* loop on the same line */ 5011 {
4999 5012 if (skiptag) /* skip HTML tag */
5000 if (ignoretag) /* skip HTML tag */
5001 { 5013 {
5002 while (*dbp != '\0' && *dbp != '>') 5014 while (*dbp != '\0' && *dbp != '>')
5003 dbp++; 5015 dbp++;
5004 if (*dbp == '>') 5016 if (*dbp == '>')
5005 { 5017 {
5006 dbp += 1; 5018 dbp += 1;
5007 ignoretag = FALSE; 5019 skiptag = FALSE;
5008 continue; /* look on the same line */ 5020 continue; /* look on the same line */
5009 } 5021 }
5010 break; /* go to next line */ 5022 break; /* go to next line */
5011 } 5023 }
5012 5024
5013 else if (inanchor) /* look for "name=" */ 5025 else if (intag) /* look for "name=" or "id=" */
5014 { 5026 {
5015 while (*dbp != '\0' && *dbp != '>' && lowcase (*dbp) != 'n') 5027 while (*dbp != '\0' && *dbp != '>'
5028 && lowcase (*dbp) != 'n' && lowcase (*dbp) != 'i')
5016 dbp++; 5029 dbp++;
5017 if (*dbp == '\0') 5030 if (*dbp == '\0')
5018 break; /* go to next line */ 5031 break; /* go to next line */
5019 if (*dbp == '>') 5032 if (*dbp == '>')
5020 { 5033 {
5021 dbp += 1; 5034 dbp += 1;
5022 inanchor = FALSE; 5035 intag = FALSE;
5023 continue; /* look on the same line */ 5036 continue; /* look on the same line */
5024 } 5037 }
5025 dbp += 1; 5038 if ((inanchor && LOOKING_AT_NOCASE (dbp, "name="))
5026 if (LOOKING_AT_NOCASE (dbp, "ame=")) 5039 || LOOKING_AT_NOCASE (dbp, "id="))
5027 { 5040 {
5028 bool quoted = (dbp[0] == '"'); 5041 bool quoted = (dbp[0] == '"');
5029 5042
@@ -5038,11 +5051,12 @@ HTML_labels (inf)
5038 token_name.buffer[end - dbp] = '\0'; 5051 token_name.buffer[end - dbp] = '\0';
5039 5052
5040 dbp = end; 5053 dbp = end;
5041 inanchor = FALSE; /* we found what we looked for */ 5054 intag = FALSE; /* we found what we looked for */
5042 ignoretag = TRUE; /* skip to the end of the anchor */ 5055 skiptag = TRUE; /* skip to the end of the tag */
5043 getnext = TRUE; /* then grab the text */ 5056 getnext = TRUE; /* then grab the text */
5044 continue; /* look on the same line */ 5057 continue; /* look on the same line */
5045 } 5058 }
5059 dbp += 1;
5046 } 5060 }
5047 5061
5048 else if (getnext) /* grab next tokens and tag them */ 5062 else if (getnext) /* grab next tokens and tag them */
@@ -5052,10 +5066,8 @@ HTML_labels (inf)
5052 break; /* go to next line */ 5066 break; /* go to next line */
5053 if (*dbp == '<') 5067 if (*dbp == '<')
5054 { 5068 {
5055 if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2])) 5069 intag = TRUE;
5056 inanchor = TRUE; 5070 inanchor = (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]));
5057 else
5058 ignoretag = TRUE;
5059 continue; /* look on the same line */ 5071 continue; /* look on the same line */
5060 } 5072 }
5061 5073
@@ -5074,19 +5086,24 @@ HTML_labels (inf)
5074 dbp++; 5086 dbp++;
5075 if (*dbp == '\0') 5087 if (*dbp == '\0')
5076 break; /* go to next line */ 5088 break; /* go to next line */
5077 dbp += 1; 5089 intag = TRUE;
5078 if (lowcase (dbp[0]) == 'a' && !intoken (dbp[1])) 5090 if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]))
5079 inanchor = TRUE;
5080 else if (LOOKING_AT_NOCASE (dbp, "title>")
5081 || LOOKING_AT_NOCASE (dbp, "h1>")
5082 || LOOKING_AT_NOCASE (dbp, "h2>")
5083 || LOOKING_AT_NOCASE (dbp, "h3>"))
5084 { 5091 {
5092 inanchor = TRUE;
5093 continue; /* look on the same line */
5094 }
5095 else if (LOOKING_AT_NOCASE (dbp, "<title>")
5096 || LOOKING_AT_NOCASE (dbp, "<h1>")
5097 || LOOKING_AT_NOCASE (dbp, "<h2>")
5098 || LOOKING_AT_NOCASE (dbp, "<h3>"))
5099 {
5100 intag = FALSE;
5085 getnext = TRUE; 5101 getnext = TRUE;
5086 continue; /* look on the same line */ 5102 continue; /* look on the same line */
5087 } 5103 }
5104 dbp += 1;
5088 } 5105 }
5089 } 5106 }
5090} 5107}
5091 5108
5092 5109