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: Fri, 21 Jun 2002 08:36:12 -0400

Index: emacs/lib-src/etags.c
diff -c emacs/lib-src/etags.c:3.26 emacs/lib-src/etags.c:3.27
*** emacs/lib-src/etags.c:3.26  Thu Jun 20 08:20:15 2002
--- emacs/lib-src/etags.c       Fri Jun 21 08:36:12 2002
***************
*** 35,41 ****
   *
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.29";
  
  #define       TRUE    1
  #define       FALSE   0
--- 35,41 ----
   *
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.32";
  
  #define       TRUE    1
  #define       FALSE   0
***************
*** 353,359 ****
  static void readline __P((linebuffer *, FILE *));
  static long readline_internal __P((linebuffer *, FILE *));
  static bool nocase_tail __P((char *));
! static char *get_tag __P((char *));
  
  #ifdef ETAGS_REGEXPS
  static void analyse_regex __P((char *));
--- 353,359 ----
  static void readline __P((linebuffer *, FILE *));
  static long readline_internal __P((linebuffer *, FILE *));
  static bool nocase_tail __P((char *));
! static void get_tag __P((char *, char **));
  
  #ifdef ETAGS_REGEXPS
  static void analyse_regex __P((char *));
***************
*** 1776,1837 ****
  }
  
  
- /* Record a tag. */
- static void
- pfnote (name, is_func, linestart, linelen, lno, cno)
-      char *name;              /* tag name, or NULL if unnamed */
-      bool is_func;            /* tag is a function */
-      char *linestart;         /* start of the line where tag is */
-      int linelen;             /* length of the line where tag is */
-      int lno;                 /* line number */
-      long cno;                        /* character number */
- {
-   register node *np;
- 
-   if (CTAGS && name == NULL)
-     return;
- 
-   np = xnew (1, node);
- 
-   /* If ctags mode, change name "main" to M<thisfilename>. */
-   if (CTAGS && !cxref_style && streq (name, "main"))
-     {
-       register char *fp = etags_strrchr (curfdp->taggedfname, '/');
-       np->name = concat ("M", fp == NULL ? curfdp->taggedfname : fp + 1, "");
-       fp = etags_strrchr (np->name, '.');
-       if (fp != NULL && fp[1] != '\0' && fp[2] == '\0')
-       fp[0] = '\0';
-     }
-   else
-     np->name = name;
-   np->valid = TRUE;
-   np->been_warned = FALSE;
-   np->fdp = curfdp;
-   np->is_func = is_func;
-   np->lno = lno;
-   if (np->fdp->usecharno)
-     /* Our char numbers are 0-base, because of C language tradition?
-        ctags compatibility?  old versions compatibility?   I don't know.
-        Anyway, since emacs's are 1-base we expect etags.el to take care
-        of the difference.  If we wanted to have 1-based numbers, we would
-        uncomment the +1 below. */
-     np->cno = cno /* + 1 */ ;
-   else
-     np->cno = invalidcharno;
-   np->left = np->right = NULL;
-   if (CTAGS && !cxref_style)
-     {
-       if (strlen (linestart) < 50)
-       np->pat = concat (linestart, "$", "");
-       else
-       np->pat = savenstr (linestart, 50);
-     }
-   else
-     np->pat = savenstr (linestart, linelen);
- 
-   add_node (np, &nodehead);
- }
- 
  /*
   * Check whether an implicitly named tag should be created,
   * then call `pfnote'.
--- 1776,1781 ----
***************
*** 1839,1844 ****
--- 1783,1789 ----
   *
   * TAGS format specification
   * Idea by Sam Kendall <address@hidden> (1997)
+  * The following is explained in some more detail in etc/ETAGS.EBNF.
   *
   * make_tag creates tags with "implicit tag names" (unnamed tags)
   * if the following are all true, assuming NONAM=" \f\t\n\r()=,;":
***************
*** 1866,1872 ****
  {
    bool named = TRUE;
  
!   if (!CTAGS)
      {
        int i;
        register char *cp = name;
--- 1811,1817 ----
  {
    bool named = TRUE;
  
!   if (!CTAGS && name != NULL && namelen > 0)
      {
        int i;
        register char *cp = name;
***************
*** 1894,1899 ****
--- 1839,1900 ----
    pfnote (name, is_func, linestart, linelen, lno, cno);
  }
  
+ /* Record a tag. */
+ static void
+ pfnote (name, is_func, linestart, linelen, lno, cno)
+      char *name;              /* tag name, or NULL if unnamed */
+      bool is_func;            /* tag is a function */
+      char *linestart;         /* start of the line where tag is */
+      int linelen;             /* length of the line where tag is */
+      int lno;                 /* line number */
+      long cno;                        /* character number */
+ {
+   register node *np;
+ 
+   if (CTAGS && name == NULL)
+     return;
+ 
+   np = xnew (1, node);
+ 
+   /* If ctags mode, change name "main" to M<thisfilename>. */
+   if (CTAGS && !cxref_style && streq (name, "main"))
+     {
+       register char *fp = etags_strrchr (curfdp->taggedfname, '/');
+       np->name = concat ("M", fp == NULL ? curfdp->taggedfname : fp + 1, "");
+       fp = etags_strrchr (np->name, '.');
+       if (fp != NULL && fp[1] != '\0' && fp[2] == '\0')
+       fp[0] = '\0';
+     }
+   else
+     np->name = name;
+   np->valid = TRUE;
+   np->been_warned = FALSE;
+   np->fdp = curfdp;
+   np->is_func = is_func;
+   np->lno = lno;
+   if (np->fdp->usecharno)
+     /* Our char numbers are 0-base, because of C language tradition?
+        ctags compatibility?  old versions compatibility?   I don't know.
+        Anyway, since emacs's are 1-base we expect etags.el to take care
+        of the difference.  If we wanted to have 1-based numbers, we would
+        uncomment the +1 below. */
+     np->cno = cno /* + 1 */ ;
+   else
+     np->cno = invalidcharno;
+   np->left = np->right = NULL;
+   if (CTAGS && !cxref_style)
+     {
+       if (strlen (linestart) < 50)
+       np->pat = concat (linestart, "$", "");
+       else
+       np->pat = savenstr (linestart, 50);
+     }
+   else
+     np->pat = savenstr (linestart, linelen);
+ 
+   add_node (np, &nodehead);
+ }
+ 
  /*
   * free_tree ()
   *    recurse on left children, iterate on right children.
***************
*** 3898,3905 ****
      return;
    for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
      continue;
!   pfnote (savenstr (dbp, cp-dbp), TRUE,
!         lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
  }
  
  
--- 3899,3906 ----
      return;
    for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
      continue;
!   make_tag (dbp, cp-dbp, TRUE,
!           lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
  }
  
  
***************
*** 3966,3973 ****
            {
              dbp = skip_spaces (dbp);
              if (*dbp == '\0') /* assume un-named */
!               pfnote (savestr ("blockdata"), TRUE,
!                       lb.buffer, dbp - lb.buffer, lineno, linecharno);
              else
                F_getit (inf);  /* look for name */
            }
--- 3967,3974 ----
            {
              dbp = skip_spaces (dbp);
              if (*dbp == '\0') /* assume un-named */
!               make_tag ("blockdata", 9, TRUE,
!                         lb.buffer, dbp - lb.buffer, lineno, linecharno);
              else
                F_getit (inf);  /* look for name */
            }
***************
*** 4043,4049 ****
        *cp = '\0';
        name = concat (dbp, name_qualifier, "");
        *cp = c;
!       pfnote (name, TRUE, lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        if (c == '"')
        dbp = cp + 1;
        return;
--- 4044,4052 ----
        *cp = '\0';
        name = concat (dbp, name_qualifier, "");
        *cp = c;
!       make_tag (name, strlen (name), TRUE,
!               lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
!       free (name);
        if (c == '"')
        dbp = cp + 1;
        return;
***************
*** 4162,4172 ****
          while (ISALNUM (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
            cp++;
          if (*cp == ':' || iswhite (*cp))
!           {
!             /* Found end of label, so copy it and add it to the table. */
!             pfnote (savenstr(lb.buffer, cp-lb.buffer), TRUE,
                      lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
-           }
        }
      }
  }
--- 4165,4173 ----
          while (ISALNUM (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
            cp++;
          if (*cp == ':' || iswhite (*cp))
!           /* Found end of label, so copy it and add it to the table. */
!           make_tag (lb.buffer, cp - lb.buffer, TRUE,
                      lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
      }
  }
***************
*** 4194,4249 ****
        if (LOOKING_AT (cp, "package"))
        {
          free (package);
!         package = get_tag (cp);
!         if (package == NULL)  /* can't parse package name */
!           package = savestr ("");
!         else
!           package = savestr(package); /* make a copy */
        }
        else if (LOOKING_AT (cp, "sub"))
        {
!         char *name, *fullname, *pos;
          char *sp = cp;
  
          while (!notinname (*cp))
            cp++;
          if (cp == sp)
!           continue;
!         name = savenstr (sp, cp-sp);
!         if ((pos = etags_strchr (name, ':')) != NULL && pos[1] == ':')
!           fullname = name;
          else
!           fullname = concat (package, "::", name);
!         pfnote (fullname, TRUE,
!                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
!         if (name != fullname)
!           free (name);
        }
!        else if (globals               /* only if tagging global vars is 
enabled */
!               && (LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local")))
        {
          /* After "my" or "local", but before any following paren or space. */
!         char *varname = NULL;
  
!         if (*cp == '$' || *cp == '@' || *cp == '%')
            {
!             char* varstart = ++cp;
!             while (ISALNUM (*cp) || *cp == '_')
                cp++;
!             varname = savenstr (varstart, cp-varstart);
            }
!         else
            {
              /* Should be examining a variable list at this point;
                 could insist on seeing an open parenthesis. */
              while (*cp != '\0' && *cp != ';' && *cp != '=' &&  *cp != ')')
                cp++;
            }
  
!         /* Perhaps I should back cp up one character, so the TAGS table
!            doesn't mention (and so depend upon) the following char. */
!         pfnote (varname, FALSE,
!                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
      }
  }
--- 4195,4257 ----
        if (LOOKING_AT (cp, "package"))
        {
          free (package);
!         get_tag (cp, &package);
        }
        else if (LOOKING_AT (cp, "sub"))
        {
!         char *pos;
          char *sp = cp;
  
          while (!notinname (*cp))
            cp++;
          if (cp == sp)
!           continue;           /* nothing found */
!         if ((pos = etags_strchr (sp, ':')) != NULL
!             && pos < cp && pos[1] == ':')
!           /* The name is already qualified. */
!           make_tag (sp, cp - sp, TRUE,
!                     lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
          else
!           /* Qualify it. */
!           {
!             char savechar, *name;
! 
!             savechar = *cp;
!             *cp = '\0';
!             name = concat (package, "::", sp);
!             *cp = savechar;
!             make_tag (name, strlen(name), TRUE,
!                       lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
!             free (name);
!           }
        }
!        else if (globals)      /* only if we are tagging global vars */
        {
+         /* Skip a qualifier, if any. */
+         bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local");
          /* After "my" or "local", but before any following paren or space. */
!         char *varstart = cp;
  
!         if (qual              /* should this be removed?  If yes, how? */
!             && (*cp == '$' || *cp == '@' || *cp == '%'))
            {
!             varstart += 1;
!             do
                cp++;
!             while (ISALNUM (*cp) || *cp == '_');
            }
!         else if (qual)
            {
              /* Should be examining a variable list at this point;
                 could insist on seeing an open parenthesis. */
              while (*cp != '\0' && *cp != ';' && *cp != '=' &&  *cp != ')')
                cp++;
            }
+         else
+           continue;
  
!         make_tag (varstart, cp - varstart, FALSE,
!                   lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
      }
  }
***************
*** 4269,4276 ****
          char *name = cp;
          while (!notinname (*cp) && *cp != ':')
            cp++;
!         pfnote (savenstr (name, cp-name), TRUE,
!                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
      }
  }
--- 4277,4284 ----
          char *name = cp;
          while (!notinname (*cp) && *cp != ':')
            cp++;
!         make_tag (name, cp - name, TRUE,
!                   lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
      }
  }
***************
*** 4302,4309 ****
        {
          while (!notinname (*cp))
            cp++;
!         pfnote (savenstr (name, cp-name), TRUE,
!                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
          search_identifier = FALSE;
        }
        else if (LOOKING_AT (cp, "function"))
--- 4310,4317 ----
        {
          while (!notinname (*cp))
            cp++;
!         make_tag (name, cp - name, TRUE,
!                   lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
          search_identifier = FALSE;
        }
        else if (LOOKING_AT (cp, "function"))
***************
*** 4315,4322 ****
              name = cp;
              while (!notinname (*cp))
                cp++;
!             pfnote (savenstr (name, cp-name), TRUE,
!                     lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
            }
          else
            search_identifier = TRUE;
--- 4323,4330 ----
              name = cp;
              while (!notinname (*cp))
                cp++;
!             make_tag (name, cp - name, TRUE,
!                       lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
            }
          else
            search_identifier = TRUE;
***************
*** 4328,4335 ****
              name = cp;
              while (*cp != '\0' && !iswhite (*cp))
                cp++;
!             pfnote (savenstr (name, cp-name), FALSE,
!                     lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
            }
          else
            search_identifier = TRUE;
--- 4336,4343 ----
              name = cp;
              while (*cp != '\0' && !iswhite (*cp))
                cp++;
!             make_tag (name, cp - name, FALSE,
!                       lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
            }
          else
            search_identifier = TRUE;
***************
*** 4343,4350 ****
          name = cp;
          while (*cp != quote && *cp != '\0')
            cp++;
!         pfnote (savenstr (name, cp-name), FALSE,
!                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
        else if (members
               && LOOKING_AT (cp, "var")
--- 4351,4358 ----
          name = cp;
          while (*cp != quote && *cp != '\0')
            cp++;
!         make_tag (name, cp - name, FALSE,
!                   lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
        else if (members
               && LOOKING_AT (cp, "var")
***************
*** 4353,4360 ****
          name = cp;
          while (!notinname(*cp))
            cp++;
!         pfnote (savenstr (name, cp-name), FALSE,
!                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
      }
  }
--- 4361,4368 ----
          name = cp;
          while (!notinname(*cp))
            cp++;
!         make_tag (name, cp - name, FALSE,
!                   lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
      }
  }
***************
*** 4385,4392 ****
        for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++)
        continue;
        if (*ep++ == '.')
!       pfnote (savenstr (bp, ep-bp), TRUE,
!               lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
      }
  }
  
--- 4393,4400 ----
        for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++)
        continue;
        if (*ep++ == '.')
!       make_tag (bp, ep - bp, TRUE,
!                 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
      }
  }
  
***************
*** 4408,4415 ****
        while (*bp != '\0' && *bp != '=' && *bp != ':')
        bp++;
        if (*bp == ':' || (globals && *bp == '='))
!       pfnote (savenstr (lb.buffer, bp - lb.buffer), TRUE,
!               lb.buffer, bp - lb.buffer + 1, lineno, linecharno);
      }
  }
  
--- 4416,4423 ----
        while (*bp != '\0' && *bp != '=' && *bp != ':')
        bp++;
        if (*bp == ':' || (globals && *bp == '='))
!       make_tag (lb.buffer, bp - lb.buffer, TRUE,
!                 lb.buffer, bp - lb.buffer + 1, lineno, linecharno);
      }
  }
  
***************
*** 4429,4436 ****
  {
    linebuffer tline;           /* mostly copied from C_entries */
    long save_lcno;
!   int save_lineno, save_len;
!   char c, *cp, *namebuf;
  
    bool                                /* each of these flags is TRUE iff: */
      incomment,                        /* point is inside a comment */
--- 4437,4444 ----
  {
    linebuffer tline;           /* mostly copied from C_entries */
    long save_lcno;
!   int save_lineno, namelen, taglen;
!   char c, *name;
  
    bool                                /* each of these flags is TRUE iff: */
      incomment,                        /* point is inside a comment */
***************
*** 4444,4458 ****
                                   is a FORWARD/EXTERN to be ignored, or
                                   whether it is a real tag */
  
!   save_lcno = save_lineno = save_len = 0; /* keep compiler quiet */
!   namebuf = NULL;             /* keep compiler quiet */
    dbp = lb.buffer;
    *dbp = '\0';
    initbuffer (&tline);
  
    incomment = inquote = FALSE;
    found_tag = FALSE;          /* have a proc name; check if extern */
!   get_tagname = FALSE;                /* have found "procedure" keyword    */
    inparms = FALSE;            /* found '(' after "proc"            */
    verify_tag = FALSE;         /* check if "extern" is ahead        */
  
--- 4452,4466 ----
                                   is a FORWARD/EXTERN to be ignored, or
                                   whether it is a real tag */
  
!   save_lcno = save_lineno = namelen = taglen = 0; /* keep compiler quiet */
!   name = NULL;                        /* keep compiler quiet */
    dbp = lb.buffer;
    *dbp = '\0';
    initbuffer (&tline);
  
    incomment = inquote = FALSE;
    found_tag = FALSE;          /* have a proc name; check if extern */
!   get_tagname = FALSE;                /* found "procedure" keyword         */
    inparms = FALSE;            /* found '(' after "proc"            */
    verify_tag = FALSE;         /* check if "extern" is ahead        */
  
***************
*** 4521,4527 ****
          }
        if (found_tag && verify_tag && (*dbp != ' '))
        {
!         /* check if this is an "extern" declaration */
          if (*dbp == '\0')
            continue;
          if (lowcase (*dbp == 'e'))
--- 4529,4535 ----
          }
        if (found_tag && verify_tag && (*dbp != ' '))
        {
!         /* Check if this is an "extern" declaration. */
          if (*dbp == '\0')
            continue;
          if (lowcase (*dbp == 'e'))
***************
*** 4544,4580 ****
            {
              found_tag = FALSE;
              verify_tag = FALSE;
!             pfnote (namebuf, TRUE,
!                     tline.buffer, save_len, save_lineno, save_lcno);
              continue;
            }
        }
        if (get_tagname)                /* grab name of proc or fn */
        {
          if (*dbp == '\0')
            continue;
  
!         /* save all values for later tagging */
          linebuffer_setlen (&tline, lb.len);
          strcpy (tline.buffer, lb.buffer);
          save_lineno = lineno;
          save_lcno = linecharno;
  
-         /* grab block name */
-         for (cp = dbp + 1; *cp != '\0' && !endtoken (*cp); cp++)
-           continue;
-         namebuf = savenstr (dbp, cp-dbp);
          dbp = cp;             /* set dbp to e-o-token */
-         save_len = dbp - lb.buffer + 1;
          get_tagname = FALSE;
          found_tag = TRUE;
          continue;
  
!         /* and proceed to check for "extern" */
        }
        else if (!incomment && !inquote && !found_tag)
        {
!         /* check for proc/fn keywords */
          switch (lowcase (c))
            {
            case 'p':
--- 4552,4592 ----
            {
              found_tag = FALSE;
              verify_tag = FALSE;
!             make_tag (name, namelen, TRUE,
!                       tline.buffer, taglen, save_lineno, save_lcno);
              continue;
            }
        }
        if (get_tagname)                /* grab name of proc or fn */
        {
+         char *cp;
+ 
          if (*dbp == '\0')
            continue;
  
!         /* Find block name. */
!         for (cp = dbp + 1; *cp != '\0' && !endtoken (*cp); cp++)
!           continue;
! 
!         /* Save all values for later tagging. */
          linebuffer_setlen (&tline, lb.len);
          strcpy (tline.buffer, lb.buffer);
          save_lineno = lineno;
          save_lcno = linecharno;
+         name = tline.buffer + (dbp - lb.buffer);
+         namelen = cp - dbp;
+         taglen = cp - lb.buffer + 1;
  
          dbp = cp;             /* set dbp to e-o-token */
          get_tagname = FALSE;
          found_tag = TRUE;
          continue;
  
!         /* And proceed to check for "extern". */
        }
        else if (!incomment && !inquote && !found_tag)
        {
!         /* Check for proc/fn keywords. */
          switch (lowcase (c))
            {
            case 'p':
***************
*** 4587,4593 ****
              continue;
            }
        }
!     }                         /* while not eof */
  
    free (tline.buffer);
  }
--- 4599,4605 ----
              continue;
            }
        }
!     } /* while not eof */
  
    free (tline.buffer);
  }
***************
*** 4613,4619 ****
        /* Ok, then skip "(" before name in (defstruct (foo)) */
        dbp = skip_spaces (dbp);
    }
!   get_tag (dbp);
  }
  
  static void
--- 4625,4631 ----
        /* Ok, then skip "(" before name in (defstruct (foo)) */
        dbp = skip_spaces (dbp);
    }
!   get_tag (dbp, NULL);
  }
  
  static void
***************
*** 4677,4687 ****
               *ep != '\0' && *ep != ' ' && *ep != '{';
               ep++)
            continue;
!         pfnote (savenstr (bp, ep-bp), TRUE,
!                 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
        }
        else if (LOOKING_AT (bp, "defineps"))
!       get_tag (bp);
      }
  }
  
--- 4689,4699 ----
               *ep != '\0' && *ep != ' ' && *ep != '{';
               ep++)
            continue;
!         make_tag (bp, ep - bp, TRUE,
!                   lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
        }
        else if (LOOKING_AT (bp, "defineps"))
!       get_tag (bp, NULL);
      }
  }
  
***************
*** 4709,4718 ****
          /* Skip over open parens and white space */
          while (notinname (*bp))
            bp++;
!         get_tag (bp);
        }
        if (LOOKING_AT (bp, "(SET!") || LOOKING_AT (bp, "(set!"))
!       get_tag (bp);
      }
  }
  
--- 4721,4730 ----
          /* Skip over open parens and white space */
          while (notinname (*bp))
            bp++;
!         get_tag (bp, NULL);
        }
        if (LOOKING_AT (bp, "(SET!") || LOOKING_AT (bp, "(set!"))
!       get_tag (bp, NULL);
      }
  }
  
***************
*** 4774,4781 ****
            if (strneq (cp, key->buffer, key->len))
              {
                register char *p;
!               char *name;
!               int linelen;
                bool opgrp = FALSE;
  
                cp = skip_spaces (cp + key->len);
--- 4786,4792 ----
            if (strneq (cp, key->buffer, key->len))
              {
                register char *p;
!               int namelen, linelen;
                bool opgrp = FALSE;
  
                cp = skip_spaces (cp + key->len);
***************
*** 4789,4795 ****
                      *p != TEX_opgrp && *p != TEX_clgrp);
                     p++)
                  continue;
!               name = savenstr (cp, p-cp);
                linelen = lb.len;
                if (!opgrp || *p == TEX_clgrp)
                  {
--- 4800,4806 ----
                      *p != TEX_opgrp && *p != TEX_clgrp);
                     p++)
                  continue;
!               namelen = p - cp;
                linelen = lb.len;
                if (!opgrp || *p == TEX_clgrp)
                  {
***************
*** 4797,4803 ****
                      *p++;
                    linelen = p - lb.buffer + 1;
                  }
!               pfnote (name, TRUE, lb.buffer, linelen, lineno, linecharno);
                goto tex_next_line; /* We only tag a line once */
              }
        }
--- 4808,4815 ----
                      *p++;
                    linelen = p - lb.buffer + 1;
                  }
!               make_tag (cp, namelen, TRUE,
!                         lb.buffer, linelen, lineno, linecharno);
                goto tex_next_line; /* We only tag a line once */
              }
        }
***************
*** 4907,4914 ****
        start = cp;
        while (*cp != '\0' && *cp != ',')
          cp++;
!       pfnote (savenstr (start, cp - start), TRUE,
!               lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
  }
  
--- 4919,4926 ----
        start = cp;
        while (*cp != '\0' && *cp != ',')
          cp++;
!       make_tag (start, cp - start, TRUE,
!                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
  }
  
***************
*** 5011,5017 ****
          || len != strlen (last)
          || !strneq (s, last, len)))
        {
!         pfnote (savenstr (s, len), TRUE, s, pos, lineno, linecharno);
          return len;
        }
    else
--- 5023,5029 ----
          || len != strlen (last)
          || !strneq (s, last, len)))
        {
!         make_tag (s, len, TRUE, s, pos, lineno, linecharno);
          return len;
        }
    else
***************
*** 5165,5171 ****
          || len != (int)strlen (last)
          || !strneq (s, last, len)))
        {
!         pfnote (savenstr (s, len), TRUE, s, pos, lineno, linecharno);
          return len;
        }
  
--- 5177,5183 ----
          || len != (int)strlen (last)
          || !strneq (s, last, len)))
        {
!         make_tag (s, len, TRUE, s, pos, lineno, linecharno);
          return len;
        }
  
***************
*** 5193,5200 ****
      {
        int len = erlang_atom (skip_spaces (cp));
        if (len > 0)
!       pfnote (savenstr (cp, len), TRUE,
!               s, cp + len - s, lineno, linecharno);
      }
    return;
  }
--- 5205,5211 ----
      {
        int len = erlang_atom (skip_spaces (cp));
        if (len > 0)
!       make_tag (cp, len, TRUE, s, cp + len - s, lineno, linecharno);
      }
    return;
  }
***************
*** 5610,5616 ****
                  lineno++, linecharno = charno;
              if (pp->name_pattern[0] != '\0')
                {
!                 /* Make a named tag. */
                  char *name = substitute (buffer,
                                           pp->name_pattern, &pp->regs);
                  if (name != NULL)
--- 5621,5630 ----
                  lineno++, linecharno = charno;
              if (pp->name_pattern[0] != '\0')
                {
!                 /* Make a named tag.
!                    Do not use make_tag here, as it would make the name
!                    implicit if possible, while we want to respect the user's
!                    request to create an explicit tag name. */
                  char *name = substitute (buffer,
                                           pp->name_pattern, &pp->regs);
                  if (name != NULL)
***************
*** 5648,5668 ****
    return FALSE;
  }
  
! static char *
! get_tag (bp)
       register char *bp;
  {
!   register char *cp, *name;
  
!   if (*bp == '\0')
!     return NULL;
!   /* Go till you get to white space or a syntactic break */
!   for (cp = bp + 1; !notinname (*cp); cp++)
!     continue;
!   name = savenstr (bp, cp-bp);
!   pfnote (name, TRUE,
!         lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
!   return name;
  }
  
  /* Initialize a linebuffer for use */
--- 5662,5685 ----
    return FALSE;
  }
  
! static void
! get_tag (bp, namepp)
       register char *bp;
+      char **namepp;
  {
!   register char *cp = bp;
  
!   if (*bp != '\0')
!     {
!       /* Go till you get to white space or a syntactic break */
!       for (cp = bp + 1; !notinname (*cp); cp++)
!       continue;
!       make_tag (bp, cp - bp, TRUE,
!               lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
!     }
! 
!   if (namepp != NULL)
!     *namepp = savenstr (bp, cp - bp);
  }
  
  /* Initialize a linebuffer for use */
***************
*** 5943,5949 ****
              /* Match occurred.  Construct a tag. */
              if (pp->name_pattern[0] != '\0')
                {
!                 /* Make a named tag. */
                  char *name = substitute (lbp->buffer,
                                           pp->name_pattern, &pp->regs);
                  if (name != NULL)
--- 5960,5969 ----
              /* Match occurred.  Construct a tag. */
              if (pp->name_pattern[0] != '\0')
                {
!                 /* Make a named tag.
!                    Do not use make_tag here, as it would make the name
!                    implicit if possible, while we want to respect the user's
!                    request to create an explicit tag name. */
                  char *name = substitute (lbp->buffer,
                                           pp->name_pattern, &pp->regs);
                  if (name != NULL)



reply via email to

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