IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2011
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2012
Free Software Foundation, Inc.
This file is not considered part of GNU Emacs.
# define PTR void *
# endif
#else /* no config.h */
-# if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C))
+# if defined (__STDC__) && (__STDC__ || defined (__SUNPRO_C))
# define PTR void * /* for generic pointers */
# else /* not standard C */
# define const /* remove const for old compilers' sake */
# define CTAGS FALSE
#endif
-#define streq(s,t) (assert((s)!=NULL || (t)!=NULL), !strcmp (s, t))
-#define strcaseeq(s,t) (assert((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t))
-#define strneq(s,t,n) (assert((s)!=NULL || (t)!=NULL), !strncmp (s, t, n))
-#define strncaseeq(s,t,n) (assert((s)!=NULL && (t)!=NULL), !etags_strncasecmp (s, t, n))
+#define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t))
+#define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t))
+#define strneq(s,t,n) (assert ((s)!=NULL || (t)!=NULL), !strncmp (s, t, n))
+#define strncaseeq(s,t,n) (assert ((s)!=NULL && (t)!=NULL), !etags_strncasecmp (s, t, n))
#define CHARS 256 /* 2^sizeof(char) */
#define CHAR(x) ((unsigned int)(x) & (CHARS - 1))
-#define iswhite(c) (_wht[CHAR(c)]) /* c is white (see white) */
-#define notinname(c) (_nin[CHAR(c)]) /* c is not in a name (see nonam) */
-#define begtoken(c) (_btk[CHAR(c)]) /* c can start token (see begtk) */
-#define intoken(c) (_itk[CHAR(c)]) /* c can be in token (see midtk) */
-#define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens (see endtk) */
+#define iswhite(c) (_wht[CHAR (c)]) /* c is white (see white) */
+#define notinname(c) (_nin[CHAR (c)]) /* c is not in a name (see nonam) */
+#define begtoken(c) (_btk[CHAR (c)]) /* c can start token (see begtk) */
+#define intoken(c) (_itk[CHAR (c)]) /* c can be in token (see midtk) */
+#define endtoken(c) (_etk[CHAR (c)]) /* c ends tokens (see endtk) */
-#define ISALNUM(c) isalnum (CHAR(c))
-#define ISALPHA(c) isalpha (CHAR(c))
-#define ISDIGIT(c) isdigit (CHAR(c))
-#define ISLOWER(c) islower (CHAR(c))
+#define ISALNUM(c) isalnum (CHAR (c))
+#define ISALPHA(c) isalpha (CHAR (c))
+#define ISDIGIT(c) isdigit (CHAR (c))
+#define ISLOWER(c) islower (CHAR (c))
-#define lowcase(c) tolower (CHAR(c))
+#define lowcase(c) tolower (CHAR (c))
/*
struct re_pattern_buffer *pat; /* the compiled pattern */
struct re_registers regs; /* re registers */
bool error_signaled; /* already signaled for this regexp */
- bool force_explicit_name; /* do not allow implict tag name */
+ bool force_explicit_name; /* do not allow implicit tag name */
bool ignore_case; /* ignore case when matching */
bool multi_line; /* do a multi-line match on the whole file */
} regexp;
static const char *Cplusplus_suffixes [] =
{ "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
"M", /* Objective C++ */
- "pdb", /* Postscript with C syntax */
+ "pdb", /* PostScript with C syntax */
NULL };
static const char Cplusplus_help [] =
"In C++ code, all the tag constructs of C code are tagged. (Use\n\
print_version (void)
{
/* Makes it easier to update automatically. */
- char emacs_copyright[] = "Copyright (C) 2011 Free Software Foundation, Inc.";
+ char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
puts (emacs_copyright);
register int i;
for (i = 0; i < CHARS; i++)
- iswhite(i) = notinname(i) = begtoken(i) = intoken(i) = endtoken(i) = FALSE;
+ iswhite (i) = notinname (i) = begtoken (i) = intoken (i) = endtoken (i) = FALSE;
for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = TRUE;
for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = TRUE;
- notinname('\0') = notinname('\n');
+ notinname ('\0') = notinname ('\n');
for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = TRUE;
- begtoken('\0') = begtoken('\n');
+ begtoken ('\0') = begtoken ('\n');
for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = TRUE;
- intoken('\0') = intoken('\n');
+ intoken ('\0') = intoken ('\n');
for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = TRUE;
- endtoken('\0') = endtoken('\n');
+ endtoken ('\0') = endtoken ('\n');
}
/*
assert (parser != NULL);
- /* Generic initialisations before reading from file. */
+ /* Generic initializations before reading from file. */
linebuffer_setlen (&filebuf, 0); /* reset the file buffer */
- /* Generic initialisations before parsing file with readline. */
+ /* Generic initializations before parsing file with readline. */
lineno = 0; /* reset global line number */
charno = 0; /* reset global char number */
linecharno = 0; /* reset global char number of line start */
* 4. the character, if any, immediately after NAME in LINESTART must
* also be a character in NONAM.
*
- * The implementation uses the notinname() macro, which recognises the
+ * The implementation uses the notinname() macro, which recognizes the
* characters stored in the string `nonam'.
* etags.el needs to use the same characters that are in NONAM.
*/
make_tag (token_name.buffer, token_name.len, isfun, token.line,
token.offset+token.length+1, token.lineno, token.linepos);
else if (DEBUG)
- { /* this branch is optimised away if !DEBUG */
+ { /* this branch is optimized 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);
}
continue;
}
- else if (bracketlev > 0)
- {
- switch (c)
- {
- case ']':
- if (--bracketlev > 0)
- continue;
- break;
- case '\0':
- CNL_SAVE_DEFINEDEF ();
- break;
- }
- continue;
- }
else switch (c)
{
case '"':
inquote = TRUE;
+ if (bracketlev > 0)
+ continue;
if (inattribute)
break;
switch (fvdef)
continue;
case '\'':
inchar = TRUE;
+ if (bracketlev > 0)
+ continue;
if (inattribute)
break;
- if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
+ if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
{
fvextern = FALSE;
fvdef = fvnone;
incomm = TRUE;
lp++;
c = ' ';
+ if (bracketlev > 0)
+ continue;
}
else if (/* cplpl && */ *lp == '/')
{
for (cp = newlb.buffer; cp < lp-1; cp++)
if (!iswhite (*cp))
{
- if (*cp == '*' && *(cp+1) == '/')
+ if (*cp == '*' && cp[1] == '/')
{
cp++;
cpptoken = TRUE;
continue;
case '[':
bracketlev++;
- continue;
+ continue;
+ default:
+ if (bracketlev > 0)
+ {
+ if (c == ']')
+ --bracketlev;
+ else if (c == '\0')
+ CNL_SAVE_DEFINEDEF ();
+ continue;
+ }
+ break;
} /* switch (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. */
+ Also, space-separated :: is not recognized. */
{
if (c_ext & C_AUTO) /* automatic detection of C++ */
c_ext = (c_ext | C_PLPL) & ~C_AUTO;
)
#define LOOKING_AT(cp, kw) /* kw is the keyword, a literal string */ \
- ((assert("" kw), TRUE) /* syntax error if not a literal string */ \
- && strneq ((cp), kw, sizeof(kw)-1) /* cp points at kw */ \
- && notinname ((cp)[sizeof(kw)-1]) /* end of kw */ \
- && ((cp) = skip_spaces((cp)+sizeof(kw)-1))) /* skip spaces */
+ ((assert ("" kw), TRUE) /* syntax error if not a literal string */ \
+ && strneq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \
+ && notinname ((cp)[sizeof (kw)-1]) /* end of kw */ \
+ && ((cp) = skip_spaces ((cp)+sizeof (kw)-1))) /* skip spaces */
/* Similar to LOOKING_AT but does not use notinname, does not skip */
#define LOOKING_AT_NOCASE(cp, kw) /* the keyword is a literal string */ \
- ((assert("" kw), TRUE) /* syntax error if not a literal string */ \
- && strncaseeq ((cp), kw, sizeof(kw)-1) /* cp points at kw */ \
- && ((cp) += sizeof(kw)-1)) /* skip spaces */
+ ((assert ("" kw), TRUE) /* syntax error if not a literal string */ \
+ && strncaseeq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \
+ && ((cp) += sizeof (kw)-1)) /* skip spaces */
/*
* Read a file, but do no processing. This is used to do regexp
readline (&lb, inf);
dbp = lb.buffer;
}
- switch (lowcase(*dbp))
+ switch (lowcase (*dbp))
{
case 'b':
if (nocase_tail ("body"))
}
/* We are at the beginning of a token. */
- switch (lowcase(*dbp))
+ switch (lowcase (*dbp))
{
case 'f':
if (!packages_only && nocase_tail ("function"))
*cp = '\0';
name = concat (package, "::", sp);
*cp = savechar;
- make_tag (name, strlen(name), TRUE,
+ make_tag (name, strlen (name), TRUE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
free (name);
}
}
else if (LOOKING_AT (cp, "function"))
{
- if(*cp == '&')
+ if (*cp == '&')
cp = skip_spaces (cp+1);
- if(*cp != '\0')
+ if (*cp != '\0')
{
name = cp;
while (!notinname (*cp))
&& *cp == '$')
{
name = cp;
- while (!notinname(*cp))
+ while (!notinname (*cp))
cp++;
make_tag (name, cp - name, FALSE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
\f
/*
- * Postscript tags
+ * PostScript tags
* Just look for lines where the first character is '/'
* Also look at "defineps" for PSWrap
* Ideas by:
LOOP_ON_INPUT_LINES (inf, lb, bp)
while ((bp = skip_spaces (bp))[0] != '\0')
- if (bp[0] == '\\' && iswhite(bp[1]))
+ if (bp[0] == '\\' && iswhite (bp[1]))
break; /* read next line */
- else if (bp[0] == '(' && iswhite(bp[1]))
+ else if (bp[0] == '(' && iswhite (bp[1]))
do /* skip to ) or eol */
bp++;
while (*bp != ')' && *bp != '\0');
- else if ((bp[0] == ':' && iswhite(bp[1]) && bp++)
+ else if ((bp[0] == ':' && iswhite (bp[1]) && bp++)
|| LOOKING_AT_NOCASE (bp, "constant")
|| LOOKING_AT_NOCASE (bp, "code")
|| LOOKING_AT_NOCASE (bp, "create")
/* Predicate or rule. Store the function name so that we
only generate a tag for the first clause. */
if (last == NULL)
- last = xnew(len + 1, char);
+ last = xnew (len + 1, char);
else if (len + 1 > allocated)
xrnew (last, len + 1, char);
allocated = len + 1;
return;
readline (plb, inf);
}
- while (!feof(inf));
+ while (!feof (inf));
}
/*
origpos = pos;
- if (ISLOWER(s[pos]) || (s[pos] == '_'))
+ if (ISLOWER (s[pos]) || (s[pos] == '_'))
{
/* The atom is unquoted. */
pos++;
- while (ISALNUM(s[pos]) || (s[pos] == '_'))
+ while (ISALNUM (s[pos]) || (s[pos] == '_'))
{
pos++;
}
single_line = FALSE; /* dot does not match newline */
- if (strlen(regexp_pattern) < 3)
+ if (strlen (regexp_pattern) < 3)
{
error ("null regexp", (char *)NULL);
return;
if (!rp->multi_line)
continue; /* skip normal regexps */
- /* Generic initialisations before parsing file from memory. */
+ /* Generic initializations before parsing file from memory. */
lineno = 1; /* reset global line number */
charno = 0; /* reset global char number */
linecharno = 0; /* reset global char number of line start */
lineno += 1; /* increment global line number */
charno += result; /* increment global char number */
- /* Honour #line directives. */
+ /* Honor #line directives. */
if (!no_line_directive)
{
static bool discard_until_line_directive;
{
return (fn[0] == '/'
#ifdef DOS_NT
- || (ISALPHA(fn[0]) && fn[1] == ':' && fn[2] == '/')
+ || (ISALPHA (fn[0]) && fn[1] == ':' && fn[2] == '/')
#endif
);
}
#ifdef DOS_NT
/* Canonicalize drive letter case. */
-# define ISUPPER(c) isupper (CHAR(c))
+# define ISUPPER(c) isupper (CHAR (c))
if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0]))
fn[0] = lowcase (fn[0]);