emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lib-src/etags.c


From: Francesco Potortì
Subject: [Emacs-diffs] Changes to emacs/lib-src/etags.c
Date: Thu, 29 Aug 2002 10:42:56 -0400

Index: emacs/lib-src/etags.c
diff -c emacs/lib-src/etags.c:3.28 emacs/lib-src/etags.c:3.29
*** emacs/lib-src/etags.c:3.28  Wed Aug 28 06:35:51 2002
--- emacs/lib-src/etags.c       Thu Aug 29 10:42:56 2002
***************
*** 35,41 ****
   *
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.42";
  
  #define       TRUE    1
  #define       FALSE   0
--- 35,41 ----
   *
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.46";
  
  #define       TRUE    1
  #define       FALSE   0
***************
*** 459,465 ****
  static bool no_warnings;      /* -w: suppress warnings */
  static bool cxref_style;      /* -x: create cxref style output */
  static bool cplusplus;                /* .[hc] means C++, not C */
! static bool noindentypedefs;  /* -I: ignore indentation in C */
  static bool packages_only;    /* --packages-only: in Ada, only tag packages*/
  
  #define STDIN 0x1001          /* returned by getopt_long on --parse-stdin */
--- 459,465 ----
  static bool no_warnings;      /* -w: suppress warnings */
  static bool cxref_style;      /* -x: create cxref style output */
  static bool cplusplus;                /* .[hc] means C++, not C */
! static bool ignoreindent;     /* -I: ignore indentation in C */
  static bool packages_only;    /* --packages-only: in Ada, only tag packages*/
  
  #define STDIN 0x1001          /* returned by getopt_long on --parse-stdin */
***************
*** 775,785 ****
        Do not create tag entries for global variables in some\n\
        languages.  This makes the tags file smaller.");
    puts ("--members\n\
!       Create tag entries for member variables in C and derived languages.");
  
  #ifdef ETAGS_REGEXPS
    puts ("-r REGEXP, --regex=REGEXP or address@hidden
!         Make a tag for each line matching the regular expression pattern\n\
        in the following files.  {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\
        files only.  REGEXFILE is a file containing one REGEXP per line.\n\
        REGEXP takes the form /TAGREGEXP/TAGNAME/MODS, where TAGNAME/ is\n\
--- 775,785 ----
        Do not create tag entries for global variables in some\n\
        languages.  This makes the tags file smaller.");
    puts ("--members\n\
!       Create tag entries for member variables in some languages.");
  
  #ifdef ETAGS_REGEXPS
    puts ("-r REGEXP, --regex=REGEXP or address@hidden
!         Make a tag for each line matching a regular expression pattern\n\
        in the following files.  {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\
        files only.  REGEXFILE is a file containing one REGEXP per line.\n\
        REGEXP takes the form /TAGREGEXP/TAGNAME/MODS, where TAGNAME/ is\n\
***************
*** 789,803 ****
          --regex=\"/proc[ \\t]+\\([^ \\t]+\\)/\\1/.\".\n\
        MODS are optional one-letter modifiers: `i' means to ignore case,\n\
        `m' means to allow multi-line matches, `s' implies `m' and\n\
!       causes dot to match the newline character as well.");
    puts ("-R, --no-regex\n\
          Don't create tags from regexps for the following files.");
  #endif /* ETAGS_REGEXPS */
    puts ("-I, --ignore-indentation\n\
!         Don't rely on indentation quite as much as normal.  Currently,\n\
!         this means not to assume that a closing brace in the first\n\
!         column is the final brace of a function or structure\n\
!         definition in C and C++.");
    puts ("-o FILE, --output=FILE\n\
          Write the tags to FILE.");
    puts ("--parse-stdin=NAME\n\
--- 789,801 ----
          --regex=\"/proc[ \\t]+\\([^ \\t]+\\)/\\1/.\".\n\
        MODS are optional one-letter modifiers: `i' means to ignore case,\n\
        `m' means to allow multi-line matches, `s' implies `m' and\n\
!       causes dot to match any character, including newline.");
    puts ("-R, --no-regex\n\
          Don't create tags from regexps for the following files.");
  #endif /* ETAGS_REGEXPS */
    puts ("-I, --ignore-indentation\n\
!         In C and C++ do not assume that a closing brace in the first\n\
!         column is the final brace of a function or structure definition.");
    puts ("-o FILE, --output=FILE\n\
          Write the tags to FILE.");
    puts ("--parse-stdin=NAME\n\
***************
*** 1070,1076 ****
        break;
        case 'I':
        case 'S':               /* for backward compatibility */
!       noindentypedefs = TRUE;
        break;
        case 'l':
        {
--- 1068,1074 ----
        break;
        case 'I':
        case 'S':               /* for backward compatibility */
!       ignoreindent = TRUE;
        break;
        case 'l':
        {
***************
*** 2595,2601 ****
  } cstack;                     /* stack for nested declaration tags */
  /* Current struct nesting depth (namespace, class, struct, union, enum). */
  #define nestlev               (cstack.nl)
! /* After struct keyword or in struct body, not inside an nested function. */
  #define instruct      (structdef == snone && nestlev > 0                      
\
                         && cblev == cstack.cblev[nestlev-1] + 1)
  
--- 2593,2599 ----
  } cstack;                     /* stack for nested declaration tags */
  /* Current struct nesting depth (namespace, class, struct, union, enum). */
  #define nestlev               (cstack.nl)
! /* After struct keyword or in struct body, not inside a nested function. */
  #define instruct      (structdef == snone && nestlev > 0                      
\
                         && cblev == cstack.cblev[nestlev-1] + 1)
  
***************
*** 2988,2993 ****
--- 2986,2994 ----
  #define curlinepos (lbs[curndx].linepos)
  #define newlinepos (lbs[newndx].linepos)
  
+ #define cplpl ((c_ext & C_PLPL) == C_PLPL)
+ #define cjava ((c_ext & C_JAVA) == C_JAVA)
+ 
  #define CNL_SAVE_DEFINEDEF()                                          \
  do {                                                                  \
    curlinepos = charno;                                                        
\
***************
*** 3052,3058 ****
    int parlev;                 /* current parenthesis level */
    int typdefcblev;            /* cblev where a typedef struct body begun */
    bool incomm, inquote, inchar, quotednl, midtoken;
-   bool cplpl, cjava;
    bool yacc_rules;            /* in the rules part of a yacc file */
    struct tok savetoken;               /* token saved during preprocessor 
handling */
  
--- 3053,3058 ----
***************
*** 3079,3086 ****
    token.valid = savetoken.valid = FALSE;
    cblev = 0;
    parlev = 0;
-   cplpl = (c_ext & C_PLPL) == C_PLPL;
-   cjava = (c_ext & C_JAVA) == C_JAVA;
    if (cjava)
      { qualifier = "."; qlen = 1; }
    else
--- 3079,3084 ----
***************
*** 3395,3401 ****
                      fvdef = finlist;
                      continue;
                    case flistseen:
!                     make_C_tag (TRUE); /* a function */
                      fvdef = fignore;
                      break;
                    case fvnameseen:
--- 3393,3402 ----
                      fvdef = finlist;
                      continue;
                    case flistseen:
! #if 0
!                     if (!instruct || members)
! #endif
!                       make_C_tag (TRUE); /* a function */
                      fvdef = fignore;
                      break;
                    case fvnameseen:
***************
*** 3449,3455 ****
              break;
            }
          if (structdef == stagseen)
!           structdef = scolonseen;
          break;
        case ';':
          if (definedef != dnone)
--- 3450,3467 ----
              break;
            }
          if (structdef == stagseen)
!           {
!             structdef = scolonseen;
!             break;
!           }
! #if 0
!         if (cplpl && fvdef == flistseen)
!           {
!             make_C_tag (TRUE); /* a function */
!             fvdef = fignore;
!             break;
!           }
! #endif
          break;
        case ';':
          if (definedef != dnone)
***************
*** 3468,3474 ****
              switch (fvdef)
                {
                case fignore:
!                 if (typdef == tignore)
                    fvdef = fvnone;
                  break;
                case fvnameseen:
--- 3480,3486 ----
              switch (fvdef)
                {
                case fignore:
!                 if (typdef == tignore || cplpl)
                    fvdef = fvnone;
                  break;
                case fvnameseen:
***************
*** 3701,3707 ****
        case '}':
          if (definedef != dnone)
            break;
!         if (!noindentypedefs && lp == newlb.buffer + 1)
            {
              cblev = 0;        /* reset curly brace level if first column */
              parlev = 0;       /* also reset paren level, just in case... */
--- 3713,3719 ----
        case '}':
          if (definedef != dnone)
            break;
!         if (!ignoreindent && lp == newlb.buffer + 1)
            {
              cblev = 0;        /* reset curly brace level if first column */
              parlev = 0;       /* also reset paren level, just in case... */
***************
*** 4986,5029 ****
       FILE * inf;
  {
    bool getnext = FALSE;               /* next text outside of HTML tags is a 
tag */
!   bool ignoretag = FALSE;     /* skip to the end of the current HTML tag */
!   bool inanchor = FALSE;      /* inside an A HTML tag, looking for NAME= */
    char *end;
  
  
    linebuffer_setlen (&token_name, 0); /* no name in buffer */
  
    LOOP_ON_INPUT_LINES (inf, lb, dbp)
!     {
!       for (;;)                        /* loop on the same line */
! 
!       if (ignoretag)          /* skip HTML tag */
          {
            while (*dbp != '\0' && *dbp != '>')
              dbp++;
            if (*dbp == '>')
              {
                dbp += 1;
!               ignoretag = FALSE;
                continue;       /* look on the same line */
              }
            break;              /* go to next line */
          }
  
!       else if (inanchor)      /* look for "name=" */
          {
!           while (*dbp != '\0' && *dbp != '>' && lowcase (*dbp) != 'n')
              dbp++;
            if (*dbp == '\0')
              break;            /* go to next line */
            if (*dbp == '>')
              {
                dbp += 1;
!               inanchor = FALSE;
                continue;       /* look on the same line */
              }
!           dbp += 1;
!           if (LOOKING_AT_NOCASE (dbp, "ame="))
              {
                bool quoted = (dbp[0] == '"');
  
--- 4998,5042 ----
       FILE * inf;
  {
    bool getnext = FALSE;               /* next text outside of HTML tags is a 
tag */
!   bool skiptag = FALSE;               /* skip to the end of the current HTML 
tag */
!   bool intag = FALSE;         /* inside an html tag, looking for ID= */
!   bool inanchor = FALSE;      /* when INTAG, is an anchor, look for NAME= */
    char *end;
  
  
    linebuffer_setlen (&token_name, 0); /* no name in buffer */
  
    LOOP_ON_INPUT_LINES (inf, lb, dbp)
!     for (;;)                  /* loop on the same line */
!       {
!       if (skiptag)            /* skip HTML tag */
          {
            while (*dbp != '\0' && *dbp != '>')
              dbp++;
            if (*dbp == '>')
              {
                dbp += 1;
!               skiptag = FALSE;
                continue;       /* look on the same line */
              }
            break;              /* go to next line */
          }
  
!       else if (intag) /* look for "name=" or "id=" */
          {
!           while (*dbp != '\0' && *dbp != '>'
!                  && lowcase (*dbp) != 'n' && lowcase (*dbp) != 'i')
              dbp++;
            if (*dbp == '\0')
              break;            /* go to next line */
            if (*dbp == '>')
              {
                dbp += 1;
!               intag = FALSE;
                continue;       /* look on the same line */
              }
!           if ((inanchor && LOOKING_AT_NOCASE (dbp, "name="))
!               || LOOKING_AT_NOCASE (dbp, "id="))
              {
                bool quoted = (dbp[0] == '"');
  
***************
*** 5038,5048 ****
                token_name.buffer[end - dbp] = '\0';
  
                dbp = end;
!               inanchor = FALSE; /* we found what we looked for */
!               ignoretag = TRUE; /* skip to the end of the anchor */
                getnext = TRUE; /* then grab the text */
                continue;       /* look on the same line */
              }
          }
  
        else if (getnext)       /* grab next tokens and tag them */
--- 5051,5062 ----
                token_name.buffer[end - dbp] = '\0';
  
                dbp = end;
!               intag = FALSE;  /* we found what we looked for */
!               skiptag = TRUE; /* skip to the end of the tag */
                getnext = TRUE; /* then grab the text */
                continue;       /* look on the same line */
              }
+           dbp += 1;
          }
  
        else if (getnext)       /* grab next tokens and tag them */
***************
*** 5052,5061 ****
              break;            /* go to next line */
            if (*dbp == '<')
              {
!               if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]))
!                 inanchor = TRUE;
!               else
!                 ignoretag = TRUE;
                continue;       /* look on the same line */
              }
  
--- 5066,5073 ----
              break;            /* go to next line */
            if (*dbp == '<')
              {
!               intag = TRUE;
!               inanchor = (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]));
                continue;       /* look on the same line */
              }
  
***************
*** 5074,5092 ****
              dbp++;
            if (*dbp == '\0')
              break;            /* go to next line */
!           dbp += 1;
!           if (lowcase (dbp[0]) == 'a' && !intoken (dbp[1]))
!             inanchor = TRUE;
!           else if (LOOKING_AT_NOCASE (dbp, "title>")
!                    || LOOKING_AT_NOCASE (dbp, "h1>")
!                    || LOOKING_AT_NOCASE (dbp, "h2>")
!                    || LOOKING_AT_NOCASE (dbp, "h3>"))
              {
                getnext = TRUE;
                continue;       /* look on the same line */
              }
          }
!     }
  }
  
  
--- 5086,5109 ----
              dbp++;
            if (*dbp == '\0')
              break;            /* go to next line */
!           intag = TRUE;
!           if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]))
              {
+               inanchor = TRUE;
+               continue;       /* look on the same line */
+             }
+           else if (LOOKING_AT_NOCASE (dbp, "<title>")
+                    || LOOKING_AT_NOCASE (dbp, "<h1>")
+                    || LOOKING_AT_NOCASE (dbp, "<h2>")
+                    || LOOKING_AT_NOCASE (dbp, "<h3>"))
+             {
+               intag = FALSE;
                getnext = TRUE;
                continue;       /* look on the same line */
              }
+           dbp += 1;
          }
!       }
  }
  
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]