diff options
| author | Francesco Potortì | 1993-09-20 16:08:50 +0000 |
|---|---|---|
| committer | Francesco Potortì | 1993-09-20 16:08:50 +0000 |
| commit | fe0b3356d939e9843973ff91611d5174609006ec (patch) | |
| tree | 9bd8dfc01343e5744d53ba88e926aaf7c75e25f2 /lib-src | |
| parent | 36ab15b2fdab684ac17e5a0d99268b01e7831898 (diff) | |
| download | emacs-fe0b3356d939e9843973ff91611d5174609006ec.tar.gz emacs-fe0b3356d939e9843973ff91611d5174609006ec.zip | |
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
* etags.c (C_entries): is_func is initialised here instead of in
consider_token for the sake of the yacc rules section.
(C_entries): Now class, struct, enum, union and typedef produce
named tags.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 69a80098166..c21fe560c6f 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -25,7 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 25 | * Gnu Emacs TAGS format and modifications by RMS? | 25 | * Gnu Emacs TAGS format and modifications by RMS? |
| 26 | * Sam Kendall added C++. | 26 | * Sam Kendall added C++. |
| 27 | * | 27 | * |
| 28 | * Francesco Potorti` is the current maintainer. 7.5 | 28 | * Francesco Potorti` is the current maintainer. 8.3 |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | #ifdef HAVE_CONFIG_H | 31 | #ifdef HAVE_CONFIG_H |
| @@ -138,7 +138,7 @@ struct nd_st | |||
| 138 | char *name; /* function or type name */ | 138 | char *name; /* function or type name */ |
| 139 | char *file; /* file name */ | 139 | char *file; /* file name */ |
| 140 | logical is_func; /* use pattern or line no */ | 140 | logical is_func; /* use pattern or line no */ |
| 141 | logical rewritten; /* list name separately */ | 141 | logical named; /* list name separately */ |
| 142 | logical been_warned; /* set if noticed dup */ | 142 | logical been_warned; /* set if noticed dup */ |
| 143 | int lno; /* line number tag is on */ | 143 | int lno; /* line number tag is on */ |
| 144 | long cno; /* character number line starts on */ | 144 | long cno; /* character number line starts on */ |
| @@ -326,7 +326,7 @@ typedef struct | |||
| 326 | char *p; | 326 | char *p; |
| 327 | int len; | 327 | int len; |
| 328 | LINENO lineno; | 328 | LINENO lineno; |
| 329 | logical rewritten; | 329 | logical named; |
| 330 | } TOKEN; | 330 | } TOKEN; |
| 331 | 331 | ||
| 332 | /* C extensions. | 332 | /* C extensions. |
| @@ -993,10 +993,10 @@ string_numeric_p (str) | |||
| 993 | /* Record a tag. */ | 993 | /* Record a tag. */ |
| 994 | /* Should take a TOKEN* instead!! */ | 994 | /* Should take a TOKEN* instead!! */ |
| 995 | void | 995 | void |
| 996 | pfnote (name, is_func, rewritten, linestart, linelen, lno, cno) | 996 | pfnote (name, is_func, named, linestart, linelen, lno, cno) |
| 997 | char *name; /* tag name */ | 997 | char *name; /* tag name */ |
| 998 | logical is_func; /* function or type name? */ | 998 | logical is_func; /* function or type name? */ |
| 999 | logical rewritten; /* tag different from text of definition? */ | 999 | logical named; /* tag different from text of definition? */ |
| 1000 | char *linestart; | 1000 | char *linestart; |
| 1001 | int linelen; | 1001 | int linelen; |
| 1002 | int lno; | 1002 | int lno; |
| @@ -1031,12 +1031,12 @@ pfnote (name, is_func, rewritten, linestart, linelen, lno, cno) | |||
| 1031 | fp = etags_rindex (name, '.'); | 1031 | fp = etags_rindex (name, '.'); |
| 1032 | if (fp && fp[1] != '\0' && fp[2] == '\0') | 1032 | if (fp && fp[1] != '\0' && fp[2] == '\0') |
| 1033 | *fp = 0; | 1033 | *fp = 0; |
| 1034 | rewritten = TRUE; | 1034 | named = TRUE; |
| 1035 | } | 1035 | } |
| 1036 | np->name = savestr (name); | 1036 | np->name = savestr (name); |
| 1037 | np->file = curfile; | 1037 | np->file = curfile; |
| 1038 | np->is_func = is_func; | 1038 | np->is_func = is_func; |
| 1039 | np->rewritten = rewritten; | 1039 | np->named = named; |
| 1040 | np->lno = lno; | 1040 | np->lno = lno; |
| 1041 | /* UNCOMMENT THE +1 HERE: */ | 1041 | /* UNCOMMENT THE +1 HERE: */ |
| 1042 | np->cno = cno /* + 1 */ ; /* our char numbers are 0-base; emacs's are 1-base */ | 1042 | np->cno = cno /* + 1 */ ; /* our char numbers are 0-base; emacs's are 1-base */ |
| @@ -1174,7 +1174,7 @@ put_entries (node) | |||
| 1174 | 1174 | ||
| 1175 | if (emacs_tags_format) | 1175 | if (emacs_tags_format) |
| 1176 | { | 1176 | { |
| 1177 | if (node->rewritten) | 1177 | if (node->named) |
| 1178 | { | 1178 | { |
| 1179 | fprintf (outf, "%s\177%s\001%d,%d\n", | 1179 | fprintf (outf, "%s\177%s\001%d,%d\n", |
| 1180 | node->pat, node->name, | 1180 | node->pat, node->name, |
| @@ -1259,7 +1259,7 @@ total_size_of_entries (node) | |||
| 1259 | /* Count this entry */ | 1259 | /* Count this entry */ |
| 1260 | total += strlen (node->pat) + 1; | 1260 | total += strlen (node->pat) + 1; |
| 1261 | total += number_len ((long) node->lno) + 1 + number_len (node->cno) + 1; | 1261 | total += number_len ((long) node->lno) + 1 + number_len (node->cno) + 1; |
| 1262 | if (node->rewritten) | 1262 | if (node->named) |
| 1263 | total += 1 + strlen (node->name); /* \001name */ | 1263 | total += 1 + strlen (node->name); /* \001name */ |
| 1264 | } | 1264 | } |
| 1265 | 1265 | ||
| @@ -1436,9 +1436,9 @@ do { \ | |||
| 1436 | definedef = dnone; \ | 1436 | definedef = dnone; \ |
| 1437 | } while (FALSE) | 1437 | } while (FALSE) |
| 1438 | 1438 | ||
| 1439 | #define MAKE_TAG_FROM_NEW_LB(isfun) pfnote (tokb, isfun, tok.rewritten, \ | 1439 | #define MAKE_TAG_FROM_NEW_LB(isfun) pfnote (nameb, isfun, tok.named, \ |
| 1440 | newlb.buffer, tokoff + toklen + 1, tok.lineno, GET_CHARNO (newlinepos)) | 1440 | newlb.buffer, tokoff + toklen + 1, tok.lineno, GET_CHARNO (newlinepos)) |
| 1441 | #define MAKE_TAG_FROM_OTH_LB(isfun) pfnote (tokb, isfun, tok.rewritten, \ | 1441 | #define MAKE_TAG_FROM_OTH_LB(isfun) pfnote (nameb, isfun, tok.named, \ |
| 1442 | othlb.buffer, tokoff + toklen + 1, tok.lineno, GET_CHARNO (othlinepos)) | 1442 | othlb.buffer, tokoff + toklen + 1, tok.lineno, GET_CHARNO (othlinepos)) |
| 1443 | 1443 | ||
| 1444 | void | 1444 | void |
| @@ -1449,7 +1449,7 @@ C_entries (c_ext) | |||
| 1449 | register char *lp; /* pointer one beyond the character `c' */ | 1449 | register char *lp; /* pointer one beyond the character `c' */ |
| 1450 | int curndx, newndx; /* indices for current and new lb */ | 1450 | int curndx, newndx; /* indices for current and new lb */ |
| 1451 | TOKEN tok; /* latest token read for funcdef & structdef */ | 1451 | TOKEN tok; /* latest token read for funcdef & structdef */ |
| 1452 | char tokb[BUFSIZ]; /* latest token name for funcdef & structdef */ | 1452 | char nameb[BUFSIZ]; /* latest token name for funcdef & structdef */ |
| 1453 | register int tokoff; /* offset in line of start of latest token */ | 1453 | register int tokoff; /* offset in line of start of latest token */ |
| 1454 | register int toklen; /* length of latest token */ | 1454 | register int toklen; /* length of latest token */ |
| 1455 | int cblev; /* current curly brace level */ | 1455 | int cblev; /* current curly brace level */ |
| @@ -1590,30 +1590,36 @@ C_entries (c_ext) | |||
| 1590 | } | 1590 | } |
| 1591 | else | 1591 | else |
| 1592 | { | 1592 | { |
| 1593 | logical is_func; | 1593 | logical is_func = FALSE; |
| 1594 | 1594 | ||
| 1595 | tok.lineno = lineno; | 1595 | tok.lineno = lineno; |
| 1596 | tok.p = newlb.buffer + tokoff; | 1596 | tok.p = newlb.buffer + tokoff; |
| 1597 | tok.len = toklen; | 1597 | tok.len = toklen; |
| 1598 | tok.rewritten = FALSE; | 1598 | tok.named = FALSE; |
| 1599 | if (yacc_rules | 1599 | if (yacc_rules |
| 1600 | || consider_token (c, lp, &tok, | 1600 | || consider_token (c, lp, &tok, |
| 1601 | c_ext, cblev, &is_func)) | 1601 | c_ext, cblev, &is_func)) |
| 1602 | { | 1602 | { |
| 1603 | if (structdef == sinbody | 1603 | if (structdef == sinbody |
| 1604 | && definedef == dnone && is_func) | 1604 | && definedef == dnone |
| 1605 | { /* function defined in C++ class body */ | 1605 | && is_func) |
| 1606 | sprintf (tokb, "%s::%.*s", | 1606 | /* function defined in C++ class body */ |
| 1607 | { | ||
| 1608 | tok.named = TRUE; | ||
| 1609 | sprintf (nameb, "%s::%.*s", | ||
| 1607 | ((structtag[0] == '\0') | 1610 | ((structtag[0] == '\0') |
| 1608 | ? "_anonymous_" : structtag), | 1611 | ? "_anonymous_" : structtag), |
| 1609 | tok.len, tok.p); | 1612 | tok.len, tok.p); |
| 1610 | tok.rewritten = TRUE; | ||
| 1611 | } | 1613 | } |
| 1612 | else | 1614 | else |
| 1613 | { | 1615 | { |
| 1614 | sprintf (tokb, "%.*s", tok.len, tok.p); | 1616 | sprintf (nameb, "%.*s", tok.len, tok.p); |
| 1615 | } | 1617 | } |
| 1616 | 1618 | ||
| 1619 | if (structdef == stagseen | ||
| 1620 | || typdef == tend) | ||
| 1621 | tok.named = TRUE; | ||
| 1622 | |||
| 1617 | if (funcdef == ftagseen | 1623 | if (funcdef == ftagseen |
| 1618 | || structdef == stagseen | 1624 | || structdef == stagseen |
| 1619 | || typdef == tend) | 1625 | || typdef == tend) |
| @@ -1796,8 +1802,6 @@ consider_token (c, lp, tokp, c_ext, cblev, is_func) | |||
| 1796 | Stab_entry *tokse = stab_find (get_C_stab (c_ext), tokp->p, tokp->len); | 1802 | Stab_entry *tokse = stab_find (get_C_stab (c_ext), tokp->p, tokp->len); |
| 1797 | enum sym_type toktype = stab_type (tokse); | 1803 | enum sym_type toktype = stab_type (tokse); |
| 1798 | 1804 | ||
| 1799 | *is_func = FALSE; /* not a function */ | ||
| 1800 | |||
| 1801 | /* | 1805 | /* |
| 1802 | * Advance the definedef state machine. | 1806 | * Advance the definedef state machine. |
| 1803 | */ | 1807 | */ |