[Top][All Lists]
[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: |
Tue, 12 Mar 2002 08:31:57 -0500 |
Index: emacs/lib-src/etags.c
diff -c emacs/lib-src/etags.c:3.9 emacs/lib-src/etags.c:3.10
*** emacs/lib-src/etags.c:3.9 Wed Mar 6 18:14:29 2002
--- emacs/lib-src/etags.c Tue Mar 12 08:31:57 2002
***************
*** 33,39 ****
* Francesco Potortì <address@hidden> has maintained it since 1993.
*/
! char pot_etags_version[] = "@(#) pot revision number is 14.39";
#define TRUE 1
#define FALSE 0
--- 33,39 ----
* Francesco Potortì <address@hidden> has maintained it since 1993.
*/
! char pot_etags_version[] = "@(#) pot revision number is 15.2";
#define TRUE 1
#define FALSE 0
***************
*** 355,361 ****
static char *tagfiledir; /* directory of tagfile */
static FILE *tagf; /* ioptr for tags file */
! static char *curfile; /* current input file name */
static language *curlang; /* current language */
static int lineno; /* line number of current line */
--- 355,363 ----
static char *tagfiledir; /* directory of tagfile */
static FILE *tagf; /* ioptr for tags file */
! static char *curfile; /* current input uncompressed file name */
! static char *curfiledir; /* absolute dir of curfile */
! static char *curtagfname; /* current file name to write in tagfile */
static language *curlang; /* current language */
static int lineno; /* line number of current line */
***************
*** 1394,1400 ****
uncompressed_name = savenstr (file, ext - file);
}
! /* If the canonicalised uncompressed name has already be dealt with,
skip it silently, else add it to the list. */
{
typedef struct processed_file
--- 1396,1402 ----
uncompressed_name = savenstr (file, ext - file);
}
! /* If the canonicalized uncompressed name has already be dealt with,
skip it silently, else add it to the list. */
{
typedef struct processed_file
***************
*** 1482,1501 ****
goto exit;
}
! if (filename_is_absolute (uncompressed_name))
{
! /* file is an absolute file name. Canonicalise it. */
! curfile = absolute_filename (uncompressed_name, cwd);
}
else
{
/* file is a file name relative to cwd. Make it relative
to the directory of the tags file. */
! curfile = relative_filename (uncompressed_name, tagfiledir);
}
nocharno = FALSE; /* use char position when making tags */
! find_entries (uncompressed_name, inf);
if (real_name == compressed_name)
retval = pclose (inf);
else
--- 1484,1506 ----
goto exit;
}
! curfile = uncompressed_name;
! curfiledir = absolute_dirname (curfile, cwd);
! if (filename_is_absolute (curfile))
{
! /* file is an absolute file name. Canonicalize it. */
! curtagfname = absolute_filename (curfile, NULL);
}
else
{
/* file is a file name relative to cwd. Make it relative
to the directory of the tags file. */
! curtagfname = relative_filename (curfile, tagfiledir);
}
nocharno = FALSE; /* use char position when making tags */
! find_entries (curfile, inf);
+ free (curfiledir);
if (real_name == compressed_name)
retval = pclose (inf);
else
***************
*** 1642,1649 ****
/* If ctags mode, change name "main" to M<thisfilename>. */
if (CTAGS && !cxref_style && streq (name, "main"))
{
! register char *fp = etags_strrchr (curfile, '/');
! np->name = concat ("M", fp == NULL ? curfile : fp + 1, "");
fp = etags_strrchr (np->name, '.');
if (fp != NULL && fp[1] != '\0' && fp[2] == '\0')
fp[0] = '\0';
--- 1647,1654 ----
/* If ctags mode, change name "main" to M<thisfilename>. */
if (CTAGS && !cxref_style && streq (name, "main"))
{
! register char *fp = etags_strrchr (curtagfname, '/');
! np->name = concat ("M", fp == NULL ? curtagfname : fp + 1, "");
fp = etags_strrchr (np->name, '.');
if (fp != NULL && fp[1] != '\0' && fp[2] == '\0')
fp[0] = '\0';
***************
*** 1651,1657 ****
else
np->name = name;
np->been_warned = FALSE;
! np->file = curfile;
np->is_func = is_func;
np->lno = lno;
if (nocharno)
--- 1656,1662 ----
else
np->name = name;
np->been_warned = FALSE;
! np->file = curtagfname;
np->is_func = is_func;
np->lno = lno;
if (nocharno)
***************
*** 1838,1844 ****
}
- #if !CTAGS
static int total_size_of_entries __P((node *));
static int number_len __P((long));
--- 1843,1848 ----
***************
*** 1878,1884 ****
return total;
}
- #endif
static void
put_entries (np)
--- 1882,1887 ----
***************
*** 1895,1901 ****
put_entries (np->left);
/* Output this entry */
! #if !CTAGS
{
/* Etags mode */
if (file != np->file
--- 1898,1904 ----
put_entries (np->left);
/* Output this entry */
! if (!CTAGS)
{
/* Etags mode */
if (file != np->file
***************
*** 1918,1924 ****
else
fprintf (tagf, "%ld\n", np->cno);
}
! #else
{
/* Ctags mode */
if (np->name == NULL)
--- 1921,1927 ----
else
fprintf (tagf, "%ld\n", np->cno);
}
! else
{
/* Ctags mode */
if (np->name == NULL)
***************
*** 1957,1963 ****
putc ('\n', tagf);
}
}
! #endif
/* Output subentries that follow this one */
put_entries (np->right);
--- 1960,1966 ----
putc ('\n', tagf);
}
}
!
/* Output subentries that follow this one */
put_entries (np->right);
***************
*** 4056,4063 ****
/*
* Python support
! * Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/
* Idea by Eric S. Raymond <address@hidden> (1997)
*/
static void
Python_functions (inf)
--- 4059,4067 ----
/*
* Python support
! * Look for /^[\t]*def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/
* Idea by Eric S. Raymond <address@hidden> (1997)
+ * More ideas by seb bacon <address@hidden> (2002)
*/
static void
Python_functions (inf)
***************
*** 4066,4078 ****
register char *cp;
LOOP_ON_INPUT_LINES (inf, lb, cp)
! if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class"))
! {
! while (!notinname (*cp) && *cp != ':')
! cp++;
! pfnote (NULL, TRUE,
! lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
! }
}
--- 4070,4086 ----
register char *cp;
LOOP_ON_INPUT_LINES (inf, lb, cp)
! {
! cp = skip_spaces (cp);
! if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class"))
! {
! char *name = cp;
! while (!notinname (*cp) && *cp != ':')
! cp++;
! pfnote (savenstr (name, cp-name), TRUE,
! lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
! }
! }
}
***************
*** 4090,4107 ****
PHP_functions (inf)
FILE *inf;
{
! register char *cp;
bool search_identifier = FALSE;
LOOP_ON_INPUT_LINES (inf, lb, cp)
{
cp = skip_spaces (cp);
if (search_identifier
&& *cp != '\0')
{
while (!notinname (*cp))
cp++;
! pfnote (NULL, TRUE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
search_identifier = FALSE;
}
--- 4098,4116 ----
PHP_functions (inf)
FILE *inf;
{
! register char *cp, *name;
bool search_identifier = FALSE;
LOOP_ON_INPUT_LINES (inf, lb, cp)
{
cp = skip_spaces (cp);
+ name = cp;
if (search_identifier
&& *cp != '\0')
{
while (!notinname (*cp))
cp++;
! pfnote (savenstr (name, cp-name), TRUE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
search_identifier = FALSE;
}
***************
*** 4111,4119 ****
cp = skip_spaces (cp+1);
if(*cp != '\0')
{
while (!notinname (*cp))
cp++;
! pfnote (NULL, TRUE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
else
--- 4120,4129 ----
cp = skip_spaces (cp+1);
if(*cp != '\0')
{
+ name = cp;
while (!notinname (*cp))
cp++;
! pfnote (savenstr (name, cp-name), TRUE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
else
***************
*** 4123,4131 ****
{
if (*cp != '\0')
{
while (*cp != '\0' && !iswhite (*cp))
cp++;
! pfnote (NULL, FALSE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
else
--- 4133,4142 ----
{
if (*cp != '\0')
{
+ name = cp;
while (*cp != '\0' && !iswhite (*cp))
cp++;
! pfnote (savenstr (name, cp-name), FALSE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
else
***************
*** 4137,4154 ****
&& (*cp == '"' || *cp == '\''))
{
char quote = *cp++;
while (*cp != quote && *cp != '\0')
cp++;
! pfnote (NULL, FALSE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
else if (members
&& LOOKING_AT (cp, "var")
&& *cp == '$')
{
while (!notinname(*cp))
cp++;
! pfnote (NULL, FALSE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
}
--- 4148,4167 ----
&& (*cp == '"' || *cp == '\''))
{
char quote = *cp++;
+ name = cp;
while (*cp != quote && *cp != '\0')
cp++;
! pfnote (savenstr (name, cp-name), FALSE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
else if (members
&& LOOKING_AT (cp, "var")
&& *cp == '$')
{
+ name = cp;
while (!notinname(*cp))
cp++;
! pfnote (savenstr (name, cp-name), FALSE,
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
}
}
***************
*** 4574,4586 ****
i = TEX_Token (lasthit);
if (i >= 0)
{
- /* We seem to include the TeX command in the tag name.
register char *p;
! for (p = lasthit + TEX_toktab[i].len;
! *p != '\0' && *p != TEX_clgrp;
p++)
! continue; */
! pfnote (/*savenstr (lasthit, p-lasthit)*/ (char *)NULL, TRUE,
lb.buffer, lb.len, lineno, linecharno);
break; /* We only tag a line once */
}
--- 4587,4602 ----
i = TEX_Token (lasthit);
if (i >= 0)
{
register char *p;
! for (lasthit += TEX_toktab[i].len;
! *lasthit == TEX_esc || *lasthit == TEX_opgrp;
! lasthit++)
! continue;
! for (p = lasthit;
! !iswhite (*p) && *p != TEX_opgrp && *p != TEX_clgrp;
p++)
! continue;
! pfnote (savenstr (lasthit, p-lasthit), TRUE,
lb.buffer, lb.len, lineno, linecharno);
break; /* We only tag a line once */
}
***************
*** 5427,5432 ****
--- 5443,5449 ----
/* Read new line. */
long result = readline_internal (lbp, stream);
+ /* Honour #line directives. */
if (!no_line_directive
&& result > 12 && strneq (lbp->buffer, "#line ", 6))
{
***************
*** 5441,5456 ****
endp++;
if (endp != NULL)
{
! int len = endp - (lbp->buffer + start);
! if (!strneq (curfile, lbp->buffer + start, len))
! curfile = savenstr (lbp->buffer + start, len);
lineno = lno;
nocharno = TRUE; /* do not use char position for tags */
return readline (lbp, stream);
}
}
}
#ifdef ETAGS_REGEXPS
{
int match;
--- 5458,5488 ----
endp++;
if (endp != NULL)
{
! char *absname, *name = lbp->buffer + start;
! *endp = '\0';
! canonicalize_filename(name); /* for DOS */
! absname = absolute_filename (name, curfiledir);
! if (filename_is_absolute (name)
! || filename_is_absolute (curfile))
! name = absname;
! else
! {
! name = relative_filename (absname, tagfiledir);
! free (absname);
! }
!
! if (streq (curtagfname, name))
! free (name);
! else
! curtagfname = name;
lineno = lno;
nocharno = TRUE; /* do not use char position for tags */
return readline (lbp, stream);
}
}
}
+
#ifdef ETAGS_REGEXPS
{
int match;