*
* Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer.
*/
+char pot_etags_version[] = "@(#) pot revision number is 11.21";
-char pot_etags_version[] = "@(#) pot revision number is 11.19";
#ifdef MSDOS
#include <fcntl.h>
#include <sys/param.h>
};
struct linebuffer lb; /* the current line */
+struct linebuffer token_str; /* used by C_entries as temporary area */
struct
{
long linepos;
{ "c", default_C_entries },
{ "h", default_C_entries },
- /* .C or .H or .cpp or .cxx or .hxx or .hh or .cc or .cpp: a C++ file */
+ /* .C or .H or .c++ or .cc or .cpp or .cxx or .h++ or .hh or .hxx:
+ a C++ file */
{ "C", Cplusplus_entries },
{ "H", Cplusplus_entries },
+ { "c++", Cplusplus_entries },
{ "cc", Cplusplus_entries },
{ "cpp", Cplusplus_entries },
{ "cxx", Cplusplus_entries },
+ { "h++", Cplusplus_entries },
{ "hh", Cplusplus_entries },
{ "hxx", Cplusplus_entries },
init (); /* set up boolean "functions" */
initbuffer (&lb);
+ initbuffer (&token_str);
initbuffer (&lbs[0].lb);
initbuffer (&lbs[1].lb);
initbuffer (&filename_lb);
break;
}
}
-
if (!CTAGS)
{
while (nincluded_files-- > 0)
logical named;
int linelen;
int lineno;
+ long linepos;
+ char *buffer;
} TOKEN;
#define current_lb_is_new (newndx == curndx)
definedef = dnone; \
} while (0)
-#define make_tag_from_new_lb(isfun) pfnote (tok.str, isfun, tok.named, \
- newlb.buffer, tok.linelen, tok.lineno, newlinepos)
-#define make_tag_from_oth_lb(isfun) pfnote (tok.str, isfun, tok.named, \
- othlb.buffer, tok.linelen, tok.lineno, othlinepos)
+#define make_tag(isfun) pfnote (savestr (token_str.buffer), isfun, \
+ tok.named, tok.buffer, tok.linelen, tok.lineno, tok.linepos)
void
C_entries (c_ext, inf)
&& is_func)
/* function defined in C++ class body */
{
- char *cp = newlb.buffer + tokoff + toklen;
- char c = *cp;
- *cp = '\0';
- tok.str = concat (structtag, "::",
- newlb.buffer + tokoff);
- *cp = c;
+ int strsize = strlen(structtag) + 2 + toklen + 1;
+ while (token_str.size < strsize)
+ {
+ token_str.size *= 2;
+ xrealloc (token_str.buffer, token_str.size);
+ }
+ strcpy (token_str.buffer, structtag);
+ strcat (token_str.buffer, "::");
+ strncat (token_str.buffer,
+ newlb.buffer+tokoff, toklen);
tok.named = TRUE;
}
else
{
- tok.str = savenstr (newlb.buffer+tokoff, toklen);
+ while (token_str.size < toklen + 1)
+ {
+ token_str.size *= 2;
+ xrealloc (token_str.buffer, token_str.size);
+ }
+ strncpy (token_str.buffer,
+ newlb.buffer+tokoff, toklen);
+ token_str.buffer[toklen] = '\0';
if (structdef == stagseen
|| typdef == tend
|| (is_func
}
tok.lineno = lineno;
tok.linelen = tokoff + toklen + 1;
+ tok.buffer = newlb.buffer;
+ tok.linepos = newlinepos;
if (definedef == dnone
&& (funcdef == ftagseen
switch_line_buffers ();
}
else
- make_tag_from_new_lb (is_func);
+ make_tag (is_func);
}
midtoken = FALSE;
}
funcdef = finlist;
continue;
case flistseen:
- make_tag_from_oth_lb (TRUE);
+ make_tag (TRUE);
funcdef = fignore;
break;
case ftagseen:
case ftagseen:
if (yacc_rules)
{
- make_tag_from_oth_lb (FALSE);
+ make_tag (FALSE);
funcdef = fignore;
}
break;
switch (typdef)
{
case tend:
- make_tag_from_oth_lb (FALSE);
+ make_tag (FALSE);
/* FALLTHRU */
default:
typdef = tnone;
if (cblev == 0 && typdef == tend)
{
typdef = tignore;
- make_tag_from_oth_lb (FALSE);
+ make_tag (FALSE);
break;
}
if (funcdef != finlist && funcdef != fignore)
if (*lp != '*')
{
typdef = tignore;
- make_tag_from_oth_lb (FALSE);
+ make_tag (FALSE);
}
break;
} /* switch (typdef) */
if (cblev == 0 && typdef == tend)
{
typdef = tignore;
- make_tag_from_oth_lb (FALSE);
+ make_tag (FALSE);
}
}
else if (parlev < 0) /* can happen due to ill-conceived #if's. */
case stagseen:
case scolonseen: /* named struct */
structdef = sinbody;
- make_tag_from_oth_lb (FALSE);
+ make_tag (FALSE);
break;
}
switch (funcdef)
{
case flistseen:
- make_tag_from_oth_lb (TRUE);
+ make_tag (TRUE);
/* FALLTHRU */
case fignore:
funcdef = fnone;