annotate lib-src/etags.c @ 35741:e0acf4b43873

(assert) [__MINGW32__]: Redefine assert to work around a bug in the Mingw32 assert.h header file.
author Andrew Innes <andrewi@gnu.org>
date Tue, 30 Jan 2001 18:11:42 +0000
parents 9a7c0217c7bd
children aa069bbee4c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35653
96f71478797d Add a coding: tag.
Eli Zaretskii <eliz@gnu.org>
parents: 35574
diff changeset
1 /* Tags file maker to go with GNU Emacs -*- coding: latin-1 -*-
96f71478797d Add a coding: tag.
Eli Zaretskii <eliz@gnu.org>
parents: 35574
diff changeset
2 Copyright (C) 1984, 87, 88, 89, 93, 94, 95, 98, 99, 2000, 2001
11231
3cf67df24e7f Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 10990
diff changeset
3 Free Software Foundation, Inc. and Ken Arnold
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14144
diff changeset
4
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
5 This file is not considered part of GNU Emacs.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
7 This program is free software; you can redistribute it and/or modify
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
9 the Free Software Foundation; either version 2 of the License, or
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
10 (at your option) any later version.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
12 This program is distributed in the hope that it will be useful,
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 GNU General Public License for more details.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14144
diff changeset
18 along with this program; if not, write to the Free Software Foundation,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14144
diff changeset
19 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 * Authors:
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 * Ctags originally by Ken Arnold.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
24 * Fortran added by Jim Kleckner.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 * Ed Pelegri-Llopart added C typedefs.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 * Gnu Emacs TAGS format and modifications by RMS?
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
27 * 1989 Sam Kendall added C++.
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
28 * 1993 Francesco Potort́ reorganised C and C++ based on work by Joe Wells.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
29 * 1994 Regexp tags by Tom Tromey.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
30 * 2001 Nested classes by Francesco Potort́ based on work by Mykola Dzyuba.
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
31 *
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
32 * Francesco Potort́ <pot@gnu.org> has maintained it since 1993.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 */
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
34
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
35 char pot_etags_version[] = "@(#) pot revision number is 14.13";
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
36
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
37 #define TRUE 1
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
38 #define FALSE 0
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
39
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
40 #ifdef DEBUG
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
41 # undef DEBUG
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
42 # define DEBUG TRUE
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
43 #else
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
44 # define DEBUG FALSE
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
45 # define NDEBUG /* disable assert */
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
46 #endif
10754
cd1c0b5e8634 * etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents: 10623
diff changeset
47
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
48 #if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C))
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
49 # define P_(proto) proto
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
50 #else
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
51 # define P_(proto) ()
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
52 #endif
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
53
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
54 #ifdef HAVE_CONFIG_H
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
55 # include <config.h>
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
56 /* On some systems, Emacs defines static as nothing for the sake
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
57 of unexec. We don't want that here since we don't use unexec. */
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
58 # undef static
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
59 # define ETAGS_REGEXPS /* use the regexp features */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
60 # define LONG_OPTIONS /* accept long options */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
61 #endif /* HAVE_CONFIG_H */
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
62
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
63 #ifndef _GNU_SOURCE
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
64 # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
65 #endif
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
66
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
67 /* WIN32_NATIVE is for Xemacs.
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
68 MSDOS, WINDOWSNT, DOS_NT are for Emacs. */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
69 #ifdef WIN32_NATIVE
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
70 # undef MSDOS
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
71 # undef WINDOWSNT
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
72 # define WINDOWSNT
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
73 #endif /* WIN32_NATIVE */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
74
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
75 #ifdef MSDOS
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
76 # undef MSDOS
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
77 # define MSDOS TRUE
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
78 # include <fcntl.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
79 # include <sys/param.h>
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
80 # include <io.h>
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
81 # ifndef HAVE_CONFIG_H
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
82 # define DOS_NT
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
83 # include <sys/config.h>
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
84 # endif
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
85 #else
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
86 # define MSDOS FALSE
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
87 #endif /* MSDOS */
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
88
9773
bd49556a7552 (main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 9635
diff changeset
89 #ifdef WINDOWSNT
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
90 # include <stdlib.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
91 # include <fcntl.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
92 # include <string.h>
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
93 # include <direct.h>
14982
b470e33ce4a9 [WINDOWSNT]: Include io.h.
Richard M. Stallman <rms@gnu.org>
parents: 14924
diff changeset
94 # include <io.h>
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
95 # define MAXPATHLEN _MAX_PATH
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
96 # undef HAVE_NTGUI
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
97 # undef DOS_NT
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
98 # define DOS_NT
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
99 # ifndef HAVE_GETCWD
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
100 # define HAVE_GETCWD
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
101 # endif /* undef HAVE_GETCWD */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
102 #else /* !WINDOWSNT */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
103 # ifdef STDC_HEADERS
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
104 # include <stdlib.h>
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
105 # include <string.h>
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
106 # else
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
107 extern char *getenv ();
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
108 # endif
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
109 #endif /* !WINDOWSNT */
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
110
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
111 #ifdef HAVE_UNISTD_H
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
112 # include <unistd.h>
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
113 #else
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
114 # if defined (HAVE_GETCWD) && !defined (WINDOWSNT)
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
115 extern char *getcwd (char *buf, size_t size);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
116 # endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
117 #endif /* HAVE_UNISTD_H */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
118
3921
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
119 #include <stdio.h>
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
120 #include <ctype.h>
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
121 #include <errno.h>
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
122 #ifndef errno
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
123 extern int errno;
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
124 #endif
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
125 #include <assert.h>
3921
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
126 #include <sys/types.h>
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
127 #include <sys/stat.h>
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
128
35741
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
129 /* Work around bug in Mingw assert.h. */
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
130 #if defined (__MINGW32__) && defined(NDEBUG) && defined (assert)
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
131 #undef assert
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
132 #define assert(x) ((void) 0)
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
133 #endif
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
134
4804
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
135 #if !defined (S_ISREG) && defined (S_IFREG)
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
136 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
137 #endif
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
138
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
139 #ifdef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
140 # include <getopt.h>
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
141 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
142 # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
143 extern char *optarg;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
144 extern int optind, opterr;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
145 #endif /* LONG_OPTIONS */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
146
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
147 #ifdef ETAGS_REGEXPS
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
148 # include <regex.h>
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
149 #endif /* ETAGS_REGEXPS */
3921
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
150
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
151 /* Define CTAGS to make the program "ctags" compatible with the usual one.
17168
53314a257690 * etags.c (add_regex): reset *putbuf before using it.
Francesco Potortì <pot@gnu.org>
parents: 16733
diff changeset
152 Leave it undefined to make the program "etags", which makes emacs-style
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
153 tag tables and tags typedefs, #defines and struct/union/enum by default. */
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
154 #ifdef CTAGS
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
155 # undef CTAGS
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
156 # define CTAGS TRUE
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
157 #else
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
158 # define CTAGS FALSE
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 #endif
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 /* Exit codes for success and failure. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 #ifdef VMS
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
163 # define GOOD 1
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
164 # define BAD 0
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 #else
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
166 # define GOOD 0
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
167 # define BAD 1
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 #endif
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
170 #define streq(s,t) (assert((s)!=NULL || (t)!=NULL), !strcmp (s, t))
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
171 #define strneq(s,t,n) (assert((s)!=NULL || (t)!=NULL), !strncmp (s, t, n))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
173 #define CHARS 256 /* 2^sizeof(char) */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
174 #define CHAR(x) ((unsigned int)(x) & (CHARS - 1))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
175 #define iswhite(c) (_wht[CHAR(c)]) /* c is white */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
176 #define notinname(c) (_nin[CHAR(c)]) /* c is not in a name */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
177 #define begtoken(c) (_btk[CHAR(c)]) /* c can start token */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
178 #define intoken(c) (_itk[CHAR(c)]) /* c can be in token */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
179 #define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
181 #define ISALNUM(c) isalnum (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
182 #define ISALPHA(c) isalpha (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
183 #define ISDIGIT(c) isdigit (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
184 #define ISLOWER(c) islower (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
185
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
186 #define lowcase(c) tolower (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
187 #define upcase(c) toupper (CHAR(c))
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
188
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
189
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
190 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
191 * xnew, xrnew -- allocate, reallocate storage
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
192 *
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
193 * SYNOPSIS: Type *xnew (int n, Type);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
194 * void xrnew (OldPointer, int n, Type);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
195 */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
196 #if DEBUG
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
197 # include "chkmalloc.h"
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
198 # define xnew(n,Type) ((Type *) trace_malloc (__FILE__, __LINE__, \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
199 (n) * sizeof (Type)))
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
200 # define xrnew(op,n,Type) ((op) = (Type *) trace_realloc (__FILE__, __LINE__, \
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
201 (char *) (op), (n) * sizeof (Type)))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
202 #else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
203 # define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type)))
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
204 # define xrnew(op,n,Type) ((op) = (Type *) xrealloc ( \
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
205 (char *) (op), (n) * sizeof (Type)))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
206 #endif
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
208 typedef int bool;
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
209
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
210 typedef void Lang_function P_((FILE *));
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
211
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
212 typedef struct
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
213 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
214 char *suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
215 char *command; /* Takes one arg and decompresses to stdout */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
216 } compressor;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
217
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
218 typedef struct
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
219 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
220 char *name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
221 Lang_function *function;
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
222 char **filenames;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
223 char **suffixes;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
224 char **interpreters;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
225 } language;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
226
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
227 typedef struct node_st
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
228 { /* sorting structure */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
229 char *name; /* function or type name */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
230 char *file; /* file name */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
231 bool is_func; /* use pattern or line no */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
232 bool been_warned; /* set if noticed dup */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
233 int lno; /* line number tag is on */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
234 long cno; /* character number line starts on */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
235 char *pat; /* search pattern */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
236 struct node_st *left, *right; /* left and right sons */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
237 } node;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
238
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
239 /*
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
240 * A `linebuffer' is a structure which holds a line of text.
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
241 * `readline_internal' reads a line from a stream into a linebuffer
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
242 * and works regardless of the length of the line.
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
243 * SIZE is the size of BUFFER, LEN is the length of the string in
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
244 * BUFFER after readline reads it.
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
245 */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
246 typedef struct
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
247 {
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
248 long size;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
249 int len;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
250 char *buffer;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
251 } linebuffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
253 /* Many compilers barf on this:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
254 Lang_function Ada_funcs;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
255 so let's write it this way */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
256 static void Ada_funcs P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
257 static void Asm_labels P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
258 static void C_entries P_((int c_ext, FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
259 static void default_C_entries P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
260 static void plain_C_entries P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
261 static void Cjava_entries P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
262 static void Cobol_paragraphs P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
263 static void Cplusplus_entries P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
264 static void Cstar_entries P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
265 static void Erlang_functions P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
266 static void Fortran_functions P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
267 static void Yacc_entries P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
268 static void Lisp_functions P_((FILE *));
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
269 static void Makefile_targets P_((FILE *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
270 static void Pascal_functions P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
271 static void Perl_functions P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
272 static void Postscript_functions P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
273 static void Prolog_functions P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
274 static void Python_functions P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
275 static void Scheme_functions P_((FILE *));
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
276 static void TeX_commands P_((FILE *));
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
277 static void Texinfo_nodes P_((FILE *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
278 static void just_read_file P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
279
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
280 static void print_language_names P_((void));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
281 static void print_version P_((void));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
282 static void print_help P_((void));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
283 int main P_((int, char **));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
284 static int number_len P_((long));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
285
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
286 static compressor *get_compressor_from_suffix P_((char *, char **));
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
287 static language *get_language_from_langname P_((char *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
288 static language *get_language_from_interpreter P_((char *));
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
289 static language *get_language_from_filename P_((char *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
290 static int total_size_of_entries P_((node *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
291 static long readline P_((linebuffer *, FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
292 static long readline_internal P_((linebuffer *, FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
293 static void get_tag P_((char *));
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
294
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
295 #ifdef ETAGS_REGEXPS
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
296 static void analyse_regex P_((char *, bool));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
297 static void add_regex P_((char *, bool, language *));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
298 static void free_patterns P_((void));
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
299 #endif /* ETAGS_REGEXPS */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
300 static void error P_((const char *, const char *));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
301 static void suggest_asking_for_help P_((void));
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
302 void fatal P_((char *, char *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
303 static void pfatal P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
304 static void add_node P_((node *, node **));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
305
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
306 static void init P_((void));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
307 static void initbuffer P_((linebuffer *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
308 static void find_entries P_((char *, FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
309 static void free_tree P_((node *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
310 static void pfnote P_((char *, bool, char *, int, int, long));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
311 static void new_pfnote P_((char *, int, bool, char *, int, int, long));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
312 static void process_file P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
313 static void put_entries P_((node *));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
314 static void takeprec P_((void));
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
315
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
316 static char *concat P_((char *, char *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
317 static char *skip_spaces P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
318 static char *skip_non_spaces P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
319 static char *savenstr P_((char *, int));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
320 static char *savestr P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
321 static char *etags_strchr P_((const char *, int));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
322 static char *etags_strrchr P_((const char *, int));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
323 static char *etags_getcwd P_((void));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
324 static char *relative_filename P_((char *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
325 static char *absolute_filename P_((char *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
326 static char *absolute_dirname P_((char *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
327 static bool filename_is_absolute P_((char *f));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
328 static void canonicalize_filename P_((char *));
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
329 static void linebuffer_setlen P_((linebuffer *, int));
30231
5b3608e3adaf (xmalloc, xrealloc): Make externally visible, for use
Gerd Moellmann <gerd@gnu.org>
parents: 28663
diff changeset
330 long *xmalloc P_((unsigned int));
5b3608e3adaf (xmalloc, xrealloc): Make externally visible, for use
Gerd Moellmann <gerd@gnu.org>
parents: 28663
diff changeset
331 long *xrealloc P_((char *, unsigned int));
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
332
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
333
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
334 char searchar = '/'; /* use /.../ searches */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
335
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
336 char *tagfile; /* output file */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
337 char *progname; /* name this program was invoked with */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
338 char *cwd; /* current working directory */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
339 char *tagfiledir; /* directory of tagfile */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
340 FILE *tagf; /* ioptr for tags file */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
341
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
342 char *curfile; /* current input file name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
343 language *curlang; /* current language */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
344
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
345 int lineno; /* line number of current line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
346 long charno; /* current character number */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
347 long linecharno; /* charno of start of current line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
348 char *dbp; /* pointer to start of current tag */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
349
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
350 node *head; /* the head of the binary tree of tags */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
352 linebuffer lb; /* the current line */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
353
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
354 /* boolean "functions" (see init) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
355 bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
356 char
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
357 /* white chars */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
358 *white = " \f\t\n\r\v",
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
359 /* not in a name */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
360 *nonam = " \f\t\n\r(=,[;",
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
361 /* token ending chars */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
362 *endtk = " \t\n\r\"'#()[]{}=-+%*/&|^~!<>;,.:?",
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
363 /* token starting chars */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
364 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~@",
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
365 /* valid in-token chars */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
366 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789";
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
367
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
368 bool append_to_tagfile; /* -a: append to tags */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
369 /* The following four default to TRUE for etags, but to FALSE for ctags. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
370 bool typedefs; /* -t: create tags for C and Ada typedefs */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
371 bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 /* 0 struct/enum/union decls, and C++ */
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
373 /* member functions. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
374 bool constantypedefs; /* -d: create tags for C #define, enum */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
375 /* constants and variables. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 /* -D: opposite of -d. Default under ctags. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
377 bool declarations; /* --declarations: tag them and extern in C&Co*/
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
378 bool globals; /* create tags for global variables */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
379 bool members; /* create tags for C member variables */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
380 bool update; /* -u: update tags */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
381 bool vgrind_style; /* -v: create vgrind style index output */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
382 bool no_warnings; /* -w: suppress warnings */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
383 bool cxref_style; /* -x: create cxref style output */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
384 bool cplusplus; /* .[hc] means C++, not C */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
385 bool noindentypedefs; /* -I: ignore indentation in C */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
386 bool packages_only; /* --packages-only: in Ada, only tag packages*/
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
387
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
388 #ifdef LONG_OPTIONS
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
389 struct option longopts[] =
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
390 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
391 { "packages-only", no_argument, &packages_only, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
392 { "append", no_argument, NULL, 'a' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
393 { "backward-search", no_argument, NULL, 'B' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
394 { "c++", no_argument, NULL, 'C' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
395 { "cxref", no_argument, NULL, 'x' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
396 { "defines", no_argument, NULL, 'd' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
397 { "declarations", no_argument, &declarations, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
398 { "no-defines", no_argument, NULL, 'D' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
399 { "globals", no_argument, &globals, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
400 { "no-globals", no_argument, &globals, FALSE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
401 { "help", no_argument, NULL, 'h' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
402 { "help", no_argument, NULL, 'H' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
403 { "ignore-indentation", no_argument, NULL, 'I' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
404 { "include", required_argument, NULL, 'i' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
405 { "language", required_argument, NULL, 'l' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
406 { "members", no_argument, &members, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
407 { "no-members", no_argument, &members, FALSE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
408 { "no-warn", no_argument, NULL, 'w' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
409 { "output", required_argument, NULL, 'o' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
410 #ifdef ETAGS_REGEXPS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
411 { "regex", required_argument, NULL, 'r' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
412 { "no-regex", no_argument, NULL, 'R' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
413 { "ignore-case-regex", required_argument, NULL, 'c' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
414 #endif /* ETAGS_REGEXPS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
415 { "typedefs", no_argument, NULL, 't' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
416 { "typedefs-and-c++", no_argument, NULL, 'T' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
417 { "update", no_argument, NULL, 'u' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
418 { "version", no_argument, NULL, 'V' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
419 { "vgrind", no_argument, NULL, 'v' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
420 { NULL }
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
421 };
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
422 #endif /* LONG_OPTIONS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
423
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
424 #ifdef ETAGS_REGEXPS
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
425 /* Structure defining a regular expression. Elements are
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
426 the compiled pattern, and the name string. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
427 typedef struct pattern
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
428 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
429 struct pattern *p_next;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
430 language *language;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
431 char *regex;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
432 struct re_pattern_buffer *pattern;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
433 struct re_registers regs;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
434 char *name_pattern;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
435 bool error_signaled;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
436 } pattern;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
437
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
438 /* List of all regexps. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
439 pattern *p_head = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
440
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
441 /* How many characters in the character set. (From regex.c.) */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
442 #define CHAR_SET_SIZE 256
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
443 /* Translation table for case-insensitive matching. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
444 char lc_trans[CHAR_SET_SIZE];
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
445 #endif /* ETAGS_REGEXPS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
446
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
447 compressor compressors[] =
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
448 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
449 { "z", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
450 { "Z", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
451 { "gz", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
452 { "GZ", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
453 { "bz2", "bzip2 -d -c" },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
454 { NULL }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
455 };
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
456
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
457 /*
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
458 * Language stuff.
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
459 */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
460
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
461 /* Non-NULL if language fixed. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
462 language *forced_lang = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
463
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
464 /* Ada code */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
465 char *Ada_suffixes [] =
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
466 { "ads", "adb", "ada", NULL };
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
467
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
468 /* Assembly code */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
469 char *Asm_suffixes [] = { "a", /* Unix assembler */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
470 "asm", /* Microcontroller assembly */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
471 "def", /* BSO/Tasking definition includes */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
472 "inc", /* Microcontroller include files */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
473 "ins", /* Microcontroller include files */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
474 "s", "sa", /* Unix assembler */
19185
77910f9661a9 (Yacc_suffixes, Asm_suffixes): Add some alternatives.
Richard M. Stallman <rms@gnu.org>
parents: 18881
diff changeset
475 "S", /* cpp-processed Unix assembler */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
476 "src", /* BSO/Tasking C compiler output */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
477 NULL
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
478 };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
479
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
480 /* Note that .c and .h can be considered C++, if the --c++ flag was
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
481 given, or if the `class' keyowrd is met inside the file.
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
482 That is why default_C_entries is called for these. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
483 char *default_C_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
484 { "c", "h", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
485
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
486 char *Cplusplus_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
487 { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
488 "M", /* Objective C++ */
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
489 "pdb", /* Postscript with C syntax */
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
490 NULL };
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
491
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
492 char *Cjava_suffixes [] =
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
493 { "java", NULL };
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
494
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
495 char *Cobol_suffixes [] =
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
496 { "COB", "cob", NULL };
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
497
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
498 char *Cstar_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
499 { "cs", "hs", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
500
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
501 char *Erlang_suffixes [] =
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
502 { "erl", "hrl", NULL };
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
503
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
504 char *Fortran_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
505 { "F", "f", "f90", "for", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
506
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
507 char *Lisp_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
508 { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
509
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
510 char *Makefile_filenames [] =
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
511 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
512
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
513 char *Pascal_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
514 { "p", "pas", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
515
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
516 char *Perl_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
517 { "pl", "pm", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
518 char *Perl_interpreters [] =
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
519 { "perl", "@PERL@", NULL };
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
520
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
521 char *plain_C_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
522 { "lm", /* Objective lex file */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
523 "m", /* Objective C file */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
524 "pc", /* Pro*C file */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
525 NULL };
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
526
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
527 char *Postscript_suffixes [] =
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
528 { "ps", "psw", NULL }; /* .psw is for PSWrap */
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
529
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
530 char *Prolog_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
531 { "prolog", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
532
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
533 char *Python_suffixes [] =
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
534 { "py", NULL };
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
535
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
536 /* Can't do the `SCM' or `scm' prefix with a version number. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
537 char *Scheme_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
538 { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
539
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
540 char *TeX_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
541 { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
542
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
543 char *Texinfo_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
544 { "texi", "texinfo", "txi", NULL };
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
545
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
546 char *Yacc_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
547 { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
548
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
549 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
550 * Table of languages.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
551 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
552 * It is ok for a given function to be listed under more than one
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
553 * name. I just didn't.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
554 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
555
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
556 language lang_names [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
557 {
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
558 { "ada", Ada_funcs, NULL, Ada_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
559 { "asm", Asm_labels, NULL, Asm_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
560 { "c", default_C_entries, NULL, default_C_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
561 { "c++", Cplusplus_entries, NULL, Cplusplus_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
562 { "c*", Cstar_entries, NULL, Cstar_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
563 { "cobol", Cobol_paragraphs, NULL, Cobol_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
564 { "erlang", Erlang_functions, NULL, Erlang_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
565 { "fortran", Fortran_functions, NULL, Fortran_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
566 { "java", Cjava_entries, NULL, Cjava_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
567 { "lisp", Lisp_functions, NULL, Lisp_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
568 { "makefile", Makefile_targets, Makefile_filenames, NULL, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
569 { "pascal", Pascal_functions, NULL, Pascal_suffixes, NULL },
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
570 { "perl", Perl_functions, NULL, Perl_suffixes, Perl_interpreters },
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
571 { "postscript", Postscript_functions, NULL, Postscript_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
572 { "proc", plain_C_entries, NULL, plain_C_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
573 { "prolog", Prolog_functions, NULL, Prolog_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
574 { "python", Python_functions, NULL, Python_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
575 { "scheme", Scheme_functions, NULL, Scheme_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
576 { "tex", TeX_commands, NULL, TeX_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
577 { "texinfo", Texinfo_nodes, NULL, Texinfo_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
578 { "yacc", Yacc_entries, NULL, Yacc_suffixes, NULL },
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
579 { "auto", NULL }, /* default guessing scheme */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
580 { "none", just_read_file }, /* regexp matching only */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
581 { NULL, NULL } /* end of list */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
582 };
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
583
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
585 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
586 print_language_names ()
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
587 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
588 language *lang;
35302
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
589 char **name, **ext;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
590
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
591 puts ("\nThese are the currently supported languages, along with the\n\
35302
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
592 default file names and dot suffixes:");
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
593 for (lang = lang_names; lang->name != NULL; lang++)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
594 {
35302
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
595 printf (" %-*s", 10, lang->name);
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
596 if (lang->filenames != NULL)
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
597 for (name = lang->filenames; *name != NULL; name++)
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
598 printf (" %s", *name);
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
599 if (lang->suffixes != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
600 for (ext = lang->suffixes; *ext != NULL; ext++)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
601 printf (" .%s", *ext);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
602 puts ("");
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
603 }
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
604 puts ("Where `auto' means use default language for files based on file\n\
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
605 name suffix, and `none' means only do regexp processing on files.\n\
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
606 If no language is specified and no matching suffix is found,\n\
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
607 the first line of the file is read for a sharp-bang (#!) sequence\n\
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
608 followed by the name of an interpreter. If no such sequence is found,\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
609 Fortran is tried first; if no tags are found, C is tried next.\n\
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
610 When parsing any C file, a \"class\" keyword switches to C++.\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
611 Compressed files are supported using gzip and bzip2.");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
612 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
613
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
614 #ifndef EMACS_NAME
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
615 # define EMACS_NAME "GNU Emacs"
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
616 #endif
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
617 #ifndef VERSION
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
618 # define VERSION "21"
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
619 #endif
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
620 static void
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
621 print_version ()
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
622 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
623 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
624 puts ("Copyright (C) 1999 Free Software Foundation, Inc. and Ken Arnold");
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
625 puts ("This program is distributed under the same terms as Emacs");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
626
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
627 exit (GOOD);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
628 }
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
629
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
630 static void
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
631 print_help ()
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
632 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
633 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
634 \n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
635 These are the options accepted by %s.\n", progname, progname);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
636 #ifdef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
637 puts ("You may use unambiguous abbreviations for the long option names.");
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
638 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
639 puts ("Long option names do not work with this executable, as it is not\n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
640 linked with GNU getopt.");
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
641 #endif /* LONG_OPTIONS */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
642 puts ("A - as file name means read names from stdin (one per line).");
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
643 if (!CTAGS)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
644 printf (" Absolute names are stored in the output file as they are.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
645 Relative ones are stored relative to the output file's directory.");
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
646 puts ("\n");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
647
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
648 puts ("-a, --append\n\
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
649 Append tag entries to existing tags file.");
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
650
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
651 puts ("--packages-only\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
652 For Ada files, only generate tags for packages .");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
653
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
654 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
655 puts ("-B, --backward-search\n\
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
656 Write the search commands for the tag entries using '?', the\n\
6945
63ab519f7057 * etags.c (main, print_help): eliminate the -F option.
Francesco Potortì <pot@gnu.org>
parents: 6944
diff changeset
657 backward-search command instead of '/', the forward-search command.");
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
658
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
659 /* This option is mostly obsolete, because etags can now automatically
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
660 detect C++. Retained for backward compatibility and for debugging and
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
661 experimentation. In principle, we could want to tag as C++ even
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
662 before any "class" keyword.
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
663 puts ("-C, --c++\n\
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
664 Treat files whose name suffix defaults to C language as C++ files.");
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
665 */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
666
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
667 puts ("--declarations\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
668 In C and derived languages, create tags for function declarations,");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
669 if (CTAGS)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
670 puts ("\tand create tags for extern variables if --globals is used.");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
671 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
672 puts
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
673 ("\tand create tags for extern variables unless --no-globals is used.");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
674
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
675 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
676 puts ("-d, --defines\n\
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
677 Create tag entries for C #define constants and enum constants, too.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
678 else
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
679 puts ("-D, --no-defines\n\
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
680 Don't create tag entries for C #define constants and enum constants.\n\
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
681 This makes the tags file smaller.");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
682
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
683 if (!CTAGS)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
684 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
685 puts ("-i FILE, --include=FILE\n\
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
686 Include a note in tag file indicating that, when searching for\n\
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
687 a tag, one should also consult the tags file FILE after\n\
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
688 checking the current file.");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
689 puts ("-l LANG, --language=LANG\n\
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
690 Force the following files to be considered as written in the\n\
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
691 named language up to the next --language=LANG option.");
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
692 }
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
693
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
694 if (CTAGS)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
695 puts ("--globals\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
696 Create tag entries for global variables in some languages.");
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
697 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
698 puts ("--no-globals\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
699 Do not create tag entries for global variables in some\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
700 languages. This makes the tags file smaller.");
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
701 puts ("--members\n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
702 Create tag entries for member variables in C and derived languages.");
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
703
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
704 #ifdef ETAGS_REGEXPS
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
705 puts ("-r /REGEXP/, --regex=/REGEXP/ or --regex=@regexfile\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
706 Make a tag for each line matching pattern REGEXP in the following\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
707 files. {LANGUAGE}/REGEXP/ uses REGEXP for LANGUAGE files only.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
708 regexfile is a file containing one REGEXP per line.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
709 REGEXP is anchored (as if preceded by ^).\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
710 The form /REGEXP/NAME/ creates a named tag.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
711 For example Tcl named tags can be created with:\n\
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
712 --regex=/proc[ \\t]+\\([^ \\t]+\\)/\\1/.");
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
713 puts ("-c /REGEXP/, --ignore-case-regex=/REGEXP/ or --ignore-case-regex=@regexfile\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
714 Like -r, --regex but ignore case when matching expressions.");
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
715 puts ("-R, --no-regex\n\
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
716 Don't create tags from regexps for the following files.");
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
717 #endif /* ETAGS_REGEXPS */
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
718 puts ("-o FILE, --output=FILE\n\
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
719 Write the tags to FILE.");
10449
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
720 puts ("-I, --ignore-indentation\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
721 Don't rely on indentation quite as much as normal. Currently,\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
722 this means not to assume that a closing brace in the first\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
723 column is the final brace of a function or structure\n\
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
724 definition in C and C++.");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
725
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
726 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
727 {
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
728 puts ("-t, --typedefs\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
729 Generate tag entries for C and Ada typedefs.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
730 puts ("-T, --typedefs-and-c++\n\
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
731 Generate tag entries for C typedefs, C struct/enum/union tags,\n\
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
732 and C++ member functions.");
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
733 puts ("-u, --update\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
734 Update the tag entries for the given files, leaving tag\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
735 entries for other files in place. Currently, this is\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
736 implemented by deleting the existing entries for the given\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
737 files and then rewriting the new entries at the end of the\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
738 tags file. It is often faster to simply rebuild the entire\n\
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
739 tag file than to use this.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
740 puts ("-v, --vgrind\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
741 Generates an index of items intended for human consumption,\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
742 similar to the output of vgrind. The index is sorted, and\n\
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
743 gives the page number of each item.");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
744 puts ("-w, --no-warn\n\
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
745 Suppress warning messages about entries defined in multiple\n\
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
746 files.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
747 puts ("-x, --cxref\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
748 Like --vgrind, but in the style of cxref, rather than vgrind.\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
749 The output uses line numbers instead of page numbers, but\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
750 beyond that the differences are cosmetic; try both to see\n\
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
751 which you like.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
752 }
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
753
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
754 puts ("-V, --version\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
755 Print the version of the program.\n\
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
756 -h, --help\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
757 Print this help message.");
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
758
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
759 print_language_names ();
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
760
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
761 puts ("");
26323
98d99afb5ffb * etags.c (print_help): Change email address to send bugs to.
Gerd Moellmann <gerd@gnu.org>
parents: 26262
diff changeset
762 puts ("Report bugs to bug-gnu-emacs@gnu.org");
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
763
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
764 exit (GOOD);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
765 }
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
766
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
767
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
768 enum argument_type
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
769 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
770 at_language,
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
771 at_regexp,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
772 at_filename,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
773 at_icregexp
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
774 };
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
775
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
776 /* This structure helps us allow mixing of --lang and file names. */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
777 typedef struct
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
778 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
779 enum argument_type arg_type;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
780 char *what;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
781 language *lang; /* language of the regexp */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
782 } argument;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
783
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
784 #ifdef VMS /* VMS specific functions */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
785
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
786 #define EOS '\0'
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
787
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
788 /* This is a BUG! ANY arbitrary limit is a BUG!
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
789 Won't someone please fix this? */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
790 #define MAX_FILE_SPEC_LEN 255
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
791 typedef struct {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
792 short curlen;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
793 char body[MAX_FILE_SPEC_LEN + 1];
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
794 } vspec;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
795
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
796 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
797 v1.05 nmm 26-Jun-86 fn_exp - expand specification of list of file names
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
798 returning in each successive call the next file name matching the input
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
799 spec. The function expects that each in_spec passed
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
800 to it will be processed to completion; in particular, up to and
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
801 including the call following that in which the last matching name
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
802 is returned, the function ignores the value of in_spec, and will
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
803 only start processing a new spec with the following call.
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
804 If an error occurs, on return out_spec contains the value
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
805 of in_spec when the error occurred.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
806
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
807 With each successive file name returned in out_spec, the
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
808 function's return value is one. When there are no more matching
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
809 names the function returns zero. If on the first call no file
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
810 matches in_spec, or there is any other error, -1 is returned.
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
811 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
812
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
813 #include <rmsdef.h>
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
814 #include <descrip.h>
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
815 #define OUTSIZE MAX_FILE_SPEC_LEN
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
816 static short
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
817 fn_exp (out, in)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
818 vspec *out;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
819 char *in;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
820 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
821 static long context = 0;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
822 static struct dsc$descriptor_s o;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
823 static struct dsc$descriptor_s i;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
824 static bool pass1 = TRUE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
825 long status;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
826 short retval;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
827
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
828 if (pass1)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
829 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
830 pass1 = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
831 o.dsc$a_pointer = (char *) out;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
832 o.dsc$w_length = (short)OUTSIZE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
833 i.dsc$a_pointer = in;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
834 i.dsc$w_length = (short)strlen(in);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
835 i.dsc$b_dtype = DSC$K_DTYPE_T;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
836 i.dsc$b_class = DSC$K_CLASS_S;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
837 o.dsc$b_dtype = DSC$K_DTYPE_VT;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
838 o.dsc$b_class = DSC$K_CLASS_VS;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
839 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
840 if ((status = lib$find_file(&i, &o, &context, 0, 0)) == RMS$_NORMAL)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
841 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
842 out->body[out->curlen] = EOS;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
843 return 1;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
844 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
845 else if (status == RMS$_NMF)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
846 retval = 0;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
847 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
848 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
849 strcpy(out->body, in);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
850 retval = -1;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
851 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
852 lib$find_file_end(&context);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
853 pass1 = TRUE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
854 return retval;
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
855 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
856
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
857 /*
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
858 v1.01 nmm 19-Aug-85 gfnames - return in successive calls the
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
859 name of each file specified by the provided arg expanding wildcards.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
860 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
861 static char *
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
862 gfnames (arg, p_error)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
863 char *arg;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
864 bool *p_error;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
865 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
866 static vspec filename = {MAX_FILE_SPEC_LEN, "\0"};
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
867
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
868 switch (fn_exp (&filename, arg))
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
869 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
870 case 1:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
871 *p_error = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
872 return filename.body;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
873 case 0:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
874 *p_error = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
875 return NULL;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
876 default:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
877 *p_error = TRUE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
878 return filename.body;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
879 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
880 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
881
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
882 #ifndef OLD /* Newer versions of VMS do provide `system'. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
883 system (cmd)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
884 char *cmd;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
885 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
886 error ("%s", "system() function not implemented under VMS");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
887 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
888 #endif
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
889
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
890 #define VERSION_DELIM ';'
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
891 char *massage_name (s)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
892 char *s;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
893 {
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
894 char *start = s;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
895
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
896 for ( ; *s; s++)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
897 if (*s == VERSION_DELIM)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
898 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
899 *s = EOS;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
900 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
901 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
902 else
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
903 *s = lowcase (*s);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
904 return start;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
905 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
906 #endif /* VMS */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
907
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
908
15683
5f9426e991a3 Declare main as int, not void.
Karl Heuer <kwzh@gnu.org>
parents: 15579
diff changeset
909 int
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 main (argc, argv)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 int argc;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 char *argv[];
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 int i;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
915 unsigned int nincluded_files;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
916 char **included_files;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 char *this_file;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
918 argument *argbuffer;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
919 int current_arg, file_count;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
920 linebuffer filename_lb;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
921 #ifdef VMS
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
922 bool got_err;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923 #endif
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
924
9773
bd49556a7552 (main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 9635
diff changeset
925 #ifdef DOS_NT
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
926 _fmode = O_BINARY; /* all of files are treated as binary files */
9773
bd49556a7552 (main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 9635
diff changeset
927 #endif /* DOS_NT */
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
928
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 progname = argv[0];
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
930 nincluded_files = 0;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
931 included_files = xnew (argc, char *);
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
932 current_arg = 0;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
933 file_count = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
935 /* Allocate enough no matter what happens. Overkill, but each one
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
936 is small. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
937 argbuffer = xnew (argc, argument);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
938
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
939 #ifdef ETAGS_REGEXPS
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
940 /* Set syntax for regular expression routines. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
941 re_set_syntax (RE_SYNTAX_EMACS | RE_INTERVALS);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
942 /* Translation table for case-insensitive search. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
943 for (i = 0; i < CHAR_SET_SIZE; i++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
944 lc_trans[i] = lowcase (i);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
945 #endif /* ETAGS_REGEXPS */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
946
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 * If etags, always find typedefs and structure tags. Why not?
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
949 * Also default to find macro constants, enum constants and
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
950 * global variables.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
951 */
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
952 if (!CTAGS)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
953 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
954 typedefs = typedefs_or_cplusplus = constantypedefs = TRUE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
955 globals = TRUE;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
956 declarations = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
957 members = FALSE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
958 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
959
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
960 while (1)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
962 int opt;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
963 char *optstring;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
964
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
965 #ifdef ETAGS_REGEXPS
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
966 optstring = "-aCdDf:Il:o:r:c:RStTi:BuvxwVhH";
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
967 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
968 optstring = "-aCdDf:Il:o:StTi:BuvxwVhH";
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
969 #endif /* ETAGS_REGEXPS */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
970
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
971 #ifndef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
972 optstring = optstring + 1;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
973 #endif /* LONG_OPTIONS */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
974
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
975 opt = getopt_long (argc, argv, optstring, longopts, 0);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
976 if (opt == EOF)
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
977 break;
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
978
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
979 switch (opt)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
980 {
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
981 case 0:
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
982 /* If getopt returns 0, then it has already processed a
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
983 long-named option. We should do nothing. */
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
984 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
985
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
986 case 1:
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
987 /* This means that a file name has been seen. Record it. */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
988 argbuffer[current_arg].arg_type = at_filename;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
989 argbuffer[current_arg].what = optarg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
990 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
991 ++file_count;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
992 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
993
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
994 /* Common options. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
995 case 'a': append_to_tagfile = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
996 case 'C': cplusplus = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
997 case 'd': constantypedefs = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
998 case 'D': constantypedefs = FALSE; break;
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
999 case 'f': /* for compatibility with old makefiles */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1000 case 'o':
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1001 if (tagfile)
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1002 {
26507
aabdfbf65c68 1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26340
diff changeset
1003 error ("-o option may only be given once.", (char *)NULL);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1004 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1006 tagfile = optarg;
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1007 break;
10449
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
1008 case 'I':
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
1009 case 'S': /* for backward compatibility */
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
1010 noindentypedefs = TRUE;
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
1011 break;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1012 case 'l':
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1013 {
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1014 language *lang = get_language_from_langname (optarg);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1015 if (lang != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1016 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1017 argbuffer[current_arg].lang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1018 argbuffer[current_arg].arg_type = at_language;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1019 ++current_arg;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1020 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1021 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1022 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1023 #ifdef ETAGS_REGEXPS
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1024 case 'r':
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1025 argbuffer[current_arg].arg_type = at_regexp;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1026 argbuffer[current_arg].what = optarg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1027 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1028 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1029 case 'R':
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1030 argbuffer[current_arg].arg_type = at_regexp;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1031 argbuffer[current_arg].what = NULL;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1032 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1033 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1034 case 'c':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1035 argbuffer[current_arg].arg_type = at_icregexp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1036 argbuffer[current_arg].what = optarg;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1037 ++current_arg;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1038 break;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1039 #endif /* ETAGS_REGEXPS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1040 case 'V':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1041 print_version ();
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1042 break;
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
1043 case 'h':
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1044 case 'H':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1045 print_help ();
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1046 break;
8180
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
1047 case 't':
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1048 typedefs = TRUE;
8180
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
1049 break;
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
1050 case 'T':
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1051 typedefs = typedefs_or_cplusplus = TRUE;
8180
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
1052 break;
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1053 #if (!CTAGS)
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1054 /* Etags options */
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1055 case 'i':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1056 included_files[nincluded_files++] = optarg;
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1057 break;
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1058 #else /* CTAGS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1059 /* Ctags options. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1060 case 'B': searchar = '?'; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1061 case 'u': update = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1062 case 'v': vgrind_style = TRUE; /*FALLTHRU*/
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1063 case 'x': cxref_style = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1064 case 'w': no_warnings = TRUE; break;
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1065 #endif /* CTAGS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1066 default:
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1067 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1068 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1069 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1070
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1071 for (; optind < argc; ++optind)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1072 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1073 argbuffer[current_arg].arg_type = at_filename;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1074 argbuffer[current_arg].what = argv[optind];
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1075 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1076 ++file_count;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1077 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1078
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1079 if (nincluded_files == 0 && file_count == 0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1080 {
26507
aabdfbf65c68 1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26340
diff changeset
1081 error ("no input files specified.", (char *)NULL);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1082 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1083 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1084
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1085 if (tagfile == NULL)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
1086 tagfile = CTAGS ? "tags" : "TAGS";
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1087 cwd = etags_getcwd (); /* the current working directory */
15366
32ab7b623b9b (main): Copy cwd when appending slash.
Richard M. Stallman <rms@gnu.org>
parents: 15243
diff changeset
1088 if (cwd[strlen (cwd) - 1] != '/')
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1089 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1090 char *oldcwd = cwd;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1091 cwd = concat (oldcwd, "/", "");
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1092 free (oldcwd);
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1093 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1094 if (streq (tagfile, "-"))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
1095 tagfiledir = cwd;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1096 else
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
1097 tagfiledir = absolute_dirname (tagfile, cwd);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1098
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1099 init (); /* set up boolean "functions" */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1100
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101 initbuffer (&lb);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1102 initbuffer (&filename_lb);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1103
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1104 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1105 {
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1106 if (streq (tagfile, "-"))
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1107 {
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1108 tagf = stdout;
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1109 #ifdef DOS_NT
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1110 /* Switch redirected `stdout' to binary mode (setting `_fmode'
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
1111 doesn't take effect until after `stdout' is already open). */
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1112 if (!isatty (fileno (stdout)))
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1113 setmode (fileno (stdout), O_BINARY);
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1114 #endif /* DOS_NT */
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1115 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1116 else
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1117 tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1118 if (tagf == NULL)
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
1119 pfatal (tagfile);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1120 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1121
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1122 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1123 * Loop through files finding functions.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1124 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1125 for (i = 0; i < current_arg; ++i)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1126 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1127 switch (argbuffer[i].arg_type)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1128 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1129 case at_language:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1130 forced_lang = argbuffer[i].lang;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1131 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1132 #ifdef ETAGS_REGEXPS
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1133 case at_regexp:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1134 analyse_regex (argbuffer[i].what, FALSE);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1135 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1136 case at_icregexp:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1137 analyse_regex (argbuffer[i].what, TRUE);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1138 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1139 #endif
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1140 case at_filename:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1141 #ifdef VMS
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1142 while ((this_file = gfnames (argbuffer[i].what, &got_err)) != NULL)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1143 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1144 if (got_err)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1145 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1146 error ("can't find file %s\n", this_file);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1147 argc--, argv++;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1148 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1149 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1150 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1151 this_file = massage_name (this_file);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1152 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1153 #else
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1154 this_file = argbuffer[i].what;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1155 #endif
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1156 /* Input file named "-" means read file names from stdin
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1157 (one per line) and use them. */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1158 if (streq (this_file, "-"))
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
1159 while (readline_internal (&filename_lb, stdin) > 0)
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
1160 process_file (filename_lb.buffer);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1161 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1162 process_file (this_file);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1163 #ifdef VMS
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1164 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1165 #endif
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1166 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1167 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1168 }
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
1169
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1170 #ifdef ETAGS_REGEXPS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1171 free_patterns ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1172 #endif /* ETAGS_REGEXPS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1173
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1174 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1175 {
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
1176 while (nincluded_files-- > 0)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1177 fprintf (tagf, "\f\n%s,include\n", *included_files++);
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
1178
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1179 fclose (tagf);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
1180 exit (GOOD);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1181 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1182
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1183 /* If CTAGS, we are here. process_file did not write the tags yet,
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1184 because we want them ordered. Let's do it now. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1185 if (cxref_style)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1186 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1187 put_entries (head);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1188 free_tree (head);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1189 head = NULL;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1190 exit (GOOD);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1191 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1192
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1193 if (update)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1194 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1195 char cmd[BUFSIZ];
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1196 for (i = 0; i < current_arg; ++i)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1197 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1198 if (argbuffer[i].arg_type != at_filename)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1199 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1200 sprintf (cmd,
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1201 "mv %s OTAGS;fgrep -v '\t%s\t' OTAGS >%s;rm OTAGS",
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1202 tagfile, argbuffer[i].what, tagfile);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1203 if (system (cmd) != GOOD)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
1204 fatal ("failed to execute shell command", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1205 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1206 append_to_tagfile = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1207 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1208
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1209 tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1210 if (tagf == NULL)
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1211 pfatal (tagfile);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1212 put_entries (head);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1213 free_tree (head);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1214 head = NULL;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1215 fclose (tagf);
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1216
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1217 if (update)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1218 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1219 char cmd[BUFSIZ];
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1220 sprintf (cmd, "sort %s -o %s", tagfile, tagfile);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1221 exit (system (cmd));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1222 }
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
1223 return GOOD;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1224 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1225
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1226
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1227
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1228 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1229 * Return a compressor given the file name. If EXTPTR is non-zero,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1230 * return a pointer into FILE where the compressor-specific
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1231 * extension begins. If no compressor is found, NULL is returned
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1232 * and EXTPTR is not significant.
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1233 * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1234 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1235 static compressor *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1236 get_compressor_from_suffix (file, extptr)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1237 char *file;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1238 char **extptr;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1239 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1240 compressor *compr;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1241 char *slash, *suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1242
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1243 /* This relies on FN to be after canonicalize_filename,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1244 so we don't need to consider backslashes on DOS_NT. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1245 slash = etags_strrchr (file, '/');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1246 suffix = etags_strrchr (file, '.');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1247 if (suffix == NULL || suffix < slash)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1248 return NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1249 if (extptr != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1250 *extptr = suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1251 suffix += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1252 /* Let those poor souls who live with DOS 8+3 file name limits get
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1253 some solace by treating foo.cgz as if it were foo.c.gz, etc.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1254 Only the first do loop is run if not MSDOS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1255 do
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1256 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1257 for (compr = compressors; compr->suffix != NULL; compr++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1258 if (streq (compr->suffix, suffix))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1259 return compr;
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1260 if (!MSDOS)
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1261 break; /* do it only once: not really a loop */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1262 if (extptr != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1263 *extptr = ++suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1264 } while (*suffix != '\0');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1265 return NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1266 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1267
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1268
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1269
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1270 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1271 * Return a language given the name.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1272 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1273 static language *
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1274 get_language_from_langname (name)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1275 char *name;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1276 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1277 language *lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1278
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1279 if (name == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1280 error ("empty language name", (char *)NULL);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1281 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1282 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1283 for (lang = lang_names; lang->name != NULL; lang++)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1284 if (streq (name, lang->name))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1285 return lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1286 error ("unknown language \"%s\"", name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1287 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1288
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1289 return NULL;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1290 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1291
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1292
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1293 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1294 * Return a language given the interpreter name.
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1295 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1296 static language *
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1297 get_language_from_interpreter (interpreter)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1298 char *interpreter;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1299 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1300 language *lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1301 char **iname;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1302
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1303 if (interpreter == NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1304 return NULL;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1305 for (lang = lang_names; lang->name != NULL; lang++)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1306 if (lang->interpreters != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1307 for (iname = lang->interpreters; *iname != NULL; iname++)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1308 if (streq (*iname, interpreter))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1309 return lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1310
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1311 return NULL;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1312 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1313
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1314
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1315
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1316 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1317 * Return a language given the file name.
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1318 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1319 static language *
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1320 get_language_from_filename (file)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1321 char *file;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1322 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1323 language *lang;
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1324 char **name, **ext, *suffix;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1325
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1326 /* Try whole file name first. */
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1327 for (lang = lang_names; lang->name != NULL; lang++)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1328 if (lang->filenames != NULL)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1329 for (name = lang->filenames; *name != NULL; name++)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1330 if (streq (*name, file))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1331 return lang;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1332
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1333 /* If not found, try suffix after last dot. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1334 suffix = etags_strrchr (file, '.');
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1335 if (suffix == NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1336 return NULL;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1337 suffix += 1;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1338 for (lang = lang_names; lang->name != NULL; lang++)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1339 if (lang->suffixes != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1340 for (ext = lang->suffixes; *ext != NULL; ext++)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1341 if (streq (*ext, suffix))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1342 return lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1343 return NULL;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1344 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1345
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1346
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1347
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1348 /*
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1349 * This routine is called on each file argument.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1350 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1351 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1352 process_file (file)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1353 char *file;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1354 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1355 struct stat stat_buf;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1356 FILE *inf;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1357 compressor *compr;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1358 char *compressed_name, *uncompressed_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1359 char *ext, *real_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1360
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1361
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1362 canonicalize_filename (file);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1363 if (streq (file, tagfile) && !streq (tagfile, "-"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1364 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1365 error ("skipping inclusion of %s in self.", file);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1366 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1367 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1368 if ((compr = get_compressor_from_suffix (file, &ext)) == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1369 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1370 compressed_name = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1371 real_name = uncompressed_name = savestr (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1372 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1373 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1374 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1375 real_name = compressed_name = savestr (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1376 uncompressed_name = savenstr (file, ext - file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1377 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1378
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1379 /* If the canonicalised uncompressed name has already be dealt with,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1380 skip it silently, else add it to the list. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1381 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1382 typedef struct processed_file
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1383 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1384 char *filename;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1385 struct processed_file *next;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1386 } processed_file;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1387 static processed_file *pf_head = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1388 register processed_file *fnp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1389
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1390 for (fnp = pf_head; fnp != NULL; fnp = fnp->next)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1391 if (streq (uncompressed_name, fnp->filename))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1392 goto exit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1393 fnp = pf_head;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1394 pf_head = xnew (1, struct processed_file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1395 pf_head->filename = savestr (uncompressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1396 pf_head->next = fnp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1397 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1398
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1399 if (stat (real_name, &stat_buf) != 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1400 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1401 /* Reset real_name and try with a different name. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1402 real_name = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1403 if (compressed_name != NULL) /* try with the given suffix */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1404 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1405 if (stat (uncompressed_name, &stat_buf) == 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1406 real_name = uncompressed_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1407 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1408 else /* try all possible suffixes */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1409 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1410 for (compr = compressors; compr->suffix != NULL; compr++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1411 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1412 compressed_name = concat (file, ".", compr->suffix);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1413 if (stat (compressed_name, &stat_buf) != 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1414 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1415 if (MSDOS)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1416 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1417 char *suf = compressed_name + strlen (file);
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1418 size_t suflen = strlen (compr->suffix) + 1;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1419 for ( ; suf[1]; suf++, suflen--)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1420 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1421 memmove (suf, suf + 1, suflen);
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1422 if (stat (compressed_name, &stat_buf) == 0)
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1423 {
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1424 real_name = compressed_name;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1425 break;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1426 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1427 }
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1428 if (real_name != NULL)
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1429 break;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1430 } /* MSDOS */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1431 free (compressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1432 compressed_name = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1433 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1434 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1435 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1436 real_name = compressed_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1437 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1438 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1439 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1440 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1441 if (real_name == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1442 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1443 perror (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1444 goto exit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1445 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1446 } /* try with a different name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1447
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1448 if (!S_ISREG (stat_buf.st_mode))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1449 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1450 error ("skipping %s: it is not a regular file.", real_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1451 goto exit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1452 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1453 if (real_name == compressed_name)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1454 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1455 char *cmd = concat (compr->command, " ", real_name);
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
1456 inf = (FILE *) popen (cmd, "r");
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1457 free (cmd);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1458 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1459 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1460 inf = fopen (real_name, "r");
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1461 if (inf == NULL)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1462 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1463 perror (real_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1464 goto exit;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1465 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1466
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1467 find_entries (uncompressed_name, inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1468
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1469 if (real_name == compressed_name)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1470 pclose (inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1471 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1472 fclose (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1473
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1474 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1475 {
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1476 char *filename;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1477
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1478 if (filename_is_absolute (uncompressed_name))
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1479 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
1480 /* file is an absolute file name. Canonicalise it. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1481 filename = absolute_filename (uncompressed_name, cwd);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1482 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1483 else
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1484 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
1485 /* file is a file name relative to cwd. Make it relative
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1486 to the directory of the tags file. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1487 filename = relative_filename (uncompressed_name, tagfiledir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1488 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1489 fprintf (tagf, "\f\n%s,%d\n", filename, total_size_of_entries (head));
10990
c0ceaa45ded7 * etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents: 10801
diff changeset
1490 free (filename);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1491 put_entries (head);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1492 free_tree (head);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1493 head = NULL;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1494 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1495
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1496 exit:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1497 if (compressed_name) free(compressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1498 if (uncompressed_name) free(uncompressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1499 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1500 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1501
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1502 /*
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3569
diff changeset
1503 * This routine sets up the boolean pseudo-functions which work
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1504 * by setting boolean flags dependent upon the corresponding character.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1505 * Every char which is NOT in that string is not a white char. Therefore,
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1506 * all of the array "_wht" is set to FALSE, and then the elements
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1507 * subscripted by the chars in "white" are set to TRUE. Thus "_wht"
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1508 * of a char is TRUE if it is the string "white", else FALSE.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1509 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1510 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1511 init ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1512 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1513 register char *sp;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1514 register int i;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1515
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1516 for (i = 0; i < CHARS; i++)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1517 iswhite(i) = notinname(i) = begtoken(i) = intoken(i) = endtoken(i) = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1518 for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1519 for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = TRUE;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1520 notinname('\0') = notinname('\n');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1521 for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = TRUE;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1522 begtoken('\0') = begtoken('\n');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1523 for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = TRUE;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1524 intoken('\0') = intoken('\n');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1525 for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1526 endtoken('\0') = endtoken('\n');
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1527 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1528
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1529 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1530 * This routine opens the specified file and calls the function
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1531 * which finds the function and type definitions.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1532 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1533 node *last_node = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1534
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1535 static void
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1536 find_entries (file, inf)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1537 char *file;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1538 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1539 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1540 char *cp;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1541 language *lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1542 node *old_last_node;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1543
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1544 /* Memory leakage here: the string pointed by curfile is
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1545 never released, because curfile is copied into np->file
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1546 for each node, to be used in CTAGS mode. The amount of
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1547 memory leaked here is the sum of the lengths of the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1548 file names. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1549 curfile = savestr (file);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1550
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1551 /* If user specified a language, use it. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1552 lang = forced_lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1553 if (lang != NULL && lang->function != NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1554 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1555 curlang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1556 lang->function (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1557 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1558 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1559
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1560 /* Try to guess the language given the file name. */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1561 lang = get_language_from_filename (file);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1562 if (lang != NULL && lang->function != NULL)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1563 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1564 curlang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1565 lang->function (inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1566 return;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1567 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1568
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1569 /* Look for sharp-bang as the first two characters. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1570 if (readline_internal (&lb, inf) > 0
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
1571 && lb.len >= 2
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1572 && lb.buffer[0] == '#'
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1573 && lb.buffer[1] == '!')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1574 {
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1575 char *lp;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1576
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1577 /* Set lp to point at the first char after the last slash in the
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1578 line or, if no slashes, at the first nonblank. Then set cp to
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1579 the first successive blank and terminate the string. */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1580 lp = etags_strrchr (lb.buffer+2, '/');
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1581 if (lp != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1582 lp += 1;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1583 else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1584 lp = skip_spaces (lb.buffer + 2);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1585 cp = skip_non_spaces (lp);
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1586 *cp = '\0';
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1587
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1588 if (strlen (lp) > 0)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1589 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1590 lang = get_language_from_interpreter (lp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1591 if (lang != NULL && lang->function != NULL)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1592 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1593 curlang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1594 lang->function (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1595 return;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1596 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1597 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1598 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1599 /* We rewind here, even if inf may be a pipe. We fail if the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1600 length of the first line is longer than the pipe block size,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1601 which is unlikely. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1602 rewind (inf);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1603
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1604 /* Try Fortran. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1605 old_last_node = last_node;
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1606 curlang = get_language_from_langname ("fortran");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1607 Fortran_functions (inf);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1608
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1609 /* No Fortran entries found. Try C. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1610 if (old_last_node == last_node)
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1611 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1612 /* We do not tag if rewind fails.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1613 Only the file name will be recorded in the tags file. */
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1614 rewind (inf);
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1615 curlang = get_language_from_langname (cplusplus ? "c++" : "c");
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1616 default_C_entries (inf);
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1617 }
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1618 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1619 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1620
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1621
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1622 /* Record a tag. */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
1623 static void
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1624 pfnote (name, is_func, linestart, linelen, lno, cno)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1625 char *name; /* tag name, or NULL if unnamed */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1626 bool is_func; /* tag is a function */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1627 char *linestart; /* start of the line where tag is */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1628 int linelen; /* length of the line where tag is */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1629 int lno; /* line number */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1630 long cno; /* character number */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1631 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1632 register node *np;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1633
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1634 if (CTAGS && name == NULL)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1635 return;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1636
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1637 np = xnew (1, node);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1638
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1639 /* If ctags mode, change name "main" to M<thisfilename>. */
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1640 if (CTAGS && !cxref_style && streq (name, "main"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1641 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1642 register char *fp = etags_strrchr (curfile, '/');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1643 np->name = concat ("M", fp == NULL ? curfile : fp + 1, "");
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1644 fp = etags_strrchr (np->name, '.');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1645 if (fp != NULL && fp[1] != '\0' && fp[2] == '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1646 fp[0] = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1647 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1648 else
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1649 np->name = name;
10623
8a73e71a55e3 * etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents: 10449
diff changeset
1650 np->been_warned = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1651 np->file = curfile;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1652 np->is_func = is_func;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1653 np->lno = lno;
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
1654 /* Our char numbers are 0-base, because of C language tradition?
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
1655 ctags compatibility? old versions compatibility? I don't know.
14021
19bab04cf346 (substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents: 13696
diff changeset
1656 Anyway, since emacs's are 1-base we expect etags.el to take care
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
1657 of the difference. If we wanted to have 1-based numbers, we would
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
1658 uncomment the +1 below. */
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
1659 np->cno = cno /* + 1 */ ;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1660 np->left = np->right = NULL;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1661 if (CTAGS && !cxref_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1662 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1663 if (strlen (linestart) < 50)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1664 np->pat = concat (linestart, "$", "");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1665 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1666 np->pat = savenstr (linestart, 50);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1667 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1668 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1669 np->pat = savenstr (linestart, linelen);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1670
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1671 add_node (np, &head);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1672 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1673
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1674 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1675 * TAGS format specification
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1676 * Idea by Sam Kendall <kendall@mv.mv.com> (1997)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1677 *
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1678 * pfnote should emit the optimized form [unnamed tag] only if:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1679 * 1. name does not contain any of the characters " \t\r\n(),;";
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1680 * 2. linestart contains name as either a rightmost, or rightmost but
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1681 * one character, substring;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1682 * 3. the character, if any, immediately before name in linestart must
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1683 * be one of the characters " \t(),;";
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1684 * 4. the character, if any, immediately after name in linestart must
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1685 * also be one of the characters " \t(),;".
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1686 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1687 * The real implementation uses the notinname() macro, which recognises
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1688 * characters slightly different form " \t\r\n(),;". See the variable
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1689 * `nonam'.
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1690 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1691 #define traditional_tag_style TRUE
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
1692 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1693 new_pfnote (name, namelen, is_func, linestart, linelen, lno, cno)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1694 char *name; /* tag name, or NULL if unnamed */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1695 int namelen; /* tag length */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1696 bool is_func; /* tag is a function */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1697 char *linestart; /* start of the line where tag is */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1698 int linelen; /* length of the line where tag is */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1699 int lno; /* line number */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1700 long cno; /* character number */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1701 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1702 register char *cp;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1703 bool named;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1704
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1705 named = TRUE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1706 if (!CTAGS)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1707 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1708 for (cp = name; !notinname (*cp); cp++)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1709 continue;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1710 if (*cp == '\0') /* rule #1 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1711 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1712 cp = linestart + linelen - namelen;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1713 if (notinname (linestart[linelen-1]))
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1714 cp -= 1; /* rule #4 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1715 if (cp >= linestart /* rule #2 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1716 && (cp == linestart
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1717 || notinname (cp[-1])) /* rule #3 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1718 && strneq (name, cp, namelen)) /* rule #2 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1719 named = FALSE; /* use unnamed tag */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1720 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1721 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1722
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1723 if (named)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1724 name = savenstr (name, namelen);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1725 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1726 name = NULL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1727 pfnote (name, is_func, linestart, linelen, lno, cno);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1728 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1729
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1730 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1731 * free_tree ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1732 * recurse on left children, iterate on right children.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1733 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1734 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1735 free_tree (np)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1736 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1737 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1738 while (np)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1739 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1740 register node *node_right = np->right;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1741 free_tree (np->left);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1742 if (np->name != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1743 free (np->name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1744 free (np->pat);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1745 free (np);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1746 np = node_right;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1747 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1748 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1749
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1750 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1751 * add_node ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1752 * Adds a node to the tree of nodes. In etags mode, we don't keep
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1753 * it sorted; we just keep a linear list. In ctags mode, maintain
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1754 * an ordered tree, with no attempt at balancing.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1755 *
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1756 * add_node is the only function allowed to add nodes, so it can
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1757 * maintain state.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1758 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1759 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1760 add_node (np, cur_node_p)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1761 node *np, **cur_node_p;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1762 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1763 register int dif;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1764 register node *cur_node = *cur_node_p;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1765
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1766 if (cur_node == NULL)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1767 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1768 *cur_node_p = np;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1769 last_node = np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1770 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1771 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1772
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1773 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1774 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1775 /* Etags Mode */
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
1776 if (last_node == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
1777 fatal ("internal error in add_node", (char *)NULL);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1778 last_node->right = np;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1779 last_node = np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1780 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1781 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1782 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1783 /* Ctags Mode */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1784 dif = strcmp (np->name, cur_node->name);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1785
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1786 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1787 * If this tag name matches an existing one, then
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1788 * do not add the node, but maybe print a warning.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1789 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1790 if (!dif)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1791 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1792 if (streq (np->file, cur_node->file))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1793 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1794 if (!no_warnings)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1795 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1796 fprintf (stderr, "Duplicate entry in file %s, line %d: %s\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1797 np->file, lineno, np->name);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1798 fprintf (stderr, "Second entry ignored\n");
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1799 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1800 }
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1801 else if (!cur_node->been_warned && !no_warnings)
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1802 {
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1803 fprintf
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1804 (stderr,
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1805 "Duplicate entry in files %s and %s: %s (Warning only)\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1806 np->file, cur_node->file, np->name);
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1807 cur_node->been_warned = TRUE;
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1808 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1809 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1810 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1811
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1812 /* Actually add the node */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1813 add_node (np, dif < 0 ? &cur_node->left : &cur_node->right);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1814 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1815 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1816
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1817
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1818 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1819 put_entries (np)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1820 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1821 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1822 register char *sp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1823
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1824 if (np == NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1825 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1826
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1827 /* Output subentries that precede this one */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1828 put_entries (np->left);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1829
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1830 /* Output this entry */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1831
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1832 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1833 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1834 if (np->name != NULL)
21355
b33f3f6d7f74 (put_entries): Use %ld.
Richard M. Stallman <rms@gnu.org>
parents: 20788
diff changeset
1835 fprintf (tagf, "%s\177%s\001%d,%ld\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1836 np->pat, np->name, np->lno, np->cno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1837 else
21355
b33f3f6d7f74 (put_entries): Use %ld.
Richard M. Stallman <rms@gnu.org>
parents: 20788
diff changeset
1838 fprintf (tagf, "%s\177%d,%ld\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1839 np->pat, np->lno, np->cno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1840 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1841 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1842 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1843 if (np->name == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
1844 error ("internal error: NULL name in ctags mode.", (char *)NULL);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1845
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1846 if (cxref_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1847 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1848 if (vgrind_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1849 fprintf (stdout, "%s %s %d\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1850 np->name, np->file, (np->lno + 63) / 64);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1851 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1852 fprintf (stdout, "%-16s %3d %-16s %s\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1853 np->name, np->lno, np->file, np->pat);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1854 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1855 else
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1856 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1857 fprintf (tagf, "%s\t%s\t", np->name, np->file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1858
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1859 if (np->is_func)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1860 { /* a function */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1861 putc (searchar, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1862 putc ('^', tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1863
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1864 for (sp = np->pat; *sp; sp++)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1865 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1866 if (*sp == '\\' || *sp == searchar)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1867 putc ('\\', tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1868 putc (*sp, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1869 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1870 putc (searchar, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1871 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1872 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1873 { /* a typedef; text pattern inadequate */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1874 fprintf (tagf, "%d", np->lno);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1875 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1876 putc ('\n', tagf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1877 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1878 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1879
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1880 /* Output subentries that follow this one */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1881 put_entries (np->right);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1882 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1883
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1884 /* Length of a number's decimal representation. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1885 static int
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1886 number_len (num)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1887 long num;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1888 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1889 int len = 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1890 while ((num /= 10) > 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1891 len += 1;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1892 return len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1893 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1894
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1895 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1896 * Return total number of characters that put_entries will output for
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1897 * the nodes in the subtree of the specified node. Works only if
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1898 * we are not ctags, but called only in that case. This count
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1899 * is irrelevant with the new tags.el, but is still supplied for
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1900 * backward compatibility.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1901 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1902 static int
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1903 total_size_of_entries (np)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1904 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1905 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1906 register int total;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1907
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1908 if (np == NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1909 return 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1910
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1911 for (total = 0; np != NULL; np = np->right)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1912 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1913 /* Count left subentries. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1914 total += total_size_of_entries (np->left);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1915
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1916 /* Count this entry */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1917 total += strlen (np->pat) + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1918 total += number_len ((long) np->lno) + 1 + number_len (np->cno) + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1919 if (np->name != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1920 total += 1 + strlen (np->name); /* \001name */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1921 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1922
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1923 return total;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1924 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1925
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1926
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1927 /* C extensions. */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1928 #define C_EXT 0x00fff /* C extensions */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1929 #define C_PLAIN 0x00000 /* C */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1930 #define C_PLPL 0x00001 /* C++ */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1931 #define C_STAR 0x00003 /* C* */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1932 #define C_JAVA 0x00005 /* JAVA */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1933 #define C_AUTO 0x01000 /* C, but switch to C++ if `class' is met */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1934 #define YACC 0x10000 /* yacc file */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1935
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1936 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1937 * The C symbol tables.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1938 */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1939 enum sym_type
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1940 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1941 st_none,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1942 st_C_objprot, st_C_objimpl, st_C_objend,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1943 st_C_gnumacro,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1944 st_C_ignore,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1945 st_C_javastruct,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1946 st_C_operator,
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
1947 st_C_class,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1948 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1949 };
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1950
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1951 static unsigned int hash P_((const char *, unsigned int));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1952 static struct C_stab_entry * in_word_set P_((const char *, unsigned int));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1953 static enum sym_type C_symtype P_((char *, int, int));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1954
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1955 /* Feed stuff between (but not including) %[ and %] lines to:
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1956 gperf -c -k 1,3 -o -p -r -t
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1957 %[
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1958 struct C_stab_entry { char *name; int c_ext; enum sym_type type; }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1959 %%
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1960 if, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1961 for, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1962 while, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1963 switch, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1964 return, 0, st_C_ignore
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1965 @interface, 0, st_C_objprot
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1966 @protocol, 0, st_C_objprot
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1967 @implementation,0, st_C_objimpl
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1968 @end, 0, st_C_objend
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1969 import, C_JAVA, st_C_ignore
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1970 package, C_JAVA, st_C_ignore
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1971 friend, C_PLPL, st_C_ignore
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
1972 extends, C_JAVA, st_C_javastruct
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
1973 implements, C_JAVA, st_C_javastruct
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1974 interface, C_JAVA, st_C_struct
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
1975 class, 0, st_C_class
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1976 namespace, C_PLPL, st_C_struct
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1977 domain, C_STAR, st_C_struct
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1978 union, 0, st_C_struct
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1979 struct, 0, st_C_struct
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1980 extern, 0, st_C_extern
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1981 enum, 0, st_C_enum
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1982 typedef, 0, st_C_typedef
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1983 define, 0, st_C_define
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1984 operator, C_PLPL, st_C_operator
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1985 bool, C_PLPL, st_C_typespec
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1986 long, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1987 short, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1988 int, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1989 char, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1990 float, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1991 double, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1992 signed, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1993 unsigned, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1994 auto, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1995 void, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1996 static, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1997 const, 0, st_C_typespec
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1998 volatile, 0, st_C_typespec
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1999 explicit, C_PLPL, st_C_typespec
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2000 mutable, C_PLPL, st_C_typespec
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2001 typename, C_PLPL, st_C_typespec
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2002 # DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach).
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2003 DEFUN, 0, st_C_gnumacro
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2004 SYSCALL, 0, st_C_gnumacro
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2005 ENTRY, 0, st_C_gnumacro
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2006 PSEUDO, 0, st_C_gnumacro
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2007 # These are defined inside C functions, so currently they are not met.
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2008 # EXFUN used in glibc, DEFVAR_* in emacs.
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2009 #EXFUN, 0, st_C_gnumacro
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2010 #DEFVAR_, 0, st_C_gnumacro
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2011 %]
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2012 and replace lines between %< and %> with its output,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2013 then make in_word_set static. */
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2014 /*%<*/
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2015 /* C code produced by gperf version 2.7.1 (19981006 egcs) */
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2016 /* Command-line: gperf -c -k 1,3 -o -p -r -t */
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2017 struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2018
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2019 #define TOTAL_KEYWORDS 46
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2020 #define MIN_WORD_LENGTH 2
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2021 #define MAX_WORD_LENGTH 15
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2022 #define MIN_HASH_VALUE 13
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2023 #define MAX_HASH_VALUE 121
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2024 /* maximum key range = 109, duplicates = 0 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2025
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2026 #ifdef __GNUC__
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2027 __inline
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2028 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2029 static unsigned int
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2030 hash (str, len)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2031 register const char *str;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2032 register unsigned int len;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2033 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2034 static unsigned char asso_values[] =
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2035 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2036 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2037 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2038 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2039 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2040 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2041 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2042 122, 122, 122, 122, 57, 122, 122, 122, 55, 6,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2043 60, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2044 51, 122, 122, 10, 2, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2045 122, 122, 122, 122, 122, 122, 122, 2, 52, 59,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2046 49, 38, 56, 41, 122, 22, 122, 122, 9, 32,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2047 33, 60, 26, 122, 1, 28, 46, 59, 44, 51,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2048 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2049 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2050 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2051 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2052 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2053 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2054 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2055 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2056 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2057 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2058 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2059 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2060 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2061 122, 122, 122, 122, 122, 122
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2062 };
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2063 register int hval = len;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2064
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2065 switch (hval)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2066 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2067 default:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2068 case 3:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2069 hval += asso_values[(unsigned char)str[2]];
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2070 case 2:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2071 case 1:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2072 hval += asso_values[(unsigned char)str[0]];
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2073 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2074 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2075 return hval;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2076 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2077
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2078 #ifdef __GNUC__
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2079 __inline
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2080 #endif
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2081 struct C_stab_entry *
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2082 in_word_set (str, len)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2083 register const char *str;
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2084 register unsigned int len;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2085 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2086 static struct C_stab_entry wordlist[] =
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2087 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2088 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2089 {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2090 {"ENTRY", 0, st_C_gnumacro},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2091 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2092 {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2093 {"if", 0, st_C_ignore},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2094 {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2095 {"SYSCALL", 0, st_C_gnumacro},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2096 {""}, {""}, {""}, {""}, {""}, {""}, {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2097 {"struct", 0, st_C_struct},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2098 {"static", 0, st_C_typespec},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2099 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2100 {"long", 0, st_C_typespec},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2101 {""}, {""}, {""}, {""}, {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2102 {"auto", 0, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2103 {"return", 0, st_C_ignore},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2104 {"import", C_JAVA, st_C_ignore},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2105 {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2106 {"switch", 0, st_C_ignore},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2107 {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2108 {"implements", C_JAVA, st_C_javastruct},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2109 {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2110 {"for", 0, st_C_ignore},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2111 {"volatile", 0, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2112 {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2113 {"PSEUDO", 0, st_C_gnumacro},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2114 {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2115 {"char", 0, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2116 {"class", 0, st_C_class},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2117 {"@protocol", 0, st_C_objprot},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2118 {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2119 {"void", 0, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2120 {"int", 0, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2121 {"explicit", C_PLPL, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2122 {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2123 {"namespace", C_PLPL, st_C_struct},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2124 {"signed", 0, st_C_typespec},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2125 {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2126 {"interface", C_JAVA, st_C_struct},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2127 {"while", 0, st_C_ignore},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2128 {"typedef", 0, st_C_typedef},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2129 {"typename", C_PLPL, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2130 {""}, {""}, {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2131 {"friend", C_PLPL, st_C_ignore},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2132 {"mutable", C_PLPL, st_C_typespec},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2133 {"union", 0, st_C_struct},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2134 {"domain", C_STAR, st_C_struct},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2135 {""}, {""},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2136 {"extern", 0, st_C_extern},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2137 {"extends", C_JAVA, st_C_javastruct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2138 {"package", C_JAVA, st_C_ignore},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2139 {"short", 0, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2140 {"@end", 0, st_C_objend},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2141 {"unsigned", 0, st_C_typespec},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2142 {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2143 {"const", 0, st_C_typespec},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2144 {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2145 {"@interface", 0, st_C_objprot},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2146 {"enum", 0, st_C_enum},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2147 {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2148 {"@implementation",0, st_C_objimpl},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2149 {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2150 {"operator", C_PLPL, st_C_operator},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2151 {""}, {""}, {""}, {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2152 {"define", 0, st_C_define},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2153 {""}, {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2154 {"double", 0, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2155 {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2156 {"bool", C_PLPL, st_C_typespec},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2157 {""}, {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2158 {"DEFUN", 0, st_C_gnumacro},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2159 {"float", 0, st_C_typespec}
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2160 };
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2161
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2162 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2163 {
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2164 register int key = hash (str, len);
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2165
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2166 if (key <= MAX_HASH_VALUE && key >= 0)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2167 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2168 register const char *s = wordlist[key].name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2169
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2170 if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2171 return &wordlist[key];
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2172 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2173 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2174 return 0;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2175 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2176 /*%>*/
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2177
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
2178 static enum sym_type
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
2179 C_symtype (str, len, c_ext)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2180 char *str;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2181 int len;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2182 int c_ext;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2183 {
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
2184 register struct C_stab_entry *se = in_word_set (str, len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2185
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2186 if (se == NULL || (se->c_ext && !(c_ext & se->c_ext)))
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2187 return st_none;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2188 return se->type;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2189 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2190
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2191
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2192 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2193 * C functions and variables are recognized using a simple
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2194 * finite automaton. fvdef is its state variable.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2195 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2196 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2197 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2198 fvnone, /* nothing seen */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2199 fdefunkey, /* Emacs DEFUN keyword seen */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2200 fdefunname, /* Emacs DEFUN name seen */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2201 foperator, /* func: operator keyword seen (cplpl) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2202 fvnameseen, /* function or variable name seen */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2203 fstartlist, /* func: just after open parenthesis */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2204 finlist, /* func: in parameter list */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2205 flistseen, /* func: after parameter list */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2206 fignore, /* func: before open brace */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2207 vignore /* var-like: ignore until ';' */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2208 } fvdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2209
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2210 bool fvextern; /* func or var: extern keyword seen; */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2211
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2212 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2213 * typedefs are recognized using a simple finite automaton.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2214 * typdef is its state variable.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2215 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2216 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2217 {
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
2218 tnone, /* nothing seen */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2219 tkeyseen, /* typedef keyword seen */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2220 ttypeseen, /* defined type seen */
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
2221 tinbody, /* inside typedef body */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2222 tend, /* just before typedef tag */
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2223 tignore /* junk after typedef tag */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2224 } typdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2225
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2226 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2227 * struct-like structures (enum, struct and union) are recognized
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2228 * using another simple finite automaton. `structdef' is its state
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2229 * variable.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2230 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2231 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2232 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2233 snone, /* nothing seen yet,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2234 or in struct body if cblev > 0 */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2235 skeyseen, /* struct-like keyword seen */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2236 stagseen, /* struct-like tag seen */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2237 sintemplate, /* inside template (ignore) */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2238 scolonseen /* colon seen after struct-like tag */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2239 } structdef;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2240
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2241 /*
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2242 * When objdef is different from onone, objtag is the name of the class.
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2243 */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2244 char *objtag = "<uninited>";
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2245
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2246 /*
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2247 * Yet another little state machine to deal with preprocessor lines.
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2248 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2249 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2250 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2251 dnone, /* nothing seen */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2252 dsharpseen, /* '#' seen as first char on line */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2253 ddefineseen, /* '#' and 'define' seen */
5044
d3bd7baee39f (FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents: 4937
diff changeset
2254 dignorerest /* ignore rest of line */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2255 } definedef;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2256
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2257 /*
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2258 * State machine for Objective C protocols and implementations.
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2259 * Idea by Tom R.Hageman <tom@basil.icce.rug.nl> (1995)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2260 */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2261 enum
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2262 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2263 onone, /* nothing seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2264 oprotocol, /* @interface or @protocol seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2265 oimplementation, /* @implementations seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2266 otagseen, /* class name seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2267 oparenseen, /* parenthesis before category seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2268 ocatseen, /* category name seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2269 oinbody, /* in @implementation body */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2270 omethodsign, /* in @implementation body, after +/- */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2271 omethodtag, /* after method name */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2272 omethodcolon, /* after method colon */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2273 omethodparm, /* after method parameter */
14230
6b836f84bccf (enum sym_type, anonymous enum): Delete final comma.
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
2274 oignore /* wait for @end */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2275 } objdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2276
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2277
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2278 /*
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2279 * Use this structure to keep info about the token read, and how it
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2280 * should be tagged. Used by the make_C_tag function to build a tag.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2281 */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2282 struct tok
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2283 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2284 bool valid;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2285 bool named;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2286 int offset;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2287 int length;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2288 int lineno;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2289 long linepos;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2290 char *line;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2291 } token; /* latest token read */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2292 linebuffer token_name; /* its name */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2293
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2294 /*
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2295 * Variables and functions for dealing with nested structures.
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2296 * Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2297 */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2298 static void pushclass_above P_((int, char *, int));
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2299 static void popclass_above P_((int));
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2300 static void write_classname P_((linebuffer *, char *qualifier));
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2301
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2302 struct {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2303 char **cname; /* nested class names */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2304 int *cblev; /* nested class curly brace level */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2305 int nl; /* class nesting level (elements used) */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2306 int size; /* length of the array */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2307 } cstack; /* stack for nested declaration tags */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2308 /* Current struct nesting depth (namespace, class, struct, union, enum). */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2309 #define nestlev (cstack.nl)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2310 /* After struct keyword or in struct body, not inside an nested function. */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2311 #define instruct (structdef == snone && nestlev > 0 \
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2312 && cblev == cstack.cblev[nestlev-1] + 1)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2313
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2314 static void
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2315 pushclass_above (cblev, str, len)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2316 int cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2317 char *str;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2318 int len;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2319 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2320 int nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2321
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2322 popclass_above (cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2323 nl = cstack.nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2324 if (nl >= cstack.size)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2325 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2326 int size = cstack.size *= 2;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2327 xrnew (cstack.cname, size, char *);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2328 xrnew (cstack.cblev, size, int);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2329 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2330 assert (nl == 0 || cstack.cblev[nl-1] < cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2331 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2332 cstack.cblev[nl] = cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2333 cstack.nl = nl + 1;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2334 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2335
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2336 static void
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2337 popclass_above (cblev)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2338 int cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2339 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2340 int nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2341
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2342 for (nl = cstack.nl - 1;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2343 nl >= 0 && cstack.cblev[nl] >= cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2344 nl--)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2345 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2346 if (cstack.cname[nl] != NULL)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2347 free (cstack.cname[nl]);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2348 cstack.nl = nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2349 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2350 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2351
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2352 static void
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2353 write_classname (cn, qualifier)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2354 linebuffer *cn;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2355 char *qualifier;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2356 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2357 int i, len;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2358 int qlen = strlen (qualifier);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2359
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2360 if (cstack.nl == 0 || cstack.cname[0] == NULL)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2361 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2362 len = 0;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2363 cn->len = 0;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2364 cn->buffer[0] = '\0';
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2365 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2366 else
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2367 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2368 len = strlen (cstack.cname[0]);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2369 linebuffer_setlen (cn, len);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2370 strcpy (cn->buffer, cstack.cname[0]);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2371 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2372 for (i = 1; i < cstack.nl; i++)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2373 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2374 char *s;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2375 int slen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2376
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2377 s = cstack.cname[i];
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2378 if (s == NULL)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2379 continue;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2380 slen = strlen (s);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2381 len += slen + qlen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2382 linebuffer_setlen (cn, len);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2383 strncat (cn->buffer, qualifier, qlen);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2384 strncat (cn->buffer, s, slen);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2385 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2386 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2387
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2388
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2389 static bool consider_token P_((char *, int, int, int *, int, int, bool *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
2390 static void make_C_tag P_((bool));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
2391
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2392 /*
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2393 * consider_token ()
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2394 * checks to see if the current token is at the start of a
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2395 * function or variable, or corresponds to a typedef, or
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2396 * is a struct/union/enum tag, or #define, or an enum constant.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2397 *
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2398 * *IS_FUNC gets TRUE iff the token is a function or #define macro
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2399 * with args. C_EXTP points to which language we are looking at.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2400 *
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2401 * Globals
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2402 * fvdef IN OUT
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2403 * structdef IN OUT
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2404 * definedef IN OUT
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2405 * typdef IN OUT
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2406 * objdef IN OUT
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2407 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2408
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
2409 static bool
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2410 consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var)
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2411 register char *str; /* IN: token pointer */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2412 register int len; /* IN: token length */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
2413 register int c; /* IN: first char after the token */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2414 int *c_extp; /* IN, OUT: C extensions mask */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2415 int cblev; /* IN: curly brace level */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2416 int parlev; /* IN: parenthesis level */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2417 bool *is_func_or_var; /* OUT: function or variable found */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2418 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2419 /* When structdef is stagseen, scolonseen, or snone with cblev > 0,
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2420 structtype is the type of the preceding struct-like keyword, and
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2421 structcblev is the curly brace level where it has been seen. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2422 static enum sym_type structtype;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2423 static int structcblev;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2424 static enum sym_type toktype;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2425
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2426
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2427 toktype = C_symtype (str, len, *c_extp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2428
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2429 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2430 * Advance the definedef state machine.
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2431 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2432 switch (definedef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2433 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2434 case dnone:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2435 /* We're not on a preprocessor line. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2436 if (toktype == st_C_gnumacro)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2437 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2438 fvdef = fdefunkey;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2439 return FALSE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2440 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2441 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2442 case dsharpseen:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2443 if (toktype == st_C_define)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2444 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2445 definedef = ddefineseen;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2446 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2447 else
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2448 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2449 definedef = dignorerest;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2450 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2451 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2452 case ddefineseen:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2453 /*
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2454 * Make a tag for any macro, unless it is a constant
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2455 * and constantypedefs is FALSE.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2456 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2457 definedef = dignorerest;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2458 *is_func_or_var = (c == '(');
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2459 if (!*is_func_or_var && !constantypedefs)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2460 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2461 else
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2462 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2463 case dignorerest:
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2464 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2465 default:
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2466 error ("internal error: definedef value.", (char *)NULL);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2467 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2468
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2469 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2470 * Now typedefs
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2471 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2472 switch (typdef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2473 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2474 case tnone:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2475 if (toktype == st_C_typedef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2476 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2477 if (typedefs)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2478 typdef = tkeyseen;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2479 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2480 fvdef = fvnone;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2481 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2482 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2483 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2484 case tkeyseen:
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2485 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2486 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2487 case st_none:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2488 case st_C_typespec:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2489 case st_C_class:
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2490 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2491 case st_C_enum:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2492 typdef = ttypeseen;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2493 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2494 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2495 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2496 case ttypeseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2497 if (structdef == snone && fvdef == fvnone)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2498 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2499 fvdef = fvnameseen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2500 return TRUE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2501 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2502 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2503 case tend:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2504 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2505 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2506 case st_C_typespec:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2507 case st_C_class:
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2508 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2509 case st_C_enum:
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2510 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2511 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2512 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2513 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2514
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2515 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2516 * This structdef business is NOT invoked when we are ctags and the
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2517 * file is plain C. This is because a struct tag may have the same
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2518 * name as another tag, and this loses with ctags.
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2519 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2520 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2521 {
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
2522 case st_C_javastruct:
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2523 if (structdef == stagseen)
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2524 structdef = scolonseen;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2525 return FALSE;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2526 case st_C_class:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2527 if (cblev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2528 && (*c_extp & C_AUTO) /* automatic detection of C++ language */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2529 && definedef == dnone && structdef == snone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2530 && typdef == tnone && fvdef == fvnone)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2531 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2532 /* FALLTHRU */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2533 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2534 case st_C_enum:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2535 if (parlev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2536 && fvdef != vignore
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2537 && (typdef == tkeyseen
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2538 || (typedefs_or_cplusplus && structdef == snone)))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2539 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2540 structdef = skeyseen;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2541 structtype = toktype;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2542 structcblev = cblev;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2543 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2544 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2545 }
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2546
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2547 if (structdef == skeyseen)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2548 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2549 structdef = stagseen;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2550 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2551 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2552
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2553 if (typdef != tnone)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2554 definedef = dnone;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2555
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2556 /* Detect Objective C constructs. */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2557 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2558 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2559 case onone:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2560 switch (toktype)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2561 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2562 case st_C_objprot:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2563 objdef = oprotocol;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2564 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2565 case st_C_objimpl:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2566 objdef = oimplementation;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2567 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2568 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2569 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2570 case oimplementation:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2571 /* Save the class tag for functions or variables defined inside. */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2572 objtag = savenstr (str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2573 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2574 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2575 case oprotocol:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2576 /* Save the class tag for categories. */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2577 objtag = savenstr (str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2578 objdef = otagseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2579 *is_func_or_var = TRUE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2580 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2581 case oparenseen:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2582 objdef = ocatseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2583 *is_func_or_var = TRUE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2584 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2585 case oinbody:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2586 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2587 case omethodsign:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2588 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2589 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2590 objdef = omethodtag;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2591 linebuffer_setlen (&token_name, len);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2592 strncpy (token_name.buffer, str, len);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2593 token_name.buffer[len] = '\0';
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2594 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2595 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2596 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2597 case omethodcolon:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2598 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2599 objdef = omethodparm;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2600 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2601 case omethodparm:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2602 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2603 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2604 objdef = omethodtag;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2605 linebuffer_setlen (&token_name, token_name.len + len);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2606 strncat (token_name.buffer, str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2607 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2608 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2609 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2610 case oignore:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2611 if (toktype == st_C_objend)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2612 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2613 /* Memory leakage here: the string pointed by objtag is
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2614 never released, because many tests would be needed to
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2615 avoid breaking on incorrect input code. The amount of
14021
19bab04cf346 (substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents: 13696
diff changeset
2616 memory leaked here is the sum of the lengths of the
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2617 class tags.
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2618 free (objtag); */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2619 objdef = onone;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2620 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2621 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2622 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2623
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2624 /* A function, variable or enum constant? */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2625 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2626 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2627 case st_C_extern:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2628 fvextern = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2629 /* FALLTHRU */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2630 case st_C_typespec:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2631 if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2632 fvdef = fvnone; /* should be useless */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2633 return FALSE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2634 case st_C_ignore:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2635 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2636 fvdef = vignore;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2637 return FALSE;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2638 case st_C_operator:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2639 fvdef = foperator;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2640 *is_func_or_var = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2641 return TRUE;
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2642 case st_none:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2643 if (constantypedefs
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2644 && structdef == snone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2645 && structtype == st_C_enum && cblev > structcblev)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2646 return TRUE; /* enum constant */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2647 switch (fvdef)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2648 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2649 case fdefunkey:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2650 if (cblev > 0)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2651 break;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2652 fvdef = fdefunname; /* GNU macro */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2653 *is_func_or_var = TRUE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2654 return TRUE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2655 case fvnone:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2656 if ((strneq (str, "asm", 3) && endtoken (str[3]))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2657 || (strneq (str, "__asm__", 7) && endtoken (str[7])))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2658 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2659 fvdef = vignore;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2660 return FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2661 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2662 if ((*c_extp & C_PLPL) && strneq (str+len-10, "::operator", 10))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2663 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2664 fvdef = foperator;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2665 *is_func_or_var = TRUE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2666 return TRUE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2667 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2668 if (cblev > 0 && !instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2669 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2670 fvdef = fvnameseen; /* function or variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2671 *is_func_or_var = TRUE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2672 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2673 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2674 break;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2675 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2676
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2677 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2678 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2679
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2680
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2681 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2682 * C_entries often keeps pointers to tokens or lines which are older than
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2683 * the line currently read. By keeping two line buffers, and switching
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2684 * them at end of line, it is possible to use those pointers.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2685 */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2686 struct
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2687 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2688 long linepos;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2689 linebuffer lb;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2690 } lbs[2];
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2691
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2692 #define current_lb_is_new (newndx == curndx)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2693 #define switch_line_buffers() (curndx = 1 - curndx)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2694
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2695 #define curlb (lbs[curndx].lb)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2696 #define newlb (lbs[newndx].lb)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2697 #define curlinepos (lbs[curndx].linepos)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2698 #define newlinepos (lbs[newndx].linepos)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2699
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2700 #define CNL_SAVE_DEFINEDEF() \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2701 do { \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2702 curlinepos = charno; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2703 lineno++; \
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
2704 linecharno = charno; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2705 charno += readline (&curlb, inf); \
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2706 lp = curlb.buffer; \
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2707 quotednl = FALSE; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2708 newndx = curndx; \
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2709 } while (0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2710
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2711 #define CNL() \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2712 do { \
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2713 CNL_SAVE_DEFINEDEF(); \
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2714 if (savetoken.valid) \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2715 { \
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2716 token = savetoken; \
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2717 savetoken.valid = FALSE; \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2718 } \
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2719 definedef = dnone; \
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2720 } while (0)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2721
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2722
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
2723 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2724 make_C_tag (isfun)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2725 bool isfun;
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2726 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2727 /* This function should never be called when token.valid is FALSE, but
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2728 we must protect against invalid input or internal errors. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2729 if (DEBUG || token.valid)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2730 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2731 if (traditional_tag_style)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2732 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2733 /* This was the original code. Now we call new_pfnote instead,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2734 which uses the new method for naming tags (see new_pfnote). */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2735 char *name = NULL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2736
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2737 if (CTAGS || token.named)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2738 name = savestr (token_name.buffer);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2739 if (DEBUG && !token.valid)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2740 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2741 if (token.named)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2742 name = concat (name, "##invalid##", "");
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2743 else
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2744 name = savestr ("##invalid##");
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2745 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2746 pfnote (name, isfun, token.line,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2747 token.offset+token.length+1, token.lineno, token.linepos);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2748 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2749 else
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2750 new_pfnote (token_name.buffer, token_name.len, isfun, token.line,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2751 token.offset+token.length+1, token.lineno, token.linepos);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2752 token.valid = FALSE;
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2753 }
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2754 }
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2755
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2756
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2757 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2758 * C_entries ()
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2759 * This routine finds functions, variables, typedefs,
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2760 * #define's, enum constants and struct/union/enum definitions in
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2761 * C syntax and adds them to the list.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2762 */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
2763 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2764 C_entries (c_ext, inf)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2765 int c_ext; /* extension of C */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2766 FILE *inf; /* input file */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2767 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2768 register char c; /* latest char read; '\0' for end of line */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2769 register char *lp; /* pointer one beyond the character `c' */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2770 int curndx, newndx; /* indices for current and new lb */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2771 register int tokoff; /* offset in line of start of current token */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2772 register int toklen; /* length of current token */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2773 char *qualifier; /* string used to qualify names */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2774 int qlen; /* length of qualifier */
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2775 int cblev; /* current curly brace level */
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2776 int parlev; /* current parenthesis level */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2777 int typdefcblev; /* cblev where a typedef struct body begun */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2778 bool incomm, inquote, inchar, quotednl, midtoken;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2779 bool cplpl, cjava;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2780 bool yacc_rules; /* in the rules part of a yacc file */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2781 struct tok savetoken; /* token saved during preprocessor handling */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2782
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2783
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2784 initbuffer (&token_name);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2785 initbuffer (&lbs[0].lb);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2786 initbuffer (&lbs[1].lb);
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2787 if (cstack.size == 0)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2788 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2789 cstack.size = (DEBUG) ? 1 : 4;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2790 cstack.nl = 0;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2791 cstack.cname = xnew (cstack.size, char *);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2792 cstack.cblev = xnew (cstack.size, int);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2793 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2794
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2795 tokoff = toklen = 0; /* keep compiler quiet */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2796 curndx = newndx = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2797 lineno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2798 charno = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2799 lp = curlb.buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2800 *lp = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2801
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2802 fvdef = fvnone; fvextern = FALSE; typdef = tnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2803 structdef = snone; definedef = dnone; objdef = onone;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2804 yacc_rules = FALSE;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2805 midtoken = inquote = inchar = incomm = quotednl = FALSE;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2806 token.valid = savetoken.valid = FALSE;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2807 cblev = 0;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2808 parlev = 0;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2809 cplpl = (c_ext & C_PLPL) == C_PLPL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2810 cjava = (c_ext & C_JAVA) == C_JAVA;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2811 if (cjava)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2812 { qualifier = "."; qlen = 1; }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2813 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2814 { qualifier = "::"; qlen = 2; }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2815
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2816
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2817 while (!feof (inf))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2818 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2819 c = *lp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2820 if (c == '\\')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2821 {
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
2822 /* If we're at the end of the line, the next character is a
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
2823 '\0'; don't skip it, because it's the thing that tells us
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
2824 to read the next line. */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2825 if (*lp == '\0')
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2826 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2827 quotednl = TRUE;
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2828 continue;
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2829 }
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
2830 lp++;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2831 c = ' ';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2832 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2833 else if (incomm)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2834 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2835 switch (c)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2836 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2837 case '*':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2838 if (*lp == '/')
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2839 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2840 c = *lp++;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2841 incomm = FALSE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2842 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2843 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2844 case '\0':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2845 /* Newlines inside comments do not end macro definitions in
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2846 traditional cpp. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2847 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2848 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2849 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2850 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2851 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2852 else if (inquote)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2853 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2854 switch (c)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2855 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2856 case '"':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2857 inquote = FALSE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2858 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2859 case '\0':
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2860 /* Newlines inside strings do not end macro definitions
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2861 in traditional cpp, even though compilers don't
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2862 usually accept them. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2863 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2864 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2865 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2866 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2867 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2868 else if (inchar)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2869 {
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2870 switch (c)
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2871 {
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2872 case '\0':
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2873 /* Hmmm, something went wrong. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2874 CNL ();
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2875 /* FALLTHRU */
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2876 case '\'':
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2877 inchar = FALSE;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2878 break;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2879 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2880 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2881 }
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
2882 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2883 switch (c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2884 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2885 case '"':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2886 inquote = TRUE;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2887 switch (fvdef)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2888 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2889 case fdefunkey:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2890 case fstartlist:
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2891 case finlist:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2892 case fignore:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2893 case vignore:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2894 break;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2895 default:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2896 fvextern = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2897 fvdef = fvnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2898 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2899 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2900 case '\'':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2901 inchar = TRUE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2902 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2903 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2904 fvextern = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2905 fvdef = fvnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2906 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2907 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2908 case '/':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2909 if (*lp == '*')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2910 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2911 lp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2912 incomm = TRUE;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2913 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2914 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2915 else if (/* cplpl && */ *lp == '/')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2916 {
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2917 c = '\0';
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 621
diff changeset
2918 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2919 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2920 else
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2921 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2922 case '%':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2923 if ((c_ext & YACC) && *lp == '%')
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2924 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2925 /* Entering or exiting rules section in yacc file. */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2926 lp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2927 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2928 typdef = tnone; structdef = snone;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2929 midtoken = inquote = inchar = incomm = quotednl = FALSE;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2930 cblev = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2931 yacc_rules = !yacc_rules;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2932 continue;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2933 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2934 else
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2935 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2936 case '#':
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2937 if (definedef == dnone)
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2938 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2939 char *cp;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2940 bool cpptoken = TRUE;
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2941
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2942 /* Look back on this line. If all blanks, or nonblanks
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2943 followed by an end of comment, this is a preprocessor
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2944 token. */
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2945 for (cp = newlb.buffer; cp < lp-1; cp++)
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2946 if (!iswhite (*cp))
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2947 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2948 if (*cp == '*' && *(cp+1) == '/')
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2949 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2950 cp++;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2951 cpptoken = TRUE;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2952 }
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2953 else
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2954 cpptoken = FALSE;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2955 }
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2956 if (cpptoken)
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2957 definedef = dsharpseen;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2958 } /* if (definedef == dnone) */
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2959
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2960 continue;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2961 } /* switch (c) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2962
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2963
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2964 /* Consider token only if some involved conditions are satisfied. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2965 if (typdef != tignore
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2966 && definedef != dignorerest
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2967 && fvdef != finlist
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2968 && structdef != sintemplate
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2969 && (definedef != dnone
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2970 || structdef != scolonseen))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2971 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2972 if (midtoken)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2973 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2974 if (endtoken (c))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2975 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2976 if (c == ':' && cplpl && *lp == ':' && begtoken (lp[1]))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2977 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2978 /*
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2979 * This handles :: in the middle, but not at the
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2980 * beginning of an identifier. Also, space-separated
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2981 * :: is not recognised.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2982 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2983 lp += 2;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2984 toklen += 2;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2985 c = lp[-1];
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2986 goto intoken;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2987 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2988 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2989 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2990 bool funorvar = FALSE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2991
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2992 if (yacc_rules
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2993 || consider_token (newlb.buffer + tokoff, toklen, c,
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2994 &c_ext, cblev, parlev, &funorvar))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2995 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2996 if (fvdef == foperator)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2997 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2998 char *oldlp = lp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2999 lp = skip_spaces (lp-1);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3000 if (*lp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3001 lp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3002 while (*lp != '\0'
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3003 && !iswhite (*lp) && *lp != '(')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3004 lp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3005 c = *lp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3006 toklen += lp - oldlp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3007 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3008 token.named = FALSE;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3009 if ((c_ext & C_EXT) /* not pure C */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3010 && nestlev > 0 && definedef == dnone)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3011 /* in struct body */
4750
cdefe4f21650 Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents: 4696
diff changeset
3012 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3013 write_classname (&token_name, qualifier);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3014 linebuffer_setlen (&token_name,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3015 token_name.len+qlen+toklen);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3016 strcat (token_name.buffer, qualifier);
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
3017 strncat (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3018 newlb.buffer + tokoff, toklen);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3019 token.named = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3020 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3021 else if (objdef == ocatseen)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3022 /* Objective C category */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3023 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3024 int len = strlen (objtag) + 2 + toklen;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3025 linebuffer_setlen (&token_name, len);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3026 strcpy (token_name.buffer, objtag);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3027 strcat (token_name.buffer, "(");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3028 strncat (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3029 newlb.buffer + tokoff, toklen);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3030 strcat (token_name.buffer, ")");
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3031 token.named = TRUE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3032 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3033 else if (objdef == omethodtag
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3034 || objdef == omethodparm)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3035 /* Objective C method */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3036 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3037 token.named = TRUE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3038 }
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3039 else if (fvdef == fdefunname)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3040 /* GNU DEFUN and similar macros */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3041 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3042 bool defun = (newlb.buffer[tokoff] == 'F');
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3043 int off = tokoff;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3044 int len = toklen;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3045
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3046 /* Rewrite the tag so that emacs lisp DEFUNs
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3047 can be found by their elisp name */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3048 if (defun)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3049 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3050 off += 1;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3051 len -= 1;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3052 }
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3053 len = toklen;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3054 linebuffer_setlen (&token_name, len);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3055 strncpy (token_name.buffer,
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3056 newlb.buffer + off, len);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3057 token_name.buffer[len] = '\0';
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3058 if (defun)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3059 while (--len >= 0)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3060 if (token_name.buffer[len] == '_')
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3061 token_name.buffer[len] = '-';
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3062 token.named = defun;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3063 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3064 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3065 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3066 linebuffer_setlen (&token_name, toklen);
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
3067 strncpy (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3068 newlb.buffer + tokoff, toklen);
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
3069 token_name.buffer[toklen] = '\0';
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3070 /* Name macros and members. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3071 token.named = (structdef == stagseen
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3072 || typdef == ttypeseen
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3073 || typdef == tend
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3074 || (funorvar
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3075 && definedef == dignorerest)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3076 || (funorvar
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3077 && definedef == dnone
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3078 && structdef == snone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3079 && cblev > 0));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3080 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3081 token.lineno = lineno;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3082 token.offset = tokoff;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3083 token.length = toklen;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3084 token.line = newlb.buffer;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3085 token.linepos = newlinepos;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3086 token.valid = TRUE;
4750
cdefe4f21650 Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents: 4696
diff changeset
3087
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3088 if (definedef == dnone
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3089 && (fvdef == fvnameseen
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3090 || fvdef == foperator
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3091 || structdef == stagseen
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3092 || typdef == tend
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3093 || typdef == ttypeseen
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3094 || objdef != onone))
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3095 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3096 if (current_lb_is_new)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3097 switch_line_buffers ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3098 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3099 else if (definedef != dnone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3100 || fvdef == fdefunname
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3101 || instruct)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3102 make_C_tag (funorvar);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3103 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3104 midtoken = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3105 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3106 } /* if (endtoken (c)) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3107 else if (intoken (c))
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3108 intoken:
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3109 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3110 toklen++;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3111 continue;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3112 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3113 } /* if (midtoken) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3114 else if (begtoken (c))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3115 {
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3116 switch (definedef)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3117 {
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3118 case dnone:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3119 switch (fvdef)
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3120 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3121 case fstartlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3122 fvdef = finlist;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3123 continue;
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3124 case flistseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3125 make_C_tag (TRUE); /* a function */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3126 fvdef = fignore;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3127 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3128 case fvnameseen:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3129 fvdef = fvnone;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3130 break;
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3131 }
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3132 if (structdef == stagseen && !cjava)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3133 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3134 popclass_above (cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3135 structdef = snone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3136 }
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3137 break;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3138 case dsharpseen:
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3139 savetoken = token;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3140 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3141 if (!yacc_rules || lp == newlb.buffer + 1)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3142 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3143 tokoff = lp - 1 - newlb.buffer;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3144 toklen = 1;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3145 midtoken = TRUE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3146 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3147 continue;
10623
8a73e71a55e3 * etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents: 10449
diff changeset
3148 } /* if (begtoken) */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3149 } /* if must look at token */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3150
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3151
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3152 /* Detect end of line, colon, comma, semicolon and various braces
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3153 after having handled a token.*/
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3154 switch (c)
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
3155 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3156 case ':':
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3157 if (yacc_rules && token.offset == 0 && token.valid)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3158 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3159 make_C_tag (FALSE); /* a yacc function */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3160 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3161 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3162 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3163 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3164 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3165 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3166 case otagseen:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3167 objdef = oignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3168 make_C_tag (TRUE); /* an Objective C class */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3169 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3170 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3171 case omethodparm:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3172 objdef = omethodcolon;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3173 linebuffer_setlen (&token_name, token_name.len + 1);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3174 strcat (token_name.buffer, ":");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3175 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3176 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3177 if (structdef == stagseen)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3178 structdef = scolonseen;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3179 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3180 case ';':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3181 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3182 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3183 switch (typdef)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3184 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3185 case tend:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3186 case ttypeseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3187 make_C_tag (FALSE); /* a typedef */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3188 typdef = tnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3189 fvdef = fvnone;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3190 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3191 case tnone:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3192 case tinbody:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3193 case tignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3194 switch (fvdef)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3195 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3196 case fignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3197 if (typdef == tignore)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3198 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3199 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3200 case fvnameseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3201 if ((globals && cblev == 0 && (!fvextern || declarations))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3202 || (members && instruct))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3203 make_C_tag (FALSE); /* a variable */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3204 fvextern = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3205 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3206 token.valid = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3207 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3208 case flistseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3209 if ((declarations && typdef == tnone && !instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3210 || (members && typdef != tignore && instruct))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3211 make_C_tag (TRUE); /* a function declaration */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3212 /* FALLTHRU */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3213 default:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3214 fvextern = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3215 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3216 if (declarations
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3217 && structdef == stagseen && (c_ext & C_PLPL))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3218 make_C_tag (FALSE); /* forward declaration */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3219 else
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3220 /* The following instruction invalidates the token.
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3221 Probably the token should be invalidated in all other
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3222 cases where some state machine is reset prematurely. */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3223 token.valid = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3224 } /* switch (fvdef) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3225 /* FALLTHRU */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3226 default:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3227 if (!instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3228 typdef = tnone;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3229 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3230 if (structdef == stagseen)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3231 structdef = snone;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3232 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3233 case ',':
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3234 if (definedef != dnone)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3235 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3236 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3237 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3238 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3239 case omethodparm:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3240 make_C_tag (TRUE); /* an Objective C method */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3241 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3242 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3243 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3244 switch (fvdef)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3245 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3246 case fdefunkey:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3247 case foperator:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3248 case fstartlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3249 case finlist:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3250 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3251 case vignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3252 break;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3253 case fdefunname:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3254 fvdef = fignore;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3255 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3256 case fvnameseen: /* a variable */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3257 if ((globals && cblev == 0 && (!fvextern || declarations))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3258 || (members && instruct))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3259 make_C_tag (FALSE);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3260 break;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3261 case flistseen: /* a function */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3262 if ((declarations && typdef == tnone && !instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3263 || (members && typdef != tignore && instruct))
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3264 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3265 make_C_tag (TRUE); /* a function declaration */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3266 fvdef = fvnameseen;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3267 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3268 else if (!declarations)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3269 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3270 token.valid = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3271 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3272 default:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3273 fvdef = fvnone;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3274 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3275 if (structdef == stagseen)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3276 structdef = snone;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3277 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3278 case '[':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3279 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3280 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3281 if (structdef == stagseen)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3282 structdef = snone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3283 switch (typdef)
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3284 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3285 case ttypeseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3286 case tend:
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3287 typdef = tignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3288 make_C_tag (FALSE); /* a typedef */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3289 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3290 case tnone:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3291 case tinbody:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3292 switch (fvdef)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3293 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3294 case foperator:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3295 case finlist:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3296 case fignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3297 case vignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3298 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3299 case fvnameseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3300 if ((members && cblev == 1)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3301 || (globals && cblev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3302 && (!fvextern || declarations)))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3303 make_C_tag (FALSE); /* a variable */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3304 /* FALLTHRU */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3305 default:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3306 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3307 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3308 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3309 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3310 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3311 case '(':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3312 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3313 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3314 if (objdef == otagseen && parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3315 objdef = oparenseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3316 switch (fvdef)
1938
1045deef809f (C_entries): Don't reset definedef when a newline inside a comment is met.
Richard M. Stallman <rms@gnu.org>
parents: 1796
diff changeset
3317 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3318 case fvnameseen:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3319 if (typdef == ttypeseen
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3320 && *lp != '*'
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3321 && !instruct)
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3322 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3323 /* This handles constructs like:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3324 typedef void OperatorFun (int fun); */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3325 make_C_tag (FALSE);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3326 typdef = tignore;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3327 fvdef = fignore;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3328 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3329 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3330 /* FALLTHRU */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3331 case foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3332 fvdef = fstartlist;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3333 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3334 case flistseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3335 fvdef = finlist;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3336 break;
1938
1045deef809f (C_entries): Don't reset definedef when a newline inside a comment is met.
Richard M. Stallman <rms@gnu.org>
parents: 1796
diff changeset
3337 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3338 parlev++;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3339 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3340 case ')':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3341 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3342 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3343 if (objdef == ocatseen && parlev == 1)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3344 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3345 make_C_tag (TRUE); /* an Objective C category */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3346 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3347 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3348 if (--parlev == 0)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3349 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3350 switch (fvdef)
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3351 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3352 case fstartlist:
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3353 case finlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3354 fvdef = flistseen;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3355 break;
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3356 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3357 if (!instruct
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3358 && (typdef == tend
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3359 || typdef == ttypeseen))
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3360 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3361 typdef = tignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3362 make_C_tag (FALSE); /* a typedef */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3363 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3364 }
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3365 else if (parlev < 0) /* can happen due to ill-conceived #if's. */
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3366 parlev = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3367 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3368 case '{':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3369 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3370 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3371 if (typdef == ttypeseen)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3372 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3373 typdefcblev = cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3374 typdef = tinbody;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3375 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3376 switch (fvdef)
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3377 {
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3378 case flistseen:
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3379 make_C_tag (TRUE); /* a function */
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3380 /* FALLTHRU */
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3381 case fignore:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3382 fvdef = fvnone;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3383 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3384 case fvnone:
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3385 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3386 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3387 case otagseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3388 make_C_tag (TRUE); /* an Objective C class */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3389 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3390 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3391 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3392 case omethodparm:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3393 make_C_tag (TRUE); /* an Objective C method */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3394 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3395 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3396 default:
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
3397 /* Neutralize `extern "C" {' grot. */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3398 if (cblev == 0 && structdef == snone && nestlev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3399 && typdef == tnone)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3400 cblev = -1;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3401 }
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3402 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3403 switch (structdef)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3404 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3405 case skeyseen: /* unnamed struct */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3406 pushclass_above (cblev, NULL, 0);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3407 structdef = snone;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3408 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3409 case stagseen: /* named struct or enum */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3410 case scolonseen: /* a class */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3411 pushclass_above (cblev, token.line+token.offset, token.length);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3412 structdef = snone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3413 make_C_tag (FALSE); /* a struct or enum */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3414 break;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3415 }
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3416 cblev++;
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3417 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3418 case '*':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3419 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3420 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3421 if (fvdef == fstartlist)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3422 fvdef = fvnone; /* avoid tagging `foo' in `foo (*bar()) ()' */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3423 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3424 case '}':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3425 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3426 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3427 if (!noindentypedefs && lp == newlb.buffer + 1)
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3428 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3429 cblev = 0; /* reset curly brace level if first column */
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3430 parlev = 0; /* also reset paren level, just in case... */
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3431 }
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3432 else if (cblev > 0)
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3433 cblev--;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3434 popclass_above (cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3435 structdef = snone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3436 if (typdef == tinbody && cblev <= typdefcblev)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3437 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3438 assert (cblev == typdefcblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3439 typdef = tend;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3440 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3441 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3442 case '=':
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3443 if (definedef != dnone)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3444 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3445 switch (fvdef)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3446 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3447 case foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3448 case finlist:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3449 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3450 case vignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3451 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3452 case fvnameseen:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3453 if ((members && cblev == 1)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3454 || (globals && cblev == 0 && (!fvextern || declarations)))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3455 make_C_tag (FALSE); /* a variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3456 /* FALLTHRU */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3457 default:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3458 fvdef = vignore;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3459 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3460 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3461 case '<':
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3462 if (cplpl && structdef == stagseen)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3463 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3464 structdef = sintemplate;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3465 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3466 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3467 goto resetfvdef;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3468 case '>':
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3469 if (structdef == sintemplate)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3470 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3471 structdef = stagseen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3472 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3473 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3474 goto resetfvdef;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3475 case '+':
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3476 case '-':
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3477 if (objdef == oinbody && cblev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3478 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3479 objdef = omethodsign;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3480 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3481 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3482 /* FALLTHRU */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3483 resetfvdef:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3484 case '#': case '~': case '&': case '%': case '/': case '|':
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3485 case '^': case '!': case '.': case '?': case ']':
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3486 if (definedef != dnone)
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3487 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3488 /* These surely cannot follow a function tag in C. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3489 switch (fvdef)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3490 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3491 case foperator:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3492 case finlist:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3493 case fignore:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3494 case vignore:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3495 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3496 default:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3497 fvdef = fvnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3498 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3499 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3500 case '\0':
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3501 if (objdef == otagseen)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3502 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3503 make_C_tag (TRUE); /* an Objective C class */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3504 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3505 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3506 /* If a macro spans multiple lines don't reset its state. */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3507 if (quotednl)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3508 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3509 else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3510 CNL ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3511 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3512 } /* switch (c) */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3513
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3514 } /* while not eof */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3515
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3516 free (token_name.buffer);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3517 free (lbs[0].lb.buffer);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3518 free (lbs[1].lb.buffer);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3519 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3520
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3521 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3522 * Process either a C++ file or a C file depending on the setting
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3523 * of a global flag.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3524 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3525 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3526 default_C_entries (inf)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3527 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3528 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3529 C_entries (cplusplus ? C_PLPL : C_AUTO, inf);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3530 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3531
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3532 /* Always do plain C. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3533 static void
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3534 plain_C_entries (inf)
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3535 FILE *inf;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3536 {
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3537 C_entries (0, inf);
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3538 }
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3539
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3540 /* Always do C++. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3541 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3542 Cplusplus_entries (inf)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3543 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3544 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3545 C_entries (C_PLPL, inf);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3546 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3547
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3548 /* Always do Java. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3549 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3550 Cjava_entries (inf)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3551 FILE *inf;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3552 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3553 C_entries (C_JAVA, inf);
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3554 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3555
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3556 /* Always do C*. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3557 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3558 Cstar_entries (inf)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3559 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3560 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3561 C_entries (C_STAR, inf);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3562 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3563
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3564 /* Always do Yacc. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3565 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3566 Yacc_entries (inf)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3567 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3568 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3569 C_entries (YACC, inf);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3570 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3571
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3572
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3573 /* A useful macro. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3574 #define LOOP_ON_INPUT_LINES(file_pointer, line_buffer, char_pointer) \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3575 for (lineno = charno = 0; /* loop initialization */ \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3576 !feof (file_pointer) /* loop test */ \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3577 && (lineno++, /* instructions at start of loop */ \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3578 linecharno = charno, \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3579 charno += readline (&line_buffer, file_pointer), \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3580 char_pointer = lb.buffer, \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3581 TRUE); \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3582 )
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3583
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3584
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3585 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3586 * Read a file, but do no processing. This is used to do regexp
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3587 * matching on files that have no language defined.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3588 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3589 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3590 just_read_file (inf)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3591 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3592 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3593 register char *dummy;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3594
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3595 LOOP_ON_INPUT_LINES (inf, lb, dummy)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3596 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3597 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3598
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3599
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3600 /* Fortran parsing */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3601
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3602 static bool tail P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3603 static void takeprec P_((void));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3604 static void getit P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3605
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3606 static bool
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3607 tail (cp)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3608 char *cp;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3609 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3610 register int len = 0;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3611
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3612 while (*cp != '\0' && lowcase (*cp) == lowcase (dbp[len]))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3613 cp++, len++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3614 if (*cp == '\0' && !intoken (dbp[len]))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3615 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3616 dbp += len;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3617 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3618 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3619 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3620 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3621
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3622 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3623 takeprec ()
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3624 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3625 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3626 if (*dbp != '*')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3627 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3628 dbp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3629 dbp = skip_spaces (dbp);
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3630 if (strneq (dbp, "(*)", 3))
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3631 {
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3632 dbp += 3;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3633 return;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3634 }
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3635 if (!ISDIGIT (*dbp))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3636 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3637 --dbp; /* force failure */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3638 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3639 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3640 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3641 dbp++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3642 while (ISDIGIT (*dbp));
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3643 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3644
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3645 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3646 getit (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3647 FILE *inf;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3648 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3649 register char *cp;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3650
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3651 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3652 if (*dbp == '\0')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3653 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3654 lineno++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3655 linecharno = charno;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3656 charno += readline (&lb, inf);
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3657 dbp = lb.buffer;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3658 if (dbp[5] != '&')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3659 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3660 dbp += 6;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3661 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3662 }
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3663 if (!ISALPHA (*dbp) && *dbp != '_' && *dbp != '$')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3664 return;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3665 for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3666 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3667 pfnote (savenstr (dbp, cp-dbp), TRUE,
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3668 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3669 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3670
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3671
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3672 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3673 Fortran_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3674 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3675 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3676 LOOP_ON_INPUT_LINES (inf, lb, dbp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3677 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3678 if (*dbp == '%')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3679 dbp++; /* Ratfor escape to fortran */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3680 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3681 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3682 continue;
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3683 switch (lowcase (*dbp))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3684 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3685 case 'i':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3686 if (tail ("integer"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3687 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3688 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3689 case 'r':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3690 if (tail ("real"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3691 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3692 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3693 case 'l':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3694 if (tail ("logical"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3695 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3696 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3697 case 'c':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3698 if (tail ("complex") || tail ("character"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3699 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3700 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3701 case 'd':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3702 if (tail ("double"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3703 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3704 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3705 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3706 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3707 if (tail ("precision"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3708 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3709 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3710 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3711 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3712 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3713 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3714 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3715 continue;
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3716 switch (lowcase (*dbp))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3717 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3718 case 'f':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3719 if (tail ("function"))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3720 getit (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3721 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3722 case 's':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3723 if (tail ("subroutine"))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3724 getit (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3725 continue;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3726 case 'e':
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3727 if (tail ("entry"))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3728 getit (inf);
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3729 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3730 case 'b':
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3731 if (tail ("blockdata") || tail ("block data"))
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3732 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3733 dbp = skip_spaces (dbp);
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3734 if (*dbp == '\0') /* assume un-named */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3735 pfnote (savestr ("blockdata"), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3736 lb.buffer, dbp - lb.buffer, lineno, linecharno);
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3737 else
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3738 getit (inf); /* look for name */
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3739 }
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3740 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3741 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3742 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3743 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3744
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3745
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3746 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3747 * Ada parsing
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3748 * Philippe Waroquiers <philippe.waroquiers@eurocontrol.be> (1998)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3749 */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3750
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3751 static void adagetit P_((FILE *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3752
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3753 /* Once we are positioned after an "interesting" keyword, let's get
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3754 the real tag value necessary. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3755 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3756 adagetit (inf, name_qualifier)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3757 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3758 char *name_qualifier;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3759 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3760 register char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3761 char *name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3762 char c;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3763
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3764 while (!feof (inf))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3765 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3766 dbp = skip_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3767 if (*dbp == '\0'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3768 || (dbp[0] == '-' && dbp[1] == '-'))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3769 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3770 lineno++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3771 linecharno = charno;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3772 charno += readline (&lb, inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3773 dbp = lb.buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3774 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3775 switch (*dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3776 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3777 case 'b':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3778 case 'B':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3779 if (tail ("body"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3780 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3781 /* Skipping body of procedure body or package body or ....
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3782 resetting qualifier to body instead of spec. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3783 name_qualifier = "/b";
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3784 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3785 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3786 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3787 case 't':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3788 case 'T':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3789 /* Skipping type of task type or protected type ... */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3790 if (tail ("type"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3791 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3792 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3793 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3794 if (*dbp == '"')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3795 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3796 dbp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3797 for (cp = dbp; *cp != '\0' && *cp != '"'; cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3798 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3799 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3800 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3801 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3802 dbp = skip_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3803 for (cp = dbp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3804 (*cp != '\0'
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3805 && (ISALPHA (*cp) || ISDIGIT (*cp) || *cp == '_' || *cp == '.'));
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3806 cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3807 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3808 if (cp == dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3809 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3810 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3811 c = *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3812 *cp = '\0';
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3813 name = concat (dbp, name_qualifier, "");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3814 *cp = c;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3815 pfnote (name, TRUE, lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3816 if (c == '"')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3817 dbp = cp + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3818 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3819 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3820 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3821
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3822 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3823 Ada_funcs (inf)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3824 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3825 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3826 bool inquote = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3827
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3828 LOOP_ON_INPUT_LINES (inf, lb, dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3829 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3830 while (*dbp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3831 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3832 /* Skip a string i.e. "abcd". */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3833 if (inquote || (*dbp == '"'))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3834 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3835 dbp = etags_strchr ((inquote) ? dbp : dbp+1, '"');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3836 if (dbp != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3837 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3838 inquote = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3839 dbp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3840 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3841 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3842 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3843 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3844 inquote = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3845 break; /* advance line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3846 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3847 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3848
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3849 /* Skip comments. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3850 if (dbp[0] == '-' && dbp[1] == '-')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3851 break; /* advance line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3852
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3853 /* Skip character enclosed in single quote i.e. 'a'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3854 and skip single quote starting an attribute i.e. 'Image. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3855 if (*dbp == '\'')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3856 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3857 dbp++ ;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3858 if (*dbp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3859 dbp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3860 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3861 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3862
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3863 /* Search for beginning of a token. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3864 if (!begtoken (*dbp))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3865 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3866 dbp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3867 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3868 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3869
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3870 /* We are at the beginning of a token. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3871 switch (*dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3872 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3873 case 'f':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3874 case 'F':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3875 if (!packages_only && tail ("function"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3876 adagetit (inf, "/f");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3877 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3878 break; /* from switch */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3879 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3880 case 'p':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3881 case 'P':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3882 if (!packages_only && tail ("procedure"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3883 adagetit (inf, "/p");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3884 else if (tail ("package"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3885 adagetit (inf, "/s");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3886 else if (tail ("protected")) /* protected type */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3887 adagetit (inf, "/t");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3888 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3889 break; /* from switch */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3890 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3891 case 't':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3892 case 'T':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3893 if (!packages_only && tail ("task"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3894 adagetit (inf, "/k");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3895 else if (typedefs && !packages_only && tail ("type"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3896 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3897 adagetit (inf, "/t");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3898 while (*dbp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3899 dbp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3900 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3901 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3902 break; /* from switch */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3903 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3904 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3905
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3906 /* Look for the end of the token. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3907 while (!endtoken (*dbp))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3908 dbp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3909
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3910 } /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3911 } /* advance line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3912 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3913
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3914
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3915 /*
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3916 * Bob Weiner, Motorola Inc., 4/3/94
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3917 * Unix and microcontroller assembly tag handling
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3918 * look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]'
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3919 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3920 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3921 Asm_labels (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3922 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3923 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3924 register char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3925
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3926 LOOP_ON_INPUT_LINES (inf, lb, cp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3927 {
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3928 /* If first char is alphabetic or one of [_.$], test for colon
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3929 following identifier. */
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3930 if (ISALPHA (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3931 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3932 /* Read past label. */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3933 cp++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3934 while (ISALNUM (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3935 cp++;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3936 if (*cp == ':' || iswhite (*cp))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3937 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3938 /* Found end of label, so copy it and add it to the table. */
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3939 pfnote (savenstr(lb.buffer, cp-lb.buffer), TRUE,
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3940 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3941 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3942 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3943 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3944 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3945
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3946
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3947 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3948 * Perl support
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3949 * Perl sub names: look for /^sub[ \t\n]+[^ \t\n{]+/
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3950 * Perl variable names: /^(my|local).../
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3951 * Bart Robinson <lomew@cs.utah.edu> (1995)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3952 * Michael Ernst <mernst@alum.mit.edu> (1997)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3953 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3954 static void
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3955 Perl_functions (inf)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3956 FILE *inf;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3957 {
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3958 register char *cp;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3959
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3960 LOOP_ON_INPUT_LINES (inf, lb, cp)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3961 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3962 if (*cp++ == 's'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3963 && *cp++ == 'u'
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3964 && *cp++ == 'b' && iswhite (*cp++))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3965 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3966 cp = skip_spaces (cp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3967 if (*cp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3968 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3969 char *sp = cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3970 while (*cp != '\0'
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3971 && !iswhite (*cp) && *cp != '{' && *cp != '(')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3972 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3973 pfnote (savenstr (sp, cp-sp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3974 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3975 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3976 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3977 else if (globals /* only if tagging global vars is enabled */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3978 && ((cp = lb.buffer,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3979 *cp++ == 'm'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3980 && *cp++ == 'y')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3981 || (cp = lb.buffer,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3982 *cp++ == 'l'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3983 && *cp++ == 'o'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3984 && *cp++ == 'c'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3985 && *cp++ == 'a'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3986 && *cp++ == 'l'))
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3987 && (*cp == '(' || iswhite (*cp)))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3988 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3989 /* After "my" or "local", but before any following paren or space. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3990 char *varname = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3991
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3992 cp = skip_spaces (cp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3993 if (*cp == '$' || *cp == '@' || *cp == '%')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3994 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3995 char* varstart = ++cp;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3996 while (ISALNUM (*cp) || *cp == '_')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3997 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3998 varname = savenstr (varstart, cp-varstart);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3999 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4000 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4001 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4002 /* Should be examining a variable list at this point;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4003 could insist on seeing an open parenthesis. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4004 while (*cp != '\0' && *cp != ';' && *cp != '=' && *cp != ')')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4005 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4006 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4007
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4008 /* Perhaps I should back cp up one character, so the TAGS table
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4009 doesn't mention (and so depend upon) the following char. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4010 pfnote ((CTAGS) ? savenstr (lb.buffer, cp-lb.buffer) : varname,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4011 FALSE, lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4012 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4013 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4014 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4015
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4016
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4017 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4018 * Python support
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4019 * Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4020 * Eric S. Raymond <esr@thyrsus.com> (1997)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4021 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4022 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4023 Python_functions (inf)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4024 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4025 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4026 register char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4027
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4028 LOOP_ON_INPUT_LINES (inf, lb, cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4029 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4030 if (*cp++ == 'd'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4031 && *cp++ == 'e'
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4032 && *cp++ == 'f' && iswhite (*cp++))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4033 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4034 cp = skip_spaces (cp);
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4035 while (*cp != '\0' && !iswhite (*cp) && *cp != '(' && *cp != ':')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4036 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4037 pfnote (NULL, TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4038 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4039 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4040
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4041 cp = lb.buffer;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4042 if (*cp++ == 'c'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4043 && *cp++ == 'l'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4044 && *cp++ == 'a'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4045 && *cp++ == 's'
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4046 && *cp++ == 's' && iswhite (*cp++))
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4047 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4048 cp = skip_spaces (cp);
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4049 while (*cp != '\0' && !iswhite (*cp) && *cp != '(' && *cp != ':')
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4050 cp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4051 pfnote (NULL, TRUE,
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4052 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4053 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4054 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4055 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4056
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4057
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4058 /* Idea by Corny de Souza
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4059 * Cobol tag functions
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4060 * We could look for anything that could be a paragraph name.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4061 * i.e. anything that starts in column 8 is one word and ends in a full stop.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4062 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4063 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4064 Cobol_paragraphs (inf)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4065 FILE *inf;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4066 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4067 register char *bp, *ep;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4068
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4069 LOOP_ON_INPUT_LINES (inf, lb, bp)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4070 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4071 if (lb.len < 9)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4072 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4073 bp += 8;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4074
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4075 /* If eoln, compiler option or comment ignore whole line. */
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4076 if (bp[-1] != ' ' || !ISALNUM (bp[0]))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4077 continue;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4078
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4079 for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4080 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4081 if (*ep++ == '.')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4082 pfnote (savenstr (bp, ep-bp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4083 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4084 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4085 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4086
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4087
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4088 /*
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4089 * Makefile support
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4090 * Idea by Assar Westerlund <assar@sics.se> (2001)
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4091 */
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4092 static void
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4093 Makefile_targets (inf)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4094 FILE *inf;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4095 {
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4096 register char *bp;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4097
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4098 LOOP_ON_INPUT_LINES (inf, lb, bp)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4099 {
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4100 if (*bp == '\t' || *bp == '#')
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4101 continue;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4102 while (*bp != '\0' && *bp != '=' && *bp != ':')
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4103 bp++;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4104 if (*bp == ':')
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4105 pfnote (savenstr (lb.buffer, bp - lb.buffer), TRUE,
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4106 lb.buffer, bp - lb.buffer + 1, lineno, linecharno);
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4107 }
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4108 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4109
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4110
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4111 /* Added by Mosur Mohan, 4/22/88 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4112 /* Pascal parsing */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4113
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4114 /*
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4115 * Locates tags for procedures & functions. Doesn't do any type- or
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4116 * var-definitions. It does look for the keyword "extern" or
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4117 * "forward" immediately following the procedure statement; if found,
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4118 * the tag is skipped.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4119 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4120 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4121 Pascal_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4122 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4123 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4124 linebuffer tline; /* mostly copied from C_entries */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4125 long save_lcno;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4126 int save_lineno, save_len;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
4127 char c, *cp, *namebuf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4128
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4129 bool /* each of these flags is TRUE iff: */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4130 incomment, /* point is inside a comment */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4131 inquote, /* point is inside '..' string */
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4132 get_tagname, /* point is after PROCEDURE/FUNCTION
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4133 keyword, so next item = potential tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4134 found_tag, /* point is after a potential tag */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4135 inparms, /* point is within parameter-list */
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4136 verify_tag; /* point has passed the parm-list, so the
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4137 next token will determine whether this
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4138 is a FORWARD/EXTERN to be ignored, or
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4139 whether it is a real tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4140
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4141 save_lcno = save_lineno = save_len = 0; /* keep compiler quiet */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4142 namebuf = NULL; /* keep compiler quiet */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4143 lineno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4144 charno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4145 dbp = lb.buffer;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4146 *dbp = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4147 initbuffer (&tline);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4148
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4149 incomment = inquote = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4150 found_tag = FALSE; /* have a proc name; check if extern */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4151 get_tagname = FALSE; /* have found "procedure" keyword */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4152 inparms = FALSE; /* found '(' after "proc" */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4153 verify_tag = FALSE; /* check if "extern" is ahead */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4154
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4155
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4156 while (!feof (inf)) /* long main loop to get next char */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4157 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4158 c = *dbp++;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4159 if (c == '\0') /* if end of line */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4160 {
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
4161 lineno++;
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
4162 linecharno = charno;
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
4163 charno += readline (&lb, inf);
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
4164 dbp = lb.buffer;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4165 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4166 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4167 if (!((found_tag && verify_tag)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4168 || get_tagname))
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4169 c = *dbp++; /* only if don't need *dbp pointing
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4170 to the beginning of the name of
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4171 the procedure or function */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4172 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4173 if (incomment)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4174 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4175 if (c == '}') /* within { } comments */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4176 incomment = FALSE;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4177 else if (c == '*' && *dbp == ')') /* within (* *) comments */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4178 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4179 dbp++;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4180 incomment = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4181 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4182 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4183 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4184 else if (inquote)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4185 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4186 if (c == '\'')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4187 inquote = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4188 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4189 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4190 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4191 switch (c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4192 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4193 case '\'':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4194 inquote = TRUE; /* found first quote */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4195 continue;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4196 case '{': /* found open { comment */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4197 incomment = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4198 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4199 case '(':
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4200 if (*dbp == '*') /* found open (* comment */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4201 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4202 incomment = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4203 dbp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4204 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4205 else if (found_tag) /* found '(' after tag, i.e., parm-list */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4206 inparms = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4207 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4208 case ')': /* end of parms list */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4209 if (inparms)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4210 inparms = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4211 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4212 case ';':
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4213 if (found_tag && !inparms) /* end of proc or fn stmt */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4214 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4215 verify_tag = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4216 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4217 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4218 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4219 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4220 if (found_tag && verify_tag && (*dbp != ' '))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4221 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4222 /* check if this is an "extern" declaration */
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4223 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4224 continue;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4225 if (lowcase (*dbp == 'e'))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4226 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4227 if (tail ("extern")) /* superfluous, really! */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4228 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4229 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4230 verify_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4231 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4232 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4233 else if (lowcase (*dbp) == 'f')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4234 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4235 if (tail ("forward")) /* check for forward reference */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4236 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4237 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4238 verify_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4239 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4240 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4241 if (found_tag && verify_tag) /* not external proc, so make tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4242 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4243 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4244 verify_tag = FALSE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
4245 pfnote (namebuf, TRUE,
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4246 tline.buffer, save_len, save_lineno, save_lcno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4247 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4248 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4249 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4250 if (get_tagname) /* grab name of proc or fn */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4251 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4252 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4253 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4254
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4255 /* save all values for later tagging */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4256 linebuffer_setlen (&tline, lb.len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4257 strcpy (tline.buffer, lb.buffer);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4258 save_lineno = lineno;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4259 save_lcno = linecharno;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4260
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4261 /* grab block name */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4262 for (cp = dbp + 1; *cp != '\0' && !endtoken (*cp); cp++)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4263 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
4264 namebuf = savenstr (dbp, cp-dbp);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
4265 dbp = cp; /* set dbp to e-o-token */
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4266 save_len = dbp - lb.buffer + 1;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4267 get_tagname = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4268 found_tag = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4269 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4270
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4271 /* and proceed to check for "extern" */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4272 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4273 else if (!incomment && !inquote && !found_tag)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4274 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4275 /* check for proc/fn keywords */
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
4276 switch (lowcase (c))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4277 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4278 case 'p':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4279 if (tail ("rocedure")) /* c = 'p', dbp has advanced */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4280 get_tagname = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4281 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4282 case 'f':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4283 if (tail ("unction"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4284 get_tagname = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4285 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4286 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4287 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4288 } /* while not eof */
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4289
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4290 free (tline.buffer);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4291 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4292
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4293
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4294 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4295 * Lisp tag functions
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4296 * look for (def or (DEF, quote or QUOTE
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4297 */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4298
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4299 static int L_isdef P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4300 static int L_isquote P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4301 static void L_getit P_((void));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4302
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4303 static int
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4304 L_isdef (strp)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4305 register char *strp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4306 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4307 return ((strp[1] == 'd' || strp[1] == 'D')
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4308 && (strp[2] == 'e' || strp[2] == 'E')
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4309 && (strp[3] == 'f' || strp[3] == 'F'));
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4310 }
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4311
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4312 static int
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4313 L_isquote (strp)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4314 register char *strp;
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4315 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4316 return ((*++strp == 'q' || *strp == 'Q')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4317 && (*++strp == 'u' || *strp == 'U')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4318 && (*++strp == 'o' || *strp == 'O')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4319 && (*++strp == 't' || *strp == 'T')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4320 && (*++strp == 'e' || *strp == 'E')
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4321 && iswhite (*++strp));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4322 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4323
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4324 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4325 L_getit ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4326 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4327 register char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4328
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4329 if (*dbp == '\'') /* Skip prefix quote */
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4330 dbp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4331 else if (*dbp == '(')
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4332 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4333 if (L_isquote (dbp))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4334 dbp += 7; /* Skip "(quote " */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4335 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4336 dbp += 1; /* Skip "(" before name in (defstruct (foo)) */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4337 dbp = skip_spaces (dbp);
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4338 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4339
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4340 for (cp = dbp /*+1*/;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4341 *cp != '\0' && *cp != '(' && !iswhite(*cp) && *cp != ')';
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4342 cp++)
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4343 continue;
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4344 if (cp == dbp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4345 return;
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4346
20071
dd3a2332a66f (L_getit): Always make named tags so that Emacs
Karl Heuer <kwzh@gnu.org>
parents: 19185
diff changeset
4347 pfnote (savenstr (dbp, cp-dbp), TRUE,
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
4348 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4349 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4350
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4351 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4352 Lisp_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4353 FILE *inf;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4354 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4355 LOOP_ON_INPUT_LINES (inf, lb, dbp)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4356 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4357 if (dbp[0] == '(')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4358 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4359 if (L_isdef (dbp))
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4360 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4361 dbp = skip_non_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4362 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4363 L_getit ();
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4364 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4365 else
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4366 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4367 /* Check for (foo::defmumble name-defined ... */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4368 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4369 dbp++;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4370 while (*dbp != '\0' && !iswhite (*dbp)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4371 && *dbp != ':' && *dbp != '(' && *dbp != ')');
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4372 if (*dbp == ':')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4373 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4374 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4375 dbp++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4376 while (*dbp == ':');
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4377
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4378 if (L_isdef (dbp - 1))
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4379 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4380 dbp = skip_non_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4381 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4382 L_getit ();
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4383 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4384 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4385 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4386 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4387 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4388 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4389
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4390
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4391 /*
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4392 * Postscript tag functions
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4393 * Just look for lines where the first character is '/'
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4394 * Also look at "defineps" for PSWrap
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4395 * Richard Mlynarik <mly@adoc.xerox.com> (1997)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4396 * Ideas by Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4397 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4398 static void
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4399 Postscript_functions (inf)
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4400 FILE *inf;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4401 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4402 register char *bp, *ep;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4403
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4404 LOOP_ON_INPUT_LINES (inf, lb, bp)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4405 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4406 if (bp[0] == '/')
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4407 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4408 for (ep = bp+1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4409 *ep != '\0' && *ep != ' ' && *ep != '{';
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4410 ep++)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4411 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4412 pfnote (savenstr (bp, ep-bp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4413 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4414 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4415 else if (strneq (bp, "defineps", 8))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4416 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4417 bp = skip_non_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4418 bp = skip_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4419 get_tag (bp);
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4420 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4421 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4422 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4423
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4424
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4425 /*
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4426 * Scheme tag functions
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4427 * look for (def... xyzzy
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4428 * look for (def... (xyzzy
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4429 * look for (def ... ((...(xyzzy ....
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4430 * look for (set! xyzzy
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4431 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4432
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4433 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4434 Scheme_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4435 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4436 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4437 register char *bp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4438
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4439 LOOP_ON_INPUT_LINES (inf, lb, bp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4440 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4441 if (bp[0] == '('
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4442 && (bp[1] == 'D' || bp[1] == 'd')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4443 && (bp[2] == 'E' || bp[2] == 'e')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4444 && (bp[3] == 'F' || bp[3] == 'f'))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4445 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4446 bp = skip_non_spaces (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4447 /* Skip over open parens and white space */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4448 while (iswhite (*bp) || *bp == '(')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4449 bp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4450 get_tag (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4451 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4452 if (bp[0] == '('
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4453 && (bp[1] == 'S' || bp[1] == 's')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4454 && (bp[2] == 'E' || bp[2] == 'e')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4455 && (bp[3] == 'T' || bp[3] == 't')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4456 && (bp[4] == '!' || bp[4] == '!')
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4457 && (iswhite (bp[5])))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4458 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4459 bp = skip_non_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4460 bp = skip_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4461 get_tag (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4462 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4463 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4464 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4465
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4466
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4467 /* Find tags in TeX and LaTeX input files. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4468
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4469 /* TEX_toktab is a table of TeX control sequences that define tags.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4470 Each TEX_tabent records one such control sequence.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4471 CONVERT THIS TO USE THE Stab TYPE!! */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4472 struct TEX_tabent
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4473 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4474 char *name;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4475 int len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4476 };
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4477
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4478 struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4479
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4480 /* Default set of control sequences to put into TEX_toktab.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4481 The value of environment var TEXTAGS is prepended to this. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4482
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4483 char *TEX_defenv = "\
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4484 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4485 :part:appendix:entry:index";
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4486
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4487 static void TEX_mode P_((FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4488 static struct TEX_tabent *TEX_decode_env P_((char *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4489 static int TEX_Token P_((char *));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4490
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4491 char TEX_esc = '\\';
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4492 char TEX_opgrp = '{';
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4493 char TEX_clgrp = '}';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4494
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4495 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4496 * TeX/LaTeX scanning loop.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4497 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4498 static void
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4499 TeX_commands (inf)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4500 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4501 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4502 char *cp, *lasthit;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4503 register int i;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4504
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4505 /* Select either \ or ! as escape character. */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4506 TEX_mode (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4507
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4508 /* Initialize token table once from environment. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4509 if (!TEX_toktab)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4510 TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4511
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4512 LOOP_ON_INPUT_LINES (inf, lb, cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4513 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4514 lasthit = cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4515 /* Look at each esc in line. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4516 while ((cp = etags_strchr (cp, TEX_esc)) != NULL)
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4517 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4518 if (*++cp == '\0')
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4519 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4520 linecharno += cp - lasthit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4521 lasthit = cp;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4522 i = TEX_Token (lasthit);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4523 if (i >= 0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4524 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4525 /* We seem to include the TeX command in the tag name.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4526 register char *p;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4527 for (p = lasthit + TEX_toktab[i].len;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4528 *p != '\0' && *p != TEX_clgrp;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4529 p++)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4530 continue; */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4531 pfnote (/*savenstr (lasthit, p-lasthit)*/ (char *)NULL, TRUE,
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4532 lb.buffer, lb.len, lineno, linecharno);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4533 break; /* We only tag a line once */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4534 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4535 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4536 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4537 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4538
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4539 #define TEX_LESC '\\'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4540 #define TEX_SESC '!'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4541 #define TEX_cmt '%'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4542
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4543 /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4544 chars accordingly. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4545 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4546 TEX_mode (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4547 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4548 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4549 int c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4550
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4551 while ((c = getc (inf)) != EOF)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4552 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4553 /* Skip to next line if we hit the TeX comment char. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4554 if (c == TEX_cmt)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4555 while (c != '\n')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4556 c = getc (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4557 else if (c == TEX_LESC || c == TEX_SESC )
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4558 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4559 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4560
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4561 if (c == TEX_LESC)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4562 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4563 TEX_esc = TEX_LESC;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4564 TEX_opgrp = '{';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4565 TEX_clgrp = '}';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4566 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4567 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4568 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4569 TEX_esc = TEX_SESC;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4570 TEX_opgrp = '<';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4571 TEX_clgrp = '>';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4572 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4573 /* If the input file is compressed, inf is a pipe, and rewind may fail.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4574 No attempt is made to correct the situation. */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4575 rewind (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4576 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4577
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4578 /* Read environment and prepend it to the default string.
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4579 Build token table. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4580 static struct TEX_tabent *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4581 TEX_decode_env (evarname, defenv)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4582 char *evarname;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4583 char *defenv;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4584 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4585 register char *env, *p;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4586
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4587 struct TEX_tabent *tab;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4588 int size, i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4589
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4590 /* Append default string to environment. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4591 env = getenv (evarname);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4592 if (!env)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4593 env = defenv;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4594 else
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4595 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4596 char *oldenv = env;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4597 env = concat (oldenv, defenv, "");
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4598 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4599
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4600 /* Allocate a token table */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4601 for (size = 1, p = env; p;)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4602 if ((p = etags_strchr (p, ':')) && *++p != '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4603 size++;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4604 /* Add 1 to leave room for null terminator. */
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4605 tab = xnew (size + 1, struct TEX_tabent);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4606
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4607 /* Unpack environment string into token table. Be careful about */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4608 /* zero-length strings (leading ':', "::" and trailing ':') */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4609 for (i = 0; *env;)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4610 {
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
4611 p = etags_strchr (env, ':');
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4612 if (!p) /* End of environment string. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4613 p = env + strlen (env);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4614 if (p - env > 0)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4615 { /* Only non-zero strings. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4616 tab[i].name = savenstr (env, p - env);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4617 tab[i].len = strlen (tab[i].name);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4618 i++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4619 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4620 if (*p)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4621 env = p + 1;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4622 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4623 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4624 tab[i].name = NULL; /* Mark end of table. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4625 tab[i].len = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4626 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4627 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4628 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4629 return tab;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4630 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4631
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4632 /* If the text at CP matches one of the tag-defining TeX command names,
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
4633 return the pointer to the first occurrence of that command in TEX_toktab.
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4634 Otherwise return -1.
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4635 Keep the capital `T' in `token' for dumb truncating compilers
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4636 (this distinguishes it from `TEX_toktab' */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4637 static int
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4638 TEX_Token (cp)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4639 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4640 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4641 int i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4642
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4643 for (i = 0; TEX_toktab[i].len > 0; i++)
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
4644 if (strneq (TEX_toktab[i].name, cp, TEX_toktab[i].len))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4645 return i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4646 return -1;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4647 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4648
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4649
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4650 /* Texinfo support. Dave Love, Mar. 2000. */
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4651 static void
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4652 Texinfo_nodes (inf)
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4653 FILE * inf;
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4654 {
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4655 char *cp, *start;
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4656 LOOP_ON_INPUT_LINES (inf, lb, cp)
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4657 {
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4658 if ((*cp++ == '@'
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4659 && *cp++ == 'n'
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4660 && *cp++ == 'o'
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4661 && *cp++ == 'd'
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4662 && *cp++ == 'e' && iswhite (*cp++)))
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4663 {
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4664 start = cp = skip_spaces(cp);
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4665 while (*cp != '\0' && *cp != ',')
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4666 cp++;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4667 pfnote (savenstr (start, cp - start), TRUE,
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4668 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4669 }
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4670 }
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4671 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4672
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4673
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4674 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4675 * Prolog support (rewritten) by Anders Lindgren, Mar. 96
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4676 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4677 * Assumes that the predicate starts at column 0.
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4678 * Only the first clause of a predicate is added.
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4679 */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4680 static int prolog_pred P_((char *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4681 static void prolog_skip_comment P_((linebuffer *, FILE *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4682 static int prolog_atom P_((char *, int));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4683
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4684 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4685 Prolog_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4686 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4687 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4688 char *cp, *last;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4689 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4690 int allocated;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4691
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4692 allocated = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4693 len = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4694 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4695
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4696 LOOP_ON_INPUT_LINES (inf, lb, cp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4697 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4698 if (cp[0] == '\0') /* Empty line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4699 continue;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4700 else if (iswhite (cp[0])) /* Not a predicate */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4701 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4702 else if (cp[0] == '/' && cp[1] == '*') /* comment. */
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
4703 prolog_skip_comment (&lb, inf);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4704 else if ((len = prolog_pred (cp, last)) > 0)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4705 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4706 /* Predicate. Store the function name so that we only
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
4707 generate a tag for the first clause. */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4708 if (last == NULL)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4709 last = xnew(len + 1, char);
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4710 else if (len + 1 > allocated)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4711 xrnew (last, len + 1, char);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4712 allocated = len + 1;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4713 strncpy (last, cp, len);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4714 last[len] = '\0';
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4715 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4716 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4717 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4718
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4719
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4720 static void
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4721 prolog_skip_comment (plb, inf)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4722 linebuffer *plb;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4723 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4724 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4725 char *cp;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4726
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4727 do
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4728 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4729 for (cp = plb->buffer; *cp != '\0'; cp++)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4730 if (cp[0] == '*' && cp[1] == '/')
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4731 return;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4732 lineno++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4733 linecharno += readline (plb, inf);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4734 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4735 while (!feof(inf));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4736 }
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4737
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4738 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4739 * A predicate definition is added if it matches:
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4740 * <beginning of line><Prolog Atom><whitespace>(
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4741 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4742 * It is added to the tags database if it doesn't match the
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4743 * name of the previous clause header.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4744 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4745 * Return the size of the name of the predicate, or 0 if no header
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4746 * was found.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4747 */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
4748 static int
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4749 prolog_pred (s, last)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4750 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4751 char *last; /* Name of last clause. */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4752 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4753 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4754 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4755
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4756 pos = prolog_atom (s, 0);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4757 if (pos < 1)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4758 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4759
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4760 len = pos;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4761 pos = skip_spaces (s + pos) - s;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4762
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4763 if ((s[pos] == '(') || (s[pos] == '.'))
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4764 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4765 if (s[pos] == '(')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4766 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4767
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4768 /* Save only the first clause. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4769 if (last == NULL
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4770 || len != (int)strlen (last)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4771 || !strneq (s, last, len))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4772 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4773 pfnote (savenstr (s, len), TRUE, s, pos, lineno, linecharno);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4774 return len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4775 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4776 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4777 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4778 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4779
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4780 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4781 * Consume a Prolog atom.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4782 * Return the number of bytes consumed, or -1 if there was an error.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4783 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4784 * A prolog atom, in this context, could be one of:
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4785 * - An alphanumeric sequence, starting with a lower case letter.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4786 * - A quoted arbitrary string. Single quotes can escape themselves.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4787 * Backslash quotes everything.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4788 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4789 static int
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4790 prolog_atom (s, pos)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4791 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4792 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4793 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4794 int origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4795
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4796 origpos = pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4797
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4798 if (ISLOWER(s[pos]) || (s[pos] == '_'))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4799 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4800 /* The atom is unquoted. */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4801 pos++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4802 while (ISALNUM(s[pos]) || (s[pos] == '_'))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4803 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4804 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4805 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4806 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4807 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4808 else if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4809 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4810 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4811
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4812 while (1)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4813 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4814 if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4815 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4816 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4817 if (s[pos] != '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4818 break;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4819 pos++; /* A double quote */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4820 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4821 else if (s[pos] == '\0')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4822 /* Multiline quoted atoms are ignored. */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4823 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4824 else if (s[pos] == '\\')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4825 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4826 if (s[pos+1] == '\0')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4827 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4828 pos += 2;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4829 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4830 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4831 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4832 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4833 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4834 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4835 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4836 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4837 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4838
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4839
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4840 /*
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4841 * Support for Erlang -- Anders Lindgren, Feb 1996.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4842 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4843 * Generates tags for functions, defines, and records.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4844 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4845 * Assumes that Erlang functions start at column 0.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4846 */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4847 static int erlang_func P_((char *, char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4848 static void erlang_attribute P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4849 static int erlang_atom P_((char *, int));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4850
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4851 static void
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4852 Erlang_functions (inf)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4853 FILE *inf;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4854 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4855 char *cp, *last;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4856 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4857 int allocated;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4858
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4859 allocated = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4860 len = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4861 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4862
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4863 LOOP_ON_INPUT_LINES (inf, lb, cp)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4864 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4865 if (cp[0] == '\0') /* Empty line */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4866 continue;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4867 else if (iswhite (cp[0])) /* Not function nor attribute */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4868 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4869 else if (cp[0] == '%') /* comment */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4870 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4871 else if (cp[0] == '"') /* Sometimes, strings start in column one */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4872 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4873 else if (cp[0] == '-') /* attribute, e.g. "-define" */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4874 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4875 erlang_attribute (cp);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4876 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4877 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4878 else if ((len = erlang_func (cp, last)) > 0)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4879 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4880 /*
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4881 * Function. Store the function name so that we only
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4882 * generates a tag for the first clause.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4883 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4884 if (last == NULL)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4885 last = xnew (len + 1, char);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4886 else if (len + 1 > allocated)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4887 xrnew (last, len + 1, char);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4888 allocated = len + 1;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4889 strncpy (last, cp, len);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4890 last[len] = '\0';
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4891 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4892 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4893 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4894
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4895
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4896 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4897 * A function definition is added if it matches:
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4898 * <beginning of line><Erlang Atom><whitespace>(
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4899 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4900 * It is added to the tags database if it doesn't match the
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4901 * name of the previous clause header.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4902 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4903 * Return the size of the name of the function, or 0 if no function
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4904 * was found.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4905 */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
4906 static int
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4907 erlang_func (s, last)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4908 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4909 char *last; /* Name of last clause. */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4910 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4911 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4912 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4913
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4914 pos = erlang_atom (s, 0);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4915 if (pos < 1)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4916 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4917
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4918 len = pos;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4919 pos = skip_spaces (s + pos) - s;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4920
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4921 /* Save only the first clause. */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4922 if (s[pos++] == '('
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4923 && (last == NULL
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4924 || len != (int)strlen (last)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4925 || !strneq (s, last, len)))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4926 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4927 pfnote (savenstr (s, len), TRUE, s, pos, lineno, linecharno);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4928 return len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4929 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4930
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4931 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4932 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4933
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4934
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4935 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4936 * Handle attributes. Currently, tags are generated for defines
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4937 * and records.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4938 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4939 * They are on the form:
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4940 * -define(foo, bar).
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4941 * -define(Foo(M, N), M+N).
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4942 * -record(graph, {vtab = notable, cyclic = true}).
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4943 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4944 static void
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4945 erlang_attribute (s)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4946 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4947 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4948 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4949 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4950
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4951 if (strneq (s, "-define", 7) || strneq (s, "-record", 7))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4952 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4953 pos = skip_spaces (s + 7) - s;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4954 if (s[pos++] == '(')
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4955 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4956 pos = skip_spaces (s + pos) - s;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4957 len = erlang_atom (s, pos);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4958 if (len != 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4959 pfnote (savenstr (& s[pos], len), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4960 s, pos + len, lineno, linecharno);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4961 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4962 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4963 return;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4964 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4965
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4966
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4967 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4968 * Consume an Erlang atom (or variable).
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4969 * Return the number of bytes consumed, or -1 if there was an error.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4970 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4971 static int
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4972 erlang_atom (s, pos)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4973 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4974 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4975 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4976 int origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4977
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4978 origpos = pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4979
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4980 if (ISALPHA (s[pos]) || s[pos] == '_')
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4981 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4982 /* The atom is unquoted. */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4983 pos++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4984 while (ISALNUM (s[pos]) || s[pos] == '_')
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4985 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4986 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4987 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4988 else if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4989 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4990 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4991
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4992 while (1)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4993 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4994 if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4995 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4996 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4997 break;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4998 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4999 else if (s[pos] == '\0')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5000 /* Multiline quoted atoms are ignored. */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5001 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5002 else if (s[pos] == '\\')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5003 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5004 if (s[pos+1] == '\0')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5005 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5006 pos += 2;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5007 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5008 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5009 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5010 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5011 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5012 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5013 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5014 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5015 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5016
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5017
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5018 #ifdef ETAGS_REGEXPS
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5019
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5020 static char *scan_separators P_((char *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5021 static void analyse_regex P_((char *, bool));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5022 static void add_regex P_((char *, bool, language *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5023 static char *substitute P_((char *, char *, struct re_registers *));
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5024
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5025 /* Take a string like "/blah/" and turn it into "blah", making sure
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5026 that the first and last characters are the same, and handling
14021
19bab04cf346 (substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents: 13696
diff changeset
5027 quoted separator characters. Actually, stops on the occurrence of
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5028 an unquoted separator. Also turns "\t" into a Tab character.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5029 Returns pointer to terminating separator. Works in place. Null
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5030 terminates name string. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5031 static char *
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5032 scan_separators (name)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5033 char *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5034 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5035 char sep = name[0];
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5036 char *copyto = name;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
5037 bool quoted = FALSE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5038
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5039 for (++name; *name != '\0'; ++name)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5040 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5041 if (quoted)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5042 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5043 if (*name == 't')
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5044 *copyto++ = '\t';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5045 else if (*name == sep)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5046 *copyto++ = sep;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5047 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5048 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5049 /* Something else is quoted, so preserve the quote. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5050 *copyto++ = '\\';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5051 *copyto++ = *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5052 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5053 quoted = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5054 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5055 else if (*name == '\\')
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5056 quoted = TRUE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5057 else if (*name == sep)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5058 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5059 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5060 *copyto++ = *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5061 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5062
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5063 /* Terminate copied string. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5064 *copyto = '\0';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5065 return name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5066 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5067
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5068 /* Look at the argument of --regex or --no-regex and do the right
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5069 thing. Same for each line of a regexp file. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5070 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5071 analyse_regex (regex_arg, ignore_case)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5072 char *regex_arg;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5073 bool ignore_case;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5074 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5075 if (regex_arg == NULL)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5076 free_patterns (); /* --no-regex: remove existing regexps */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5077
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5078 /* A real --regexp option or a line in a regexp file. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5079 switch (regex_arg[0])
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5080 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5081 /* Comments in regexp file or null arg to --regex. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5082 case '\0':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5083 case ' ':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5084 case '\t':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5085 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5086
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5087 /* Read a regex file. This is recursive and may result in a
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5088 loop, which will stop when the file descriptors are exhausted. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5089 case '@':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5090 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5091 FILE *regexfp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5092 linebuffer regexbuf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5093 char *regexfile = regex_arg + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5094
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5095 /* regexfile is a file containing regexps, one per line. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5096 regexfp = fopen (regexfile, "r");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5097 if (regexfp == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5098 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5099 pfatal (regexfile);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5100 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5101 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5102 initbuffer (&regexbuf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5103 while (readline_internal (&regexbuf, regexfp) > 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5104 analyse_regex (regexbuf.buffer, ignore_case);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5105 free (regexbuf.buffer);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5106 fclose (regexfp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5107 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5108 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5109
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5110 /* Regexp to be used for a specific language only. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5111 case '{':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5112 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5113 language *lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5114 char *lang_name = regex_arg + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5115 char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5116
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5117 for (cp = lang_name; *cp != '}'; cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5118 if (*cp == '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5119 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5120 error ("unterminated language name in regex: %s", regex_arg);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5121 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5122 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5123 *cp = '\0';
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
5124 lang = get_language_from_langname (lang_name);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5125 if (lang == NULL)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5126 return;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5127 add_regex (cp + 1, ignore_case, lang);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5128 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5129 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5130
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5131 /* Regexp to be used for any language. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5132 default:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5133 add_regex (regex_arg, ignore_case, NULL);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5134 break;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5135 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5136 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5137
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5138 /* Turn a name, which is an ed-style (but Emacs syntax) regular
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5139 expression, into a real regular expression by compiling it. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5140 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5141 add_regex (regexp_pattern, ignore_case, lang)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5142 char *regexp_pattern;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5143 bool ignore_case;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5144 language *lang;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5145 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5146 char *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5147 const char *err;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5148 struct re_pattern_buffer *patbuf;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5149 pattern *pp;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5150
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5151
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5152 if (regexp_pattern[strlen(regexp_pattern)-1] != regexp_pattern[0])
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5153 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5154 error ("%s: unterminated regexp", regexp_pattern);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5155 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5156 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5157 name = scan_separators (regexp_pattern);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5158 if (regexp_pattern[0] == '\0')
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5159 {
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5160 error ("null regexp", (char *)NULL);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5161 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5162 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5163 (void) scan_separators (name);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5164
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5165 patbuf = xnew (1, struct re_pattern_buffer);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5166 /* Translation table to fold case if appropriate. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5167 patbuf->translate = (ignore_case) ? lc_trans : NULL;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5168 patbuf->fastmap = NULL;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5169 patbuf->buffer = NULL;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5170 patbuf->allocated = 0;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5171
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5172 err = re_compile_pattern (regexp_pattern, strlen (regexp_pattern), patbuf);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5173 if (err != NULL)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5174 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5175 error ("%s while compiling pattern", err);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5176 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5177 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5178
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5179 pp = p_head;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5180 p_head = xnew (1, pattern);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5181 p_head->regex = savestr (regexp_pattern);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5182 p_head->p_next = pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5183 p_head->language = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5184 p_head->pattern = patbuf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5185 p_head->name_pattern = savestr (name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5186 p_head->error_signaled = FALSE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5187 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5188
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5189 /*
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
5190 * Do the substitutions indicated by the regular expression and
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5191 * arguments.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5192 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5193 static char *
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5194 substitute (in, out, regs)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5195 char *in, *out;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5196 struct re_registers *regs;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5197 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5198 char *result, *t;
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5199 int size, dig, diglen;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5200
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5201 result = NULL;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5202 size = strlen (out);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5203
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5204 /* Pass 1: figure out how much to allocate by finding all \N strings. */
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5205 if (out[size - 1] == '\\')
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5206 fatal ("pattern error in \"%s\"", out);
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5207 for (t = etags_strchr (out, '\\');
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5208 t != NULL;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5209 t = etags_strchr (t + 2, '\\'))
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5210 if (ISDIGIT (t[1]))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5211 {
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5212 dig = t[1] - '0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5213 diglen = regs->end[dig] - regs->start[dig];
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5214 size += diglen - 2;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5215 }
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5216 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5217 size -= 1;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5218
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5219 /* Allocate space and do the substitutions. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5220 result = xnew (size + 1, char);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5221
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5222 for (t = result; *out != '\0'; out++)
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5223 if (*out == '\\' && ISDIGIT (*++out))
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5224 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5225 dig = *out - '0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5226 diglen = regs->end[dig] - regs->start[dig];
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5227 strncpy (t, in + regs->start[dig], diglen);
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5228 t += diglen;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5229 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5230 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5231 *t++ = *out;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5232 *t = '\0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5233
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5234 assert (t <= result + size && t - result == (int)strlen (result));
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5235
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5236 return result;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5237 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5238
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5239 /* Deallocate all patterns. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5240 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5241 free_patterns ()
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5242 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5243 pattern *pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5244 while (p_head != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5245 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5246 pp = p_head->p_next;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5247 free (p_head->regex);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5248 free (p_head->name_pattern);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5249 free (p_head);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5250 p_head = pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5251 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5252 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5253 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
5254 #endif /* ETAGS_REGEXPS */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5255
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5256
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5257 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5258 get_tag (bp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5259 register char *bp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5260 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5261 register char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5263 if (*bp == '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5264 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5265 /* Go till you get to white space or a syntactic break */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5266 for (cp = bp + 1;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5267 *cp != '\0' && *cp != '(' && *cp != ')' && !iswhite (*cp);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5268 cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5269 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5270 pfnote (savenstr (bp, cp-bp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5271 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5272 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5273
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5274 /* Initialize a linebuffer for use */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5275 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5276 initbuffer (lbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5277 linebuffer *lbp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5278 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5279 lbp->size = (DEBUG) ? 3 : 200;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5280 lbp->buffer = xnew (lbp->size, char);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5281 lbp->buffer[0] = '\0';
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5282 lbp->len = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5283 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5284
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5285 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5286 * Read a line of text from `stream' into `lbp', excluding the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5287 * newline or CR-NL, if any. Return the number of characters read from
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5288 * `stream', which is the length of the line including the newline.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5289 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5290 * On DOS or Windows we do not count the CR character, if any, before the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5291 * NL, in the returned length; this mirrors the behavior of emacs on those
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5292 * platforms (for text files, it translates CR-NL to NL as it reads in the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5293 * file).
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5294 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5295 static long
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5296 readline_internal (lbp, stream)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5297 linebuffer *lbp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5298 register FILE *stream;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5299 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5300 char *buffer = lbp->buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5301 register char *p = lbp->buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5302 register char *pend;
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5303 int chars_deleted;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5304
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5305 pend = p + lbp->size; /* Separate to avoid 386/IX compiler bug. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5306
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5307 while (1)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5308 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5309 register int c = getc (stream);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5310 if (p == pend)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5311 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5312 /* We're at the end of linebuffer: expand it. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5313 lbp->size *= 2;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5314 xrnew (buffer, lbp->size, char);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5315 p += buffer - lbp->buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5316 pend = buffer + lbp->size;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5317 lbp->buffer = buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5318 }
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5319 if (c == EOF)
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5320 {
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5321 *p = '\0';
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5322 chars_deleted = 0;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5323 break;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5324 }
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5325 if (c == '\n')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5326 {
10990
c0ceaa45ded7 * etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents: 10801
diff changeset
5327 if (p > buffer && p[-1] == '\r')
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5328 {
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5329 p -= 1;
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
5330 #ifdef DOS_NT
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
5331 /* Assume CRLF->LF translation will be performed by Emacs
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
5332 when loading this file, so CRs won't appear in the buffer.
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
5333 It would be cleaner to compensate within Emacs;
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
5334 however, Emacs does not know how many CRs were deleted
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
5335 before any given point in the file. */
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
5336 chars_deleted = 1;
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
5337 #else
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5338 chars_deleted = 2;
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
5339 #endif
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5340 }
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5341 else
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5342 {
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5343 chars_deleted = 1;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5344 }
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5345 *p = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5346 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5347 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5348 *p++ = c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5349 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5350 lbp->len = p - buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5351
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5352 return lbp->len + chars_deleted;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5353 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5354
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5355 /*
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5356 * Like readline_internal, above, but in addition try to match the
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5357 * input line against relevant regular expressions.
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5358 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5359 static long
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5360 readline (lbp, stream)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5361 linebuffer *lbp;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5362 FILE *stream;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5363 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5364 /* Read new line. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5365 long result = readline_internal (lbp, stream);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5366 #ifdef ETAGS_REGEXPS
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5367 int match;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5368 pattern *pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5369
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5370 /* Match against relevant patterns. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5371 if (lbp->len > 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5372 for (pp = p_head; pp != NULL; pp = pp->p_next)
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5373 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5374 /* Only use generic regexps or those for the current language. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5375 if (pp->language != NULL && pp->language != curlang)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5376 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5377
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5378 match = re_match (pp->pattern, lbp->buffer, lbp->len, 0, &pp->regs);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5379 switch (match)
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5380 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5381 case -2:
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5382 /* Some error. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5383 if (!pp->error_signaled)
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5384 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5385 error ("error while matching \"%s\"", pp->regex);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5386 pp->error_signaled = TRUE;
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5387 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5388 break;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5389 case -1:
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5390 /* No match. */
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5391 break;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5392 default:
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5393 /* Match occurred. Construct a tag. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5394 if (pp->name_pattern[0] != '\0')
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5395 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5396 /* Make a named tag. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5397 char *name = substitute (lbp->buffer,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5398 pp->name_pattern, &pp->regs);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5399 if (name != NULL)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5400 pfnote (name, TRUE, lbp->buffer, match, lineno, linecharno);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5401 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5402 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5403 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5404 /* Make an unnamed tag. */
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5405 pfnote ((char *)NULL, TRUE,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5406 lbp->buffer, match, lineno, linecharno);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5407 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5408 break;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5409 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5410 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5411 #endif /* ETAGS_REGEXPS */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5412
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5413 return result;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5414 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5415
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5416
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5417 /*
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5418 * Return a pointer to a space of size strlen(cp)+1 allocated
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5419 * with xnew where the string CP has been copied.
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5420 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5421 static char *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5422 savestr (cp)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5423 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5424 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5425 return savenstr (cp, strlen (cp));
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5426 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5427
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5428 /*
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5429 * Return a pointer to a space of size LEN+1 allocated with xnew where
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5430 * the string CP has been copied for at most the first LEN characters.
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5431 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5432 static char *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5433 savenstr (cp, len)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5434 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5435 int len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5436 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5437 register char *dp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5438
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5439 dp = xnew (len + 1, char);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5440 strncpy (dp, cp, len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5441 dp[len] = '\0';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5442 return dp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5443 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5444
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5445 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5446 * Return the ptr in sp at which the character c last
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5447 * appears; NULL if not found
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5448 *
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5449 * Identical to POSIX strrchr, included for portability.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5450 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5451 static char *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5452 etags_strrchr (sp, c)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5453 register const char *sp;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5454 register int c;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5455 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5456 register const char *r;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5457
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5458 r = NULL;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5459 do
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5460 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5461 if (*sp == c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5462 r = sp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5463 } while (*sp++);
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5464 return (char *)r;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5465 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5466
774
11867ad5bab4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
5467
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5468 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5469 * Return the ptr in sp at which the character c first
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5470 * appears; NULL if not found
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5471 *
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5472 * Identical to POSIX strchr, included for portability.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5473 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5474 static char *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5475 etags_strchr (sp, c)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5476 register const char *sp;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5477 register int c;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5478 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5479 do
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5480 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5481 if (*sp == c)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5482 return (char *)sp;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5483 } while (*sp++);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5484 return NULL;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5485 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5486
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5487 /* Skip spaces, return new pointer. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5488 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5489 skip_spaces (cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5490 char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5491 {
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5492 while (iswhite (*cp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5493 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5494 return cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5495 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5496
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5497 /* Skip non spaces, return new pointer. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5498 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5499 skip_non_spaces (cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5500 char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5501 {
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5502 while (*cp != '\0' && !iswhite (*cp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5503 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5504 return cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5505 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5506
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5507 /* Print error message and exit. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5508 void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5509 fatal (s1, s2)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5510 char *s1, *s2;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5511 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5512 error (s1, s2);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5513 exit (BAD);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5514 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5515
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5516 static void
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5517 pfatal (s1)
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5518 char *s1;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5519 {
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5520 perror (s1);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5521 exit (BAD);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5522 }
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5523
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5524 static void
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5525 suggest_asking_for_help ()
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5526 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5527 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5528 progname,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5529 #ifdef LONG_OPTIONS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5530 "--help"
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5531 #else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5532 "-h"
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5533 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5534 );
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5535 exit (BAD);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5536 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5537
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5538 /* Print error message. `s1' is printf control string, `s2' is arg for it. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5539 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5540 error (s1, s2)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5541 const char *s1, *s2;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5542 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5543 fprintf (stderr, "%s: ", progname);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5544 fprintf (stderr, s1, s2);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5545 fprintf (stderr, "\n");
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5546 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5547
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5548 /* Return a newly-allocated string whose contents
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5549 concatenate those of s1, s2, s3. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5550 static char *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5551 concat (s1, s2, s3)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5552 char *s1, *s2, *s3;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5553 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5554 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5555 char *result = xnew (len1 + len2 + len3 + 1, char);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5556
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5557 strcpy (result, s1);
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5558 strcpy (result + len1, s2);
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5559 strcpy (result + len1 + len2, s3);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5560 result[len1 + len2 + len3] = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5561
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5562 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5563 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5564
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5565
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5566 /* Does the same work as the system V getcwd, but does not need to
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
5567 guess the buffer size in advance. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5568 static char *
7227
6fa038c33a0f [MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents: 7049
diff changeset
5569 etags_getcwd ()
11992
e550e0d13e83 * etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents: 11990
diff changeset
5570 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5571 #ifdef HAVE_GETCWD
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5572 int bufsize = 200;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5573 char *path = xnew (bufsize, char);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5574
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5575 while (getcwd (path, bufsize) == NULL)
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5576 {
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
5577 if (errno != ERANGE)
11886
c5db1295f7df * etags.c (etags_getcwd): Use /bin/pwd instead of pwd because the
Francesco Potortì <pot@gnu.org>
parents: 11673
diff changeset
5578 pfatal ("getcwd");
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
5579 bufsize *= 2;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5580 free (path);
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5581 path = xnew (bufsize, char);
8789
81a2817b99b2 (etags_getcwd): Use getcwd if available.
Karl Heuer <kwzh@gnu.org>
parents: 8180
diff changeset
5582 }
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5583
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5584 canonicalize_filename (path);
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5585 return path;
16394
675944d1abc9 (etags_getcwd) [WINDOWSNT]: Convert backslashes to slashes.
Richard M. Stallman <rms@gnu.org>
parents: 16373
diff changeset
5586
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5587 #else /* not HAVE_GETCWD */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
5588 #if MSDOS
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5589
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5590 char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5591
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5592 getwd (path);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5593
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5594 for (p = path; *p != '\0'; p++)
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5595 if (*p == '\\')
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5596 *p = '/';
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5597 else
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5598 *p = lowcase (*p);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5599
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5600 return strdup (path);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5601 #else /* not MSDOS */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5602 linebuffer path;
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5603 FILE *pipe;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5604
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5605 initbuffer (&path);
11990
1e5d25c997ca * etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents: 11957
diff changeset
5606 pipe = (FILE *) popen ("pwd 2>/dev/null", "r");
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5607 if (pipe == NULL || readline_internal (&path, pipe) == 0)
11990
1e5d25c997ca * etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents: 11957
diff changeset
5608 pfatal ("pwd");
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5609 pclose (pipe);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5610
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5611 return path.buffer;
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5612 #endif /* not MSDOS */
11992
e550e0d13e83 * etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents: 11990
diff changeset
5613 #endif /* not HAVE_GETCWD */
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5614 }
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5615
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5616 /* Return a newly allocated string containing the file name of FILE
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5617 relative to the absolute directory DIR (which should end with a slash). */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5618 static char *
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5619 relative_filename (file, dir)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5620 char *file, *dir;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5621 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5622 char *fp, *dp, *afn, *res;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5623 int i;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5624
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
5625 /* Find the common root of file and dir (with a trailing slash). */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5626 afn = absolute_filename (file, cwd);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5627 fp = afn;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5628 dp = dir;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5629 while (*fp++ == *dp++)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5630 continue;
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5631 fp--, dp--; /* back to the first differing char */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5632 #ifdef DOS_NT
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5633 if (fp == afn && afn[0] != '/') /* cannot build a relative name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5634 return afn;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5635 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5636 do /* look at the equal chars until '/' */
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
5637 fp--, dp--;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5638 while (*fp != '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5639
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5640 /* Build a sequence of "../" strings for the resulting relative file name. */
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5641 i = 0;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5642 while ((dp = etags_strchr (dp + 1, '/')) != NULL)
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5643 i += 1;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5644 res = xnew (3*i + strlen (fp + 1) + 1, char);
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5645 res[0] = '\0';
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5646 while (i-- > 0)
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5647 strcat (res, "../");
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5648
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5649 /* Add the file name relative to the common root of file and dir. */
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5650 strcat (res, fp + 1);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5651 free (afn);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5652
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5653 return res;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5654 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5655
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5656 /* Return a newly allocated string containing the absolute file name
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5657 of FILE given DIR (which should end with a slash). */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5658 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5659 absolute_filename (file, dir)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5660 char *file, *dir;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5661 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5662 char *slashp, *cp, *res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5663
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5664 if (filename_is_absolute (file))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5665 res = savestr (file);
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5666 #ifdef DOS_NT
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5667 /* We don't support non-absolute file names with a drive
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5668 letter, like `d:NAME' (it's too much hassle). */
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5669 else if (file[1] == ':')
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5670 fatal ("%s: relative file names with drive letters not supported", file);
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5671 #endif
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5672 else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5673 res = concat (dir, file, "");
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5674
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5675 /* Delete the "/dirname/.." and "/." substrings. */
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5676 slashp = etags_strchr (res, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5677 while (slashp != NULL && slashp[0] != '\0')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5678 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5679 if (slashp[1] == '.')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5680 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5681 if (slashp[2] == '.'
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5682 && (slashp[3] == '/' || slashp[3] == '\0'))
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5683 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5684 cp = slashp;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5685 do
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5686 cp--;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5687 while (cp >= res && !filename_is_absolute (cp));
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5688 if (cp < res)
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5689 cp = slashp; /* the absolute name begins with "/.." */
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5690 #ifdef DOS_NT
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5691 /* Under MSDOS and NT we get `d:/NAME' as absolute
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5692 file name, so the luser could say `d:/../NAME'.
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5693 We silently treat this as `d:/NAME'. */
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5694 else if (cp[0] != '/')
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5695 cp = slashp;
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5696 #endif
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5697 strcpy (cp, slashp + 3);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5698 slashp = cp;
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5699 continue;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5700 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5701 else if (slashp[2] == '/' || slashp[2] == '\0')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5702 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5703 strcpy (slashp, slashp + 2);
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5704 continue;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5705 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5706 }
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5707
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5708 slashp = etags_strchr (slashp + 1, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5709 }
24140
9e4d1d3eab09 (etags_getcwd, absolute_filename) [DOS_NT]: Canonicalize
Geoff Voelker <voelker@cs.washington.edu>
parents: 24059
diff changeset
5710
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5711 if (res[0] == '\0')
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5712 return savestr ("/");
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5713 else
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5714 return res;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5715 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5716
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5717 /* Return a newly allocated string containing the absolute
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5718 file name of dir where FILE resides given DIR (which should
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5719 end with a slash). */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5720 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5721 absolute_dirname (file, dir)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5722 char *file, *dir;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5723 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5724 char *slashp, *res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5725 char save;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5726
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5727 canonicalize_filename (file);
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5728 slashp = etags_strrchr (file, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5729 if (slashp == NULL)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5730 return savestr (dir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5731 save = slashp[1];
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5732 slashp[1] = '\0';
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5733 res = absolute_filename (file, dir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5734 slashp[1] = save;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5735
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5736 return res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5737 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5738
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5739 /* Whether the argument string is an absolute file name. The argument
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5740 string must have been canonicalized with canonicalize_filename. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5741 static bool
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5742 filename_is_absolute (fn)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5743 char *fn;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5744 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5745 return (fn[0] == '/'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5746 #ifdef DOS_NT
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5747 || (ISALPHA(fn[0]) && fn[1] == ':' && fn[2] == '/')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5748 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5749 );
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5750 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5751
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5752 /* Translate backslashes into slashes. Works in place. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5753 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5754 canonicalize_filename (fn)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5755 register char *fn;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5756 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5757 #ifdef DOS_NT
26507
aabdfbf65c68 1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26340
diff changeset
5758 /* Canonicalize drive letter case. */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
5759 if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0]))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
5760 fn[0] = upcase (fn[0]);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5761 /* Convert backslashes to slashes. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5762 for (; *fn != '\0'; fn++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5763 if (*fn == '\\')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5764 *fn = '/';
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5765 #else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5766 /* No action. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5767 fn = NULL; /* shut up the compiler */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5768 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5769 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5770
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5771 /* Set the minimum size of a string contained in a linebuffer. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5772 static void
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5773 linebuffer_setlen (lbp, toksize)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5774 linebuffer *lbp;
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5775 int toksize;
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5776 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5777 while (lbp->size <= toksize)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5778 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5779 lbp->size *= 2;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5780 xrnew (lbp->buffer, lbp->size, char);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5781 }
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5782 lbp->len = toksize;
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5783 }
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5784
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5785 /* Like malloc but get fatal error if memory is exhausted. */
30231
5b3608e3adaf (xmalloc, xrealloc): Make externally visible, for use
Gerd Moellmann <gerd@gnu.org>
parents: 28663
diff changeset
5786 long *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5787 xmalloc (size)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
5788 unsigned int size;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5789 {
11673
46d2178719ad (C_entries): Cast result of xrealloc.
Richard M. Stallman <rms@gnu.org>
parents: 11231
diff changeset
5790 long *result = (long *) malloc (size);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5791 if (result == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5792 fatal ("virtual memory exhausted", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5793 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5794 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5795
30231
5b3608e3adaf (xmalloc, xrealloc): Make externally visible, for use
Gerd Moellmann <gerd@gnu.org>
parents: 28663
diff changeset
5796 long *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5797 xrealloc (ptr, size)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5798 char *ptr;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
5799 unsigned int size;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5800 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5801 long *result = (long *) realloc (ptr, size);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5802 if (result == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5803 fatal ("virtual memory exhausted", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5804 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5805 }