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, 06 Jun 2002 18:37:28 -0400

Index: emacs/lib-src/etags.c
diff -c emacs/lib-src/etags.c:3.20 emacs/lib-src/etags.c:3.21
*** emacs/lib-src/etags.c:3.20  Thu Jun  6 08:47:58 2002
--- emacs/lib-src/etags.c       Thu Jun  6 18:37:28 2002
***************
*** 34,40 ****
   *    Francesco Potortì <address@hidden> has maintained it since 1993.
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.4";
  
  #define       TRUE    1
  #define       FALSE   0
--- 34,40 ----
   *    Francesco Potortì <address@hidden> has maintained it since 1993.
   */
  
! char pot_etags_version[] = "@(#) pot revision number is 16.10";
  
  #define       TRUE    1
  #define       FALSE   0
***************
*** 349,355 ****
  static language *get_language_from_langname __P((const char *));
  static language *get_language_from_interpreter __P((char *));
  static language *get_language_from_filename __P((char *, bool));
! static long readline __P((linebuffer *, FILE *));
  static long readline_internal __P((linebuffer *, FILE *));
  static bool nocase_tail __P((char *));
  static char *get_tag __P((char *));
--- 349,355 ----
  static language *get_language_from_langname __P((const char *));
  static language *get_language_from_interpreter __P((char *));
  static language *get_language_from_filename __P((char *, bool));
! 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 *));
***************
*** 711,719 ****
  Absolute names are stored in the output file as they are.\n\
  Relative ones are stored relative to the output file's directory.\n");
  
-   puts ("--parse-stdin=NAME\n\
-         Read from standard input and record tags as belonging to file NAME.");
- 
    if (!CTAGS)
      puts ("-a, --append\n\
          Append tag entries to existing tags file.");
--- 711,716 ----
***************
*** 784,796 ****
    puts ("-R, --no-regex\n\
          Don't create tags from regexps for the following files.");
  #endif /* ETAGS_REGEXPS */
-   puts ("-o FILE, --output=FILE\n\
-         Write the tags to FILE.");
    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++.");
  
    if (CTAGS)
      {
--- 781,795 ----
    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\
+         Read from standard input and record tags as belonging to file NAME.");
  
    if (CTAGS)
      {
***************
*** 1049,1054 ****
--- 1048,1055 ----
        argbuffer[current_arg].what     = optarg;
        ++current_arg;
        ++file_count;
+       if (parsing_stdin)
+         fatal ("cannot parse standard input more than once", (char *)NULL);
        parsing_stdin = TRUE;
        break;
  
***************
*** 1702,1708 ****
    /* We rewind here, even if inf may be a pipe.  We fail if the
       length of the first line is longer than the pipe block size,
       which is unlikely. */
-   if (parser == NULL)
      rewind (inf);
  
    /* Else try to guess the language given the case insensitive file name. */
--- 1703,1708 ----
***************
*** 1750,1755 ****
--- 1750,1760 ----
  
    if (parser != NULL)
      {
+       /* Generic initialisations before reading from file. */
+       lineno = 0;             /* reset global line number */
+       charno = 0;             /* reset global char number */
+       linecharno = 0;         /* reset global char number of line start */
+ 
        parser (inf);
        return;
      }
***************
*** 1757,1763 ****
    /* Else try Fortran. */
    old_last_node = last_node;
    curfdp->lang = get_language_from_langname ("fortran");
!   Fortran_functions (inf);
  
    if (old_last_node == last_node)
      /* No Fortran entries found.  Try C. */
--- 1762,1768 ----
    /* Else try Fortran. */
    old_last_node = last_node;
    curfdp->lang = get_language_from_langname ("fortran");
!   find_entries (inf);
  
    if (old_last_node == last_node)
      /* No Fortran entries found.  Try C. */
***************
*** 1766,1772 ****
         Only the file name will be recorded in the tags file. */
        rewind (inf);
        curfdp->lang = get_language_from_langname (cplusplus ? "c++" : "c");
!       default_C_entries (inf);
      }
    return;
  }
--- 1771,1777 ----
         Only the file name will be recorded in the tags file. */
        rewind (inf);
        curfdp->lang = get_language_from_langname (cplusplus ? "c++" : "c");
!       find_entries (inf);
      }
    return;
  }
***************
*** 2951,2959 ****
  #define CNL_SAVE_DEFINEDEF()                                          \
  do {                                                                  \
    curlinepos = charno;                                                        
\
!   lineno++;                                                           \
!   linecharno = charno;                                                        
\
!   charno += readline (&curlb, inf);                                   \
    lp = curlb.buffer;                                                  \
    quotednl = FALSE;                                                   \
    newndx = curndx;                                                    \
--- 2956,2962 ----
  #define CNL_SAVE_DEFINEDEF()                                          \
  do {                                                                  \
    curlinepos = charno;                                                        
\
!   readline (&curlb, inf);                                             \
    lp = curlb.buffer;                                                  \
    quotednl = FALSE;                                                   \
    newndx = curndx;                                                    \
***************
*** 3045,3052 ****
  
    tokoff = toklen = typdefcblev = 0; /* keep compiler quiet */
    curndx = newndx = 0;
-   lineno = 0;
-   charno = 0;
    lp = curlb.buffer;
    *lp = 0;
  
--- 3048,3053 ----
***************
*** 3828,3839 ****
  
  /* Useful macros. */
  #define LOOP_ON_INPUT_LINES(file_pointer, line_buffer, char_pointer)  \
!   for (lineno = charno = 0;   /* loop initialization */               \
         !feof (file_pointer)   /* loop test */                         \
!        && (lineno++,          /* instructions at start of loop */     \
!          linecharno = charno,                                         \
!          charno += readline (&line_buffer, file_pointer),             \
!          char_pointer = lb.buffer,                                    \
           TRUE);                                                       \
        )
  #define LOOKING_AT(cp, keyword)       /* keyword is a constant string */      
\
--- 3829,3838 ----
  
  /* Useful macros. */
  #define LOOP_ON_INPUT_LINES(file_pointer, line_buffer, char_pointer)  \
!   for (;                      /* loop initialization */               \
         !feof (file_pointer)   /* loop test */                         \
!        && (char_pointer = lb.buffer, /* instructions at start of loop */ \
!          readline (&line_buffer, file_pointer),                       \
           TRUE);                                                       \
        )
  #define LOOKING_AT(cp, keyword)       /* keyword is a constant string */      
\
***************
*** 3893,3901 ****
    dbp = skip_spaces (dbp);
    if (*dbp == '\0')
      {
!       lineno++;
!       linecharno = charno;
!       charno += readline (&lb, inf);
        dbp = lb.buffer;
        if (dbp[5] != '&')
        return;
--- 3892,3898 ----
    dbp = skip_spaces (dbp);
    if (*dbp == '\0')
      {
!       readline (&lb, inf);
        dbp = lb.buffer;
        if (dbp[5] != '&')
        return;
***************
*** 4010,4018 ****
        if (*dbp == '\0'
          || (dbp[0] == '-' && dbp[1] == '-'))
        {
!         lineno++;
!         linecharno = charno;
!         charno += readline (&lb, inf);
          dbp = lb.buffer;
        }
        switch (lowcase(*dbp))
--- 4007,4013 ----
        if (*dbp == '\0'
          || (dbp[0] == '-' && dbp[1] == '-'))
        {
!         readline (&lb, inf);
          dbp = lb.buffer;
        }
        switch (lowcase(*dbp))
***************
*** 4456,4463 ****
  
    save_lcno = save_lineno = save_len = 0; /* keep compiler quiet */
    namebuf = NULL;             /* keep compiler quiet */
-   lineno = 0;
-   charno = 0;
    dbp = lb.buffer;
    *dbp = '\0';
    initbuffer (&tline);
--- 4451,4456 ----
***************
*** 4474,4482 ****
        c = *dbp++;
        if (c == '\0')          /* if end of line */
        {
!         lineno++;
!         linecharno = charno;
!         charno += readline (&lb, inf);
          dbp = lb.buffer;
          if (*dbp == '\0')
            continue;
--- 4467,4473 ----
        c = *dbp++;
        if (c == '\0')          /* if end of line */
        {
!         readline (&lb, inf);
          dbp = lb.buffer;
          if (*dbp == '\0')
            continue;
***************
*** 4987,4994 ****
        for (cp = plb->buffer; *cp != '\0'; cp++)
        if (cp[0] == '*' && cp[1] == '/')
          return;
!       lineno++;
!       linecharno += readline (plb, inf);
      }
    while (!feof(inf));
  }
--- 4978,4984 ----
        for (cp = plb->buffer; *cp != '\0'; cp++)
        if (cp[0] == '*' && cp[1] == '/')
          return;
!       readline (plb, inf);
      }
    while (!feof(inf));
  }
***************
*** 5280,5286 ****
  /* Take a string like "/blah/" and turn it into "blah", making sure
     that the first and last characters are the same, and handling
     quoted separator characters.  Actually, stops on the occurrence of
!    an unquoted separator.  Also turns "\t" into a Tab character.
     Returns pointer to terminating separator.  Works in place.  Null
     terminates name string. */
  static char *
--- 5270,5277 ----
  /* Take a string like "/blah/" and turn it into "blah", making sure
     that the first and last characters are the same, and handling
     quoted separator characters.  Actually, stops on the occurrence of
!    an unquoted separator.  Also turns "\t" into a Tab character, and
!    similarly for all character escape sequences supported by Gcc.
     Returns pointer to terminating separator.  Works in place.  Null
     terminates name string. */
  static char *
***************
*** 5295,5309 ****
      {
        if (quoted)
        {
!         if (*name == 't')
!           *copyto++ = '\t';
!         else if (*name == sep)
!           *copyto++ = sep;
!         else
            {
!             /* Something else is quoted, so preserve the quote. */
!             *copyto++ = '\\';
!             *copyto++ = *name;
            }
          quoted = FALSE;
        }
--- 5286,5312 ----
      {
        if (quoted)
        {
!         switch (*name)
            {
!           case 'a': *copyto++ = '\007'; break;
!           case 'b': *copyto++ = '\b'; break;
!           case 'd': *copyto++ = 0177; break;
!           case 'e': *copyto++ = 033; break;
!           case 'f': *copyto++ = '\f'; break;
!           case 'n': *copyto++ = '\n'; break;
!           case 'r': *copyto++ = '\r'; break;
!           case 't': *copyto++ = '\t'; break;
!           case 'v': *copyto++ = '\v'; break;
!           default:
!             if (*name == sep)
!               *copyto++ = sep;
!             else
!               {
!                 /* Something else is quoted, so preserve the quote. */
!                 *copyto++ = '\\';
!                 *copyto++ = *name;
!               }
!             break;
            }
          quoted = FALSE;
        }
***************
*** 5630,5642 ****
   * Like readline_internal, above, but in addition try to match the
   * input line against relevant regular expressions.
   */
! static long
  readline (lbp, stream)
       linebuffer *lbp;
       FILE *stream;
  {
!   /* Read new line. */
!   long result = readline_internal (lbp, stream);
  
    /* Honour #line directives. */
    if (!no_line_directive)
--- 5633,5649 ----
   * Like readline_internal, above, but in addition try to match the
   * input line against relevant regular expressions.
   */
! static void
  readline (lbp, stream)
       linebuffer *lbp;
       FILE *stream;
  {
!   long result;
! 
!   linecharno = charno;                /* update global char number of line 
start */
!   result = readline_internal (lbp, stream); /* read line */
!   lineno += 1;                        /* increment global line number */
!   charno += result;           /* increment global char number */
  
    /* Honour #line directives. */
    if (!no_line_directive)
***************
*** 5733,5740 ****
                        }
                    }
                  free (taggedabsname);
!                 lineno = lno;
!                 return readline (lbp, stream);
                } /* if a real #line directive */
            } /* if #line is followed by a a number */
        } /* if line begins with "#line " */
--- 5740,5748 ----
                        }
                    }
                  free (taggedabsname);
!                 lineno = lno - 1;
!                 readline (lbp, stream);
!                 return;
                } /* if a real #line directive */
            } /* if #line is followed by a a number */
        } /* if line begins with "#line " */
***************
*** 5743,5754 ****
        if (discard_until_line_directive)
        {
          if (result > 0)
            /* Do a tail recursion on ourselves, thus discarding the contents
               of the line buffer. */
!           return readline (lbp, stream);
          /* End of file. */
          discard_until_line_directive = FALSE;
!         return 0;
        }
      } /* if #line directives should be considered */
  
--- 5751,5765 ----
        if (discard_until_line_directive)
        {
          if (result > 0)
+           {
            /* Do a tail recursion on ourselves, thus discarding the contents
               of the line buffer. */
!             readline (lbp, stream);
!             return;
!           }
          /* End of file. */
          discard_until_line_directive = FALSE;
!         return;
        }
      } /* if #line directives should be considered */
  
***************
*** 5800,5807 ****
        }
    }
  #endif /* ETAGS_REGEXPS */
- 
-   return result;
  }
  
  
--- 5811,5816 ----



reply via email to

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