changeset 15243:c024dca549c5

* etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline. (Pascal_functions): Increase linecharno by the correct number of chars, inline the GET_NEW_LINE macro and delete its definition.
author Francesco Potortì <pot@gnu.org>
date Fri, 17 May 1996 16:48:02 +0000
parents 56c035c36875
children be4d30237fe6
files lib-src/etags.c
diffstat 1 files changed, 23 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/etags.c	Fri May 17 06:12:35 1996 +0000
+++ b/lib-src/etags.c	Fri May 17 16:48:02 1996 +0000
@@ -31,7 +31,7 @@
  *	Francesco Potorti` (F.Potorti@cnuce.cnr.it) is the current maintainer.
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 11.59";
+char pot_etags_version[] = "@(#) pot revision number is 11.63";
 
 #define	TRUE	1
 #define	FALSE	0
@@ -216,9 +216,7 @@
 
 int lineno;			/* line number of current line */
 long charno;			/* current character number */
-
-long linecharno;		/* charno of start of line; not used by C,
-				   but by every other language. */
+long linecharno;		/* charno of start of line */
 
 char *curfile;			/* current input file name */
 char *tagfile;			/* output file */
@@ -880,7 +878,7 @@
 	  tagf = stdout;
 #ifdef DOS_NT
 	  /* Switch redirected `stdout' to binary mode (setting `_fmode'
-	     doesn't take effect until after `stdout' is already open),  */
+	     doesn't take effect until after `stdout' is already open). */
 	  if (!isatty (fileno (stdout)))
 	    setmode (fileno (stdout), O_BINARY);
 #endif /* DOS_NT */
@@ -1071,15 +1069,11 @@
   struct stat stat_buf;
   FILE *inf;
 #ifdef DOS_NT
-  /* The rest of the program can't grok `\\'-style slashes.  */
-  char *p = file;
-
-  while (*p)
-    {
-      if (*p == '\\')
-	*p = '/';
-      ++p;
-    }
+  char *p;
+
+  for (p = file; *p != '\0'; p++)
+    if (*p == '\\')
+      *p = '/';
 #endif
 
   if (stat (file, &stat_buf) == 0 && !S_ISREG (stat_buf.st_mode))
@@ -2056,6 +2050,7 @@
 do {									\
   curlinepos = charno;							\
   lineno++;								\
+  linecharno = charno;							\
   charno += readline (&curlb, inf);					\
   lp = curlb.buffer;							\
   quotednl = FALSE;							\
@@ -2923,13 +2918,6 @@
 /* Added by Mosur Mohan, 4/22/88 */
 /* Pascal parsing                */
 
-#define GET_NEW_LINE \
-{ \
-  linecharno = charno; lineno++; \
-  charno += 1 + readline (&lb, inf); \
-  dbp = lb.buffer; \
-}
-
 /*
  *  Locates tags for procedures & functions.  Doesn't do any type- or
  *  var-definitions.  It does look for the keyword "extern" or
@@ -2976,7 +2964,10 @@
       c = *dbp++;
       if (c == '\0')		/* if end of line */
 	{
-	  GET_NEW_LINE;
+	  lineno++;
+	  linecharno = charno;
+	  charno += readline (&lb, inf);
+	  dbp = lb.buffer;
 	  if (*dbp == '\0')
 	    continue;
 	  if (!((found_tag && verify_tag) ||
@@ -4318,14 +4309,11 @@
   char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS.  */
 
   getwd (path);
-  p = path;
-  while (*p)
-    {
-      if (*p == '\\')
-	*p++ = '/';
-      else
-	*p++ = lowcase (*p);
-    }
+  for (p = path; *p != '\0'; p++)
+    if (*p == '\\')
+      *p = '/';
+    else
+      *p = lowcase (*p);
 
   return strdup (path);
 #else /* not DOS_NT */
@@ -4471,14 +4459,11 @@
   char *slashp, *res;
   char save;
 #ifdef DOS_NT
-  char *p = file;
-
-  while (*p)
-    {
-      if (*p == '\\')
-	*p = '/';
-      ++p;
-    }
+  char *p;
+
+  for (p = file; *p != '\0'; p++)
+    if (*p == '\\')
+      *p = '/';
 #endif
 
   slashp = etags_strrchr (file, '/');