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, 30 Aug 2002 12:38:58 -0400

Index: emacs/lib-src/etags.c
diff -c emacs/lib-src/etags.c:3.29 emacs/lib-src/etags.c:3.30
*** emacs/lib-src/etags.c:3.29  Thu Aug 29 10:42:56 2002
--- emacs/lib-src/etags.c       Fri Aug 30 12:38:58 2002
***************
*** 35,41 ****
   *
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.46";
  
  #define       TRUE    1
  #define       FALSE   0
--- 35,41 ----
   *
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.54";
  
  #define       TRUE    1
  #define       FALSE   0
***************
*** 1765,1776 ****
          {
            fdesc *badfdp = *fdpp;
  
!           if (DEBUG)
!             fprintf (stderr,
!                      "Removing references to \"%s\" obtained from \"%s\"\n",
!                      badfdp->taggedfname, badfdp->infname);
! 
!           /* Delete the tags referring to badfdp. */
            invalidate_nodes (badfdp, &nodehead);
  
            *fdpp = badfdp->next; /* remove the bad description from the list */
--- 1765,1772 ----
          {
            fdesc *badfdp = *fdpp;
  
!           /* Delete the tags referring to badfdp->taggedfname
!              that were obtained from badfdp->infname. */
            invalidate_nodes (badfdp, &nodehead);
  
            *fdpp = badfdp->next; /* remove the bad description from the list */
***************
*** 2568,2580 ****
   */
  static struct tok
  {
!   bool valid;
!   bool named;
!   int offset;
!   int length;
!   int lineno;
!   long linepos;
!   char *line;
  } token;                      /* latest token read */
  
  /*
--- 2564,2584 ----
   */
  static struct tok
  {
!   char *line;                 /* string containing the token */
!   int offset;                 /* where the token starts in LINE */
!   int length;                 /* token length */
!   /*
!     The previous members can be used to pass strings around for generic
!     purposes.  The following ones specifically refer to creating tags.  In 
this
!     case the token contained here is the pattern that will be used to create a
!     tag.
!   */
!   bool valid;                 /* do not create a tag; the token should be
!                                  invalidated whenever a state machine is
!                                  reset prematurely */
!   bool named;                 /* create a named tag */
!   int lineno;                 /* source line number of tag */
!   long linepos;                       /* source char number of tag */
  } token;                      /* latest token read */
  
  /*
***************
*** 2811,2818 ****
        return FALSE;
      case st_C_template:
      case st_C_class:
!       if (cblev == 0
!         && (*c_extp & C_AUTO) /* automatic detection of C++ language */
          && definedef == dnone && structdef == snone
          && typdef == tnone && fvdef == fvnone)
        *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
--- 2815,2822 ----
        return FALSE;
      case st_C_template:
      case st_C_class:
!       if ((*c_extp & C_AUTO)  /* automatic detection of C++ language */
!         && cblev == 0
          && definedef == dnone && structdef == snone
          && typdef == tnone && fvdef == fvnone)
        *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
***************
*** 2917,2924 ****
        fvextern = TRUE;
        /* FALLTHRU */
      case st_C_typespec:
!       if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
!       fvdef = fvnone;         /* should be useless */
        return FALSE;
      case st_C_ignore:
        fvextern = FALSE;
--- 2921,2936 ----
        fvextern = TRUE;
        /* FALLTHRU */
      case st_C_typespec:
!       switch  (fvdef)
!       {
!       case finlist:
!       case flistseen:
!       case fignore:
!       case vignore:
!         break;
!       default:
!         fvdef = fvnone;
!       }
        return FALSE;
      case st_C_ignore:
        fvextern = FALSE;
***************
*** 2948,2955 ****
              fvdef = vignore;
              return FALSE;
            }
!         if ((*c_extp & C_PLPL) && strneq (str+len-10, "::operator", 10))
            {
              fvdef = foperator;
              *is_func_or_var = TRUE;
              return TRUE;
--- 2960,2969 ----
              fvdef = vignore;
              return FALSE;
            }
!         if (strneq (str+len-10, "::operator", 10))
            {
+             if (*c_extp & C_AUTO) /* automatic detection of C++ */
+               *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
              fvdef = foperator;
              *is_func_or_var = TRUE;
              return TRUE;
***************
*** 2986,2992 ****
  #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()                                          \
--- 3000,3007 ----
  #define curlinepos (lbs[curndx].linepos)
  #define newlinepos (lbs[newndx].linepos)
  
! #define plainc ((c_ext & C_EXT) == C_PLAIN)
! #define cplpl (c_ext & C_PLPL)
  #define cjava ((c_ext & C_JAVA) == C_JAVA)
  
  #define CNL_SAVE_DEFINEDEF()                                          \
***************
*** 3019,3031 ****
    if (!DEBUG && !token.valid)
      return;
  
!   if (!token.valid)           /* this case is optimised away if !DEBUG */
!     make_tag (concat (token_name.buffer, "##invalid token##", ""),
!             token_name.len + 17, isfun, token.line,
!             token.offset+token.length+1, token.lineno, token.linepos);
!   else
      make_tag (token_name.buffer, token_name.len, isfun, token.line,
              token.offset+token.length+1, token.lineno, token.linepos);
  
    token.valid = FALSE;
  }
--- 3034,3046 ----
    if (!DEBUG && !token.valid)
      return;
  
!   if (token.valid)
      make_tag (token_name.buffer, token_name.len, isfun, token.line,
              token.offset+token.length+1, token.lineno, token.linepos);
+   else                                /* this case is optimised away if 
!DEBUG */
+     make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""),
+             token_name.len + 17, isfun, token.line,
+             token.offset+token.length+1, token.lineno, token.linepos);
  
    token.valid = FALSE;
  }
***************
*** 3244,3256 ****
            {
              if (endtoken (c))
                {
!                 if (c == ':' && cplpl && *lp == ':' && begtoken (lp[1]))
                    {
!                     /*
!                      * This handles :: in the middle, but not at the
!                      * beginning of an identifier.  Also, space-separated
!                      * :: is not recognised.
!                      */
                      lp += 2;
                      toklen += 2;
                      c = lp[-1];
--- 3259,3271 ----
            {
              if (endtoken (c))
                {
!                 if (c == ':' && *lp == ':' && begtoken (lp[1]))
!                   /* This handles :: in the middle,
!                      but not at the beginning of an identifier.
!                      Also, space-separated :: is not recognised. */
                    {
!                     if (c_ext & C_AUTO) /* automatic detection of C++ */
!                       c_ext = (c_ext | C_PLPL) & ~C_AUTO;
                      lp += 2;
                      toklen += 2;
                      c = lp[-1];
***************
*** 3277,3283 ****
                              toklen += lp - oldlp;
                            }
                          token.named = FALSE;
!                         if ((c_ext & C_EXT)   /* not pure C */
                              && nestlev > 0 && definedef == dnone)
                            /* in struct body */
                            {
--- 3292,3298 ----
                              toklen += lp - oldlp;
                            }
                          token.named = FALSE;
!                         if (!plainc
                              && nestlev > 0 && definedef == dnone)
                            /* in struct body */
                            {
***************
*** 3393,3403 ****
                      fvdef = finlist;
                      continue;
                    case flistseen:
! #if 0
!                     if (!instruct || members)
! #endif
!                       make_C_tag (TRUE); /* a function */
!                     fvdef = fignore;
                      break;
                    case fvnameseen:
                      fvdef = fvnone;
--- 3408,3418 ----
                      fvdef = finlist;
                      continue;
                    case flistseen:
!                     if (plainc || declarations)
!                       {
!                         make_C_tag (TRUE); /* a function */
!                         fvdef = fignore;
!                       }
                      break;
                    case fvnameseen:
                      fvdef = fvnone;
***************
*** 3454,3467 ****
              structdef = scolonseen;
              break;
            }
! #if 0
          if (cplpl && fvdef == flistseen)
            {
              make_C_tag (TRUE); /* a function */
              fvdef = fignore;
              break;
            }
- #endif
          break;
        case ';':
          if (definedef != dnone)
--- 3469,3481 ----
              structdef = scolonseen;
              break;
            }
!         /* Should be useless, but may be work as a safety net. */
          if (cplpl && fvdef == flistseen)
            {
              make_C_tag (TRUE); /* a function */
              fvdef = fignore;
              break;
            }
          break;
        case ';':
          if (definedef != dnone)
***************
*** 3492,3511 ****
                  token.valid = FALSE;
                  break;
                case flistseen:
!                 if ((declarations && typdef == tnone && !instruct)
!                     || (members && typdef != tignore && instruct))
                    make_C_tag (TRUE);  /* a function declaration */
                  /* FALLTHRU */
                default:
                  fvextern = FALSE;
                  fvdef = fvnone;
                  if (declarations
!                     && structdef == stagseen && (c_ext & C_PLPL))
                    make_C_tag (FALSE); /* forward declaration */
                  else
-                   /* The following instruction invalidates the token.
-                      Probably the token should be invalidated in all other
-                      cases where some state machine is reset prematurely. */
                    token.valid = FALSE;
                } /* switch (fvdef) */
              /* FALLTHRU */
--- 3506,3522 ----
                  token.valid = FALSE;
                  break;
                case flistseen:
!                 if (declarations
!                     && (typdef == tnone || (typdef != tignore && instruct)))
                    make_C_tag (TRUE);  /* a function declaration */
                  /* FALLTHRU */
                default:
                  fvextern = FALSE;
                  fvdef = fvnone;
                  if (declarations
!                      && cplpl && structdef == stagseen)
                    make_C_tag (FALSE); /* forward declaration */
                  else
                    token.valid = FALSE;
                } /* switch (fvdef) */
              /* FALLTHRU */
***************
*** 3708,3725 ****
          if (definedef != dnone)
            break;
          if (fvdef == fstartlist)
!           fvdef = fvnone;     /* avoid tagging `foo' in `foo (*bar()) ()' */
          break;
        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... */
            }
          else if (cblev > 0)
            cblev--;
          popclass_above (cblev);
          structdef = snone;
          /* Only if typdef == tinbody is typdefcblev significant. */
--- 3719,3743 ----
          if (definedef != dnone)
            break;
          if (fvdef == fstartlist)
!           {
!             fvdef = fvnone;   /* avoid tagging `foo' in `foo (*bar()) ()' */
!             token.valid = FALSE;
!           }
          break;
        case '}':
          if (definedef != dnone)
            break;
          if (!ignoreindent && lp == newlb.buffer + 1)
            {
+             if (cblev != 0)
+               token.valid = FALSE;
              cblev = 0;        /* reset curly brace level if first column */
              parlev = 0;       /* also reset paren level, just in case... */
            }
          else if (cblev > 0)
            cblev--;
+         else
+           token.valid = FALSE; /* something gone amiss, token unreliable */
          popclass_above (cblev);
          structdef = snone;
          /* Only if typdef == tinbody is typdefcblev significant. */




reply via email to

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