Mercurial > emacs
annotate lib-src/etags.c @ 85863:f5b982bf98e0
Remember: Fix mistake in last commit and improve remember-mode docstring.
author | Michael Olson <mwolson@gnu.org> |
---|---|
date | Thu, 01 Nov 2007 04:56:10 +0000 |
parents | e5a68f18fcb9 |
children | d03f0a543d19 424b655804ca |
rev | line source |
---|---|
35653 | 1 /* Tags file maker to go with GNU Emacs -*- coding: latin-1 -*- |
76181
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
2 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
3 Copyright (C) 1984 The Regents of the University of California |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
4 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
5 Redistribution and use in source and binary forms, with or without |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
6 modification, are permitted provided that the following conditions are |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
7 met: |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
8 1. Redistributions of source code must retain the above copyright |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
9 notice, this list of conditions and the following disclaimer. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
10 2. Redistributions in binary form must reproduce the above copyright |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
11 notice, this list of conditions and the following disclaimer in the |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
12 documentation and/or other materials provided with the |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
13 distribution. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
14 3. Neither the name of the University nor the names of its |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
15 contributors may be used to endorse or promote products derived |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
16 from this software without specific prior written permission. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
17 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
18 THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
20 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
21 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
25 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
26 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
27 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
28 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
29 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
30 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
31 Copyright (C) 1984, 1987, 1988, 1989, 1993, 1994, 1995, 1998, 1999, |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
32 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
33 Free Software Foundation, Inc. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
34 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
35 This file is not considered part of GNU Emacs. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
36 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
37 This program is free software; you can redistribute it and/or modify |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
38 it under the terms of the GNU General Public License as published by |
78257
1f2482de3237
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76181
diff
changeset
|
39 the Free Software Foundation; either version 3, or (at your option) |
1f2482de3237
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76181
diff
changeset
|
40 any later version. |
76181
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
41 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
42 This program is distributed in the hope that it will be useful, |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
43 but WITHOUT ANY WARRANTY; without even the implied warranty of |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
44 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
45 GNU General Public License for more details. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
46 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
47 You should have received a copy of the GNU General Public License |
78257
1f2482de3237
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76181
diff
changeset
|
48 along with this program; see the file COPYING. If not, write to the |
1f2482de3237
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76181
diff
changeset
|
49 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
1f2482de3237
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76181
diff
changeset
|
50 Boston, MA 02110-1301, USA. */ |
76181
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
51 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
52 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
53 /* NB To comply with the above BSD license, copyright information is |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
54 reproduced in etc/ETAGS.README. That file should be updated when the |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
55 above notices are. |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
56 |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
57 To the best of our knowledge, this code was originally based on the |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
58 ctags.c distributed with BSD4.2, which was copyrighted by the |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
59 University of California, as described above. */ |
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
60 |
240 | 61 |
62 /* | |
63 * Authors: | |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
64 * 1983 Ctags originally by Ken Arnold. |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
65 * 1984 Fortran added by Jim Kleckner. |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
66 * 1984 Ed Pelegri-Llopart added C typedefs. |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
67 * 1985 Emacs TAGS format by Richard Stallman. |
35740
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
68 * 1989 Sam Kendall added C++. |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
69 * 1992 Joseph B. Wells improved C and C++ parsing. |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
70 * 1993 Francesco Potort́ reorganised C and C++. |
45925
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
71 * 1994 Line-by-line regexp tags by Tom Tromey. |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
72 * 2001 Nested classes by Francesco Potort́ (concept by Mykola Dzyuba). |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
73 * 2002 #line directives by Francesco Potort́. |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
74 * |
45918
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
75 * Francesco Potort́ <pot@gnu.org> has maintained and improved it since 1993. |
240 | 76 */ |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
77 |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
78 /* |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
79 * If you want to add support for a new language, start by looking at the LUA |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
80 * language, which is the simplest. Alternatively, consider shipping a |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
81 * configuration file containing regexp definitions for etags. |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
82 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
83 |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
84 char pot_etags_version[] = "@(#) pot revision number is 17.34"; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
85 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
86 #define TRUE 1 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
87 #define FALSE 0 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
88 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
89 #ifdef DEBUG |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
90 # undef DEBUG |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
91 # define DEBUG TRUE |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
92 #else |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
93 # define DEBUG FALSE |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
94 # 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
|
95 #endif |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
96 |
26083
134b57acef68
Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents:
24879
diff
changeset
|
97 #ifdef HAVE_CONFIG_H |
134b57acef68
Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents:
24879
diff
changeset
|
98 # include <config.h> |
134b57acef68
Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents:
24879
diff
changeset
|
99 /* 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
|
100 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
|
101 # undef static |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
102 # ifndef PTR /* for XEmacs */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
103 # define PTR void * |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
104 # endif |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
105 # ifndef __P /* for XEmacs */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
106 # define __P(args) args |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
107 # endif |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
108 #else /* no config.h */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
109 # if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
110 # define __P(args) args /* use prototypes */ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
111 # define PTR void * /* for generic pointers */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
112 # else /* not standard C */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
113 # define __P(args) () /* no prototypes */ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
114 # define const /* remove const for old compilers' sake */ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
115 # define PTR long * /* don't use void* */ |
36361
e9d69d45eae4
When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents:
35775
diff
changeset
|
116 # endif |
e9d69d45eae4
When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents:
35775
diff
changeset
|
117 #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
|
118 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
119 #ifndef _GNU_SOURCE |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
120 # 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
|
121 #endif |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
122 |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
123 /* WIN32_NATIVE is for XEmacs. |
35740
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
124 MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
125 #ifdef WIN32_NATIVE |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
126 # undef MSDOS |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
127 # undef WINDOWSNT |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
128 # define WINDOWSNT |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
129 #endif /* WIN32_NATIVE */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
130 |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
131 #ifdef MSDOS |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
132 # undef MSDOS |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
133 # 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
|
134 # include <fcntl.h> |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
135 # 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
|
136 # 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
|
137 # 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
|
138 # 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
|
139 # 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
|
140 # endif |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
141 #else |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
142 # define MSDOS FALSE |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
143 #endif /* MSDOS */ |
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
144 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
145 #ifdef WINDOWSNT |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
146 # include <stdlib.h> |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
147 # include <fcntl.h> |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
148 # include <string.h> |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
149 # include <direct.h> |
14982
b470e33ce4a9
[WINDOWSNT]: Include io.h.
Richard M. Stallman <rms@gnu.org>
parents:
14924
diff
changeset
|
150 # 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
|
151 # define MAXPATHLEN _MAX_PATH |
35740
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
152 # undef HAVE_NTGUI |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
153 # undef DOS_NT |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
154 # 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
|
155 # 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
|
156 # 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
|
157 # endif /* undef HAVE_GETCWD */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
158 #else /* not WINDOWSNT */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
159 # ifdef STDC_HEADERS |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
160 # include <stdlib.h> |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
161 # include <string.h> |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
162 # else /* no standard C headers */ |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
163 extern char *getenv (); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
164 extern char *strcpy (); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
165 extern char *strncpy (); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
166 extern char *strcat (); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
167 extern char *strncat (); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
168 extern unsigned long strlen (); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
169 extern PTR malloc (); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
170 extern PTR realloc (); |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
171 # ifdef VMS |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
172 # define EXIT_SUCCESS 1 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
173 # define EXIT_FAILURE 0 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
174 # else /* no VMS */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
175 # define EXIT_SUCCESS 0 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
176 # define EXIT_FAILURE 1 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
177 # endif |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
178 # endif |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
179 #endif /* !WINDOWSNT */ |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
180 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
181 #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
|
182 # 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
|
183 #else |
35740
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
184 # 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
|
185 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
|
186 # 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
|
187 #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
|
188 |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
189 #include <stdio.h> |
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
190 #include <ctype.h> |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
191 #include <errno.h> |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
192 #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
|
193 extern int errno; |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
194 #endif |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
195 #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
|
196 #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
|
197 |
35758
aa069bbee4c8
Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents:
35741
diff
changeset
|
198 #include <assert.h> |
aa069bbee4c8
Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents:
35741
diff
changeset
|
199 #ifdef NDEBUG |
aa069bbee4c8
Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents:
35741
diff
changeset
|
200 # undef assert /* some systems have a buggy assert.h */ |
aa069bbee4c8
Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents:
35741
diff
changeset
|
201 # define assert(x) ((void) 0) |
35741
e0acf4b43873
(assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents:
35740
diff
changeset
|
202 #endif |
e0acf4b43873
(assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents:
35740
diff
changeset
|
203 |
4804
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
204 #if !defined (S_ISREG) && defined (S_IFREG) |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
205 # 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
|
206 #endif |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
207 |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
208 #ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
209 # define NO_LONG_OPTIONS TRUE |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
210 # 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
|
211 extern char *optarg; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
212 extern int optind, opterr; |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
213 #else |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
214 # define NO_LONG_OPTIONS FALSE |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
215 # include <getopt.h> |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
216 #endif /* NO_LONG_OPTIONS */ |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
217 |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
218 #ifndef HAVE_CONFIG_H /* this is a standalone compilation */ |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
219 # ifdef __CYGWIN__ /* compiling on Cygwin */ |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
220 !!! NOTICE !!! |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
221 the regex.h distributed with Cygwin is not compatible with etags, alas! |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
222 If you want regular expression support, you should delete this notice and |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
223 arrange to use the GNU regex.h and regex.c. |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
224 # endif |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
225 #endif |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
226 #include <regex.h> |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
227 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
228 /* 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
|
229 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
|
230 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
|
231 #ifdef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
232 # undef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
233 # define CTAGS TRUE |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
234 #else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
235 # define CTAGS FALSE |
240 | 236 #endif |
237 | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
238 #define streq(s,t) (assert((s)!=NULL || (t)!=NULL), !strcmp (s, t)) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
239 #define strcaseeq(s,t) (assert((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t)) |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
240 #define strneq(s,t,n) (assert((s)!=NULL || (t)!=NULL), !strncmp (s, t, n)) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
241 #define strncaseeq(s,t,n) (assert((s)!=NULL && (t)!=NULL), !etags_strncasecmp (s, t, n)) |
240 | 242 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
243 #define CHARS 256 /* 2^sizeof(char) */ |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
244 #define CHAR(x) ((unsigned int)(x) & (CHARS - 1)) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
245 #define iswhite(c) (_wht[CHAR(c)]) /* c is white (see white) */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
246 #define notinname(c) (_nin[CHAR(c)]) /* c is not in a name (see nonam) */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
247 #define begtoken(c) (_btk[CHAR(c)]) /* c can start token (see begtk) */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
248 #define intoken(c) (_itk[CHAR(c)]) /* c can be in token (see midtk) */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
249 #define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens (see endtk) */ |
240 | 250 |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
251 #define ISALNUM(c) isalnum (CHAR(c)) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
252 #define ISALPHA(c) isalpha (CHAR(c)) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
253 #define ISDIGIT(c) isdigit (CHAR(c)) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
254 #define ISLOWER(c) islower (CHAR(c)) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
255 |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
256 #define lowcase(c) tolower (CHAR(c)) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
257 #define upcase(c) toupper (CHAR(c)) |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
258 |
12344
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
259 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
260 /* |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
261 * 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
|
262 * |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
263 * 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
|
264 * 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
|
265 */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
266 #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
|
267 # 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
|
268 # 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
|
269 (n) * sizeof (Type))) |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
270 # 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
|
271 (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
|
272 #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
|
273 # 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
|
274 # 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
|
275 (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
|
276 #endif |
240 | 277 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
278 #define bool int |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
279 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
280 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
|
281 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
282 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
|
283 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
284 char *suffix; /* file name suffix for this compressor */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
285 char *command; /* takes one arg and decompresses to stdout */ |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
286 } 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
|
287 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
288 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
|
289 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
290 char *name; /* language name */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
291 char *help; /* detailed help for the language */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
292 Lang_function *function; /* parse function */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
293 char **suffixes; /* name suffixes of this language's files */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
294 char **filenames; /* names of this language's files */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
295 char **interpreters; /* interpreters for this language */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
296 bool metasource; /* source used to generate other sources */ |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
297 } language; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
298 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
299 typedef struct fdesc |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
300 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
301 struct fdesc *next; /* for the linked list */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
302 char *infname; /* uncompressed input file name */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
303 char *infabsname; /* absolute uncompressed input file name */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
304 char *infabsdir; /* absolute dir of input file */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
305 char *taggedfname; /* file name to write in tagfile */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
306 language *lang; /* language of file */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
307 char *prop; /* file properties to write in tagfile */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
308 bool usecharno; /* etags tags shall contain char number */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
309 bool written; /* entry written in the tags file */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
310 } fdesc; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
311 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
312 typedef struct node_st |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
313 { /* sorting structure */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
314 struct node_st *left, *right; /* left and right sons */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
315 fdesc *fdp; /* description of file to whom tag belongs */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
316 char *name; /* tag name */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
317 char *regex; /* search regexp */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
318 bool valid; /* write this tag on the tag file */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
319 bool is_func; /* function tag: use regexp in CTAGS mode */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
320 bool been_warned; /* warning already given for duplicated tag */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
321 int lno; /* line number tag is on */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
322 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
|
323 } node; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
324 |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
325 /* |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
326 * 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
|
327 * `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
|
328 * 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
|
329 * 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
|
330 * 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
|
331 */ |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
332 typedef struct |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
333 { |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
334 long size; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
335 int len; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
336 char *buffer; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
337 } linebuffer; |
240 | 338 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
339 /* Used to support mixing of --lang and file names. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
340 typedef struct |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
341 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
342 enum { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
343 at_language, /* a language specification */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
344 at_regexp, /* a regular expression */ |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
345 at_filename, /* a file name */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
346 at_stdin, /* read from stdin here */ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
347 at_end /* stop parsing the list */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
348 } arg_type; /* argument type */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
349 language *lang; /* language associated with the argument */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
350 char *what; /* the argument itself */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
351 } argument; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
352 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
353 /* Structure defining a regular expression. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
354 typedef struct regexp |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
355 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
356 struct regexp *p_next; /* pointer to next in list */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
357 language *lang; /* if set, use only for this language */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
358 char *pattern; /* the regexp pattern */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
359 char *name; /* tag name */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
360 struct re_pattern_buffer *pat; /* the compiled pattern */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
361 struct re_registers regs; /* re registers */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
362 bool error_signaled; /* already signaled for this regexp */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
363 bool force_explicit_name; /* do not allow implict tag name */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
364 bool ignore_case; /* ignore case when matching */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
365 bool multi_line; /* do a multi-line match on the whole file */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
366 } regexp; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
367 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
368 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
369 /* 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
|
370 Lang_function Ada_funcs; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
371 so let's write it this way */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
372 static void Ada_funcs __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
373 static void Asm_labels __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
374 static void C_entries __P((int c_ext, FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
375 static void default_C_entries __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
376 static void plain_C_entries __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
377 static void Cjava_entries __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
378 static void Cobol_paragraphs __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
379 static void Cplusplus_entries __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
380 static void Cstar_entries __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
381 static void Erlang_functions __P((FILE *)); |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
382 static void Forth_words __P((FILE *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
383 static void Fortran_functions __P((FILE *)); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
384 static void HTML_labels __P((FILE *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
385 static void Lisp_functions __P((FILE *)); |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
386 static void Lua_functions __P((FILE *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
387 static void Makefile_targets __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
388 static void Pascal_functions __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
389 static void Perl_functions __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
390 static void PHP_functions __P((FILE *)); |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
391 static void PS_functions __P((FILE *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
392 static void Prolog_functions __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
393 static void Python_functions __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
394 static void Scheme_functions __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
395 static void TeX_commands __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
396 static void Texinfo_nodes __P((FILE *)); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
397 static void Yacc_entries __P((FILE *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
398 static void just_read_file __P((FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
399 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
400 static void print_language_names __P((void)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
401 static void print_version __P((void)); |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
402 static void print_help __P((argument *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
403 int main __P((int, char **)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
404 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
405 static compressor *get_compressor_from_suffix __P((char *, char **)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
406 static language *get_language_from_langname __P((const char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
407 static language *get_language_from_interpreter __P((char *)); |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
408 static language *get_language_from_filename __P((char *, bool)); |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
409 static void readline __P((linebuffer *, FILE *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
410 static long readline_internal __P((linebuffer *, FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
411 static bool nocase_tail __P((char *)); |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
412 static void get_tag __P((char *, 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
|
413 |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
414 static void analyse_regex __P((char *)); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
415 static void free_regexps __P((void)); |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
416 static void regex_tag_multiline __P((void)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
417 static void error __P((const char *, const char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
418 static void suggest_asking_for_help __P((void)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
419 void fatal __P((char *, char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
420 static void pfatal __P((char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
421 static void add_node __P((node *, node **)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
422 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
423 static void init __P((void)); |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
424 static void process_file_name __P((char *, language *)); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
425 static void process_file __P((FILE *, char *, language *)); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
426 static void find_entries __P((FILE *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
427 static void free_tree __P((node *)); |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
428 static void free_fdesc __P((fdesc *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
429 static void pfnote __P((char *, bool, char *, int, int, long)); |
45925
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
430 static void make_tag __P((char *, int, bool, char *, int, int, long)); |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
431 static void invalidate_nodes __P((fdesc *, node **)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
432 static void put_entries __P((node *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
433 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
434 static char *concat __P((char *, char *, char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
435 static char *skip_spaces __P((char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
436 static char *skip_non_spaces __P((char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
437 static char *savenstr __P((char *, int)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
438 static char *savestr __P((char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
439 static char *etags_strchr __P((const char *, int)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
440 static char *etags_strrchr __P((const char *, int)); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
441 static int etags_strcasecmp __P((const char *, const char *)); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
442 static int etags_strncasecmp __P((const char *, const char *, int)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
443 static char *etags_getcwd __P((void)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
444 static char *relative_filename __P((char *, char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
445 static char *absolute_filename __P((char *, char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
446 static char *absolute_dirname __P((char *, char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
447 static bool filename_is_absolute __P((char *f)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
448 static void canonicalize_filename __P((char *)); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
449 static void linebuffer_init __P((linebuffer *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
450 static void linebuffer_setlen __P((linebuffer *, int)); |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
451 static PTR xmalloc __P((unsigned int)); |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
452 static PTR 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
|
453 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
454 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
455 static char searchar = '/'; /* use /.../ searches */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
456 |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
457 static char *tagfile; /* output file */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
458 static char *progname; /* name this program was invoked with */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
459 static char *cwd; /* current working directory */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
460 static char *tagfiledir; /* directory of tagfile */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
461 static FILE *tagf; /* ioptr for tags file */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
462 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
463 static fdesc *fdhead; /* head of file description list */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
464 static fdesc *curfdp; /* current file description */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
465 static int lineno; /* line number of current line */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
466 static long charno; /* current character number */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
467 static long linecharno; /* charno of start of current line */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
468 static char *dbp; /* pointer to start of current tag */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
469 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
470 static const int invalidcharno = -1; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
471 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
472 static node *nodehead; /* the head of the binary tree of tags */ |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
473 static node *last_node; /* the last node created */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
474 |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
475 static linebuffer lb; /* the current line */ |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
476 static linebuffer filebuf; /* a buffer containing the whole file */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
477 static linebuffer token_name; /* a buffer containing a tag name */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
478 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
479 /* boolean "functions" (see init) */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
480 static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS]; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
481 static char |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
482 /* white chars */ |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
483 *white = " \f\t\n\r\v", |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
484 /* not in a name */ |
45925
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
485 *nonam = " \f\t\n\r()=,;", /* look at make_tag before modifying! */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
486 /* 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
|
487 *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
|
488 /* token starting chars */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
489 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~@", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
490 /* valid in-token chars */ |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
491 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
492 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
493 static bool append_to_tagfile; /* -a: append to tags */ |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
494 /* The next five default to TRUE for etags, but to FALSE for ctags. */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
495 static bool typedefs; /* -t: create tags for C and Ada typedefs */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
496 static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */ |
240 | 497 /* 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
|
498 /* member functions. */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
499 static bool constantypedefs; /* -d: create tags for C #define, enum */ |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
500 /* constants and variables. */ |
240 | 501 /* -D: opposite of -d. Default under ctags. */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
502 static bool globals; /* create tags for global variables */ |
75680
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
503 static bool members; /* create tags for C member variables */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
504 static bool declarations; /* --declarations: tag them and extern in C&Co*/ |
45643
5cee84ffef53
(main): Avoid a buffer overrun with sprintf.
Francesco Potortì <pot@gnu.org>
parents:
45535
diff
changeset
|
505 static bool no_line_directive; /* ignore #line directives (undocumented) */ |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
506 static bool no_duplicates; /* no duplicate tags for ctags (undocumented) */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
507 static bool update; /* -u: update tags */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
508 static bool vgrind_style; /* -v: create vgrind style index output */ |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
509 static bool no_warnings; /* -w: suppress warnings (undocumented) */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
510 static bool cxref_style; /* -x: create cxref style output */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
511 static bool cplusplus; /* .[hc] means C++, not C */ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
512 static bool ignoreindent; /* -I: ignore indentation in C */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
513 static 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
|
514 |
66219
90109c37ac78
Undef STDIN if defined. (LynxOS defines it in system header files.)
Eli Zaretskii <eliz@gnu.org>
parents:
65714
diff
changeset
|
515 /* STDIN is defined in LynxOS system headers */ |
90109c37ac78
Undef STDIN if defined. (LynxOS defines it in system header files.)
Eli Zaretskii <eliz@gnu.org>
parents:
65714
diff
changeset
|
516 #ifdef STDIN |
66985
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
517 # undef STDIN |
66219
90109c37ac78
Undef STDIN if defined. (LynxOS defines it in system header files.)
Eli Zaretskii <eliz@gnu.org>
parents:
65714
diff
changeset
|
518 #endif |
90109c37ac78
Undef STDIN if defined. (LynxOS defines it in system header files.)
Eli Zaretskii <eliz@gnu.org>
parents:
65714
diff
changeset
|
519 |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
520 #define STDIN 0x1001 /* returned by getopt_long on --parse-stdin */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
521 static bool parsing_stdin; /* --parse-stdin used */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
522 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
523 static regexp *p_head; /* list of all regexps */ |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
524 static bool need_filebuf; /* some regexes are multi-line */ |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
525 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
526 static struct option longopts[] = |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
527 { |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
528 { "append", no_argument, NULL, 'a' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
529 { "packages-only", no_argument, &packages_only, TRUE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
530 { "c++", no_argument, NULL, 'C' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
531 { "declarations", no_argument, &declarations, TRUE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
532 { "no-line-directive", no_argument, &no_line_directive, TRUE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
533 { "no-duplicates", no_argument, &no_duplicates, TRUE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
534 { "help", no_argument, NULL, 'h' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
535 { "help", no_argument, NULL, 'H' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
536 { "ignore-indentation", no_argument, NULL, 'I' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
537 { "language", required_argument, NULL, 'l' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
538 { "members", no_argument, &members, TRUE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
539 { "no-members", no_argument, &members, FALSE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
540 { "output", required_argument, NULL, 'o' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
541 { "regex", required_argument, NULL, 'r' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
542 { "no-regex", no_argument, NULL, 'R' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
543 { "ignore-case-regex", required_argument, NULL, 'c' }, |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
544 { "parse-stdin", required_argument, NULL, STDIN }, |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
545 { "version", no_argument, NULL, 'V' }, |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
546 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
547 #if CTAGS /* Ctags options */ |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
548 { "backward-search", no_argument, NULL, 'B' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
549 { "cxref", no_argument, NULL, 'x' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
550 { "defines", no_argument, NULL, 'd' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
551 { "globals", no_argument, &globals, TRUE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
552 { "typedefs", no_argument, NULL, 't' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
553 { "typedefs-and-c++", no_argument, NULL, 'T' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
554 { "update", no_argument, NULL, 'u' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
555 { "vgrind", no_argument, NULL, 'v' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
556 { "no-warn", no_argument, NULL, 'w' }, |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
557 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
558 #else /* Etags options */ |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
559 { "no-defines", no_argument, NULL, 'D' }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
560 { "no-globals", no_argument, &globals, FALSE }, |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
561 { "include", required_argument, NULL, 'i' }, |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
562 #endif |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
563 { NULL } |
621 | 564 }; |
565 | |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
566 static compressor compressors[] = |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
567 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
568 { "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
|
569 { "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
|
570 { "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
|
571 { "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
|
572 { "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
|
573 { NULL } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
574 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
575 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
576 /* |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
577 * Language stuff. |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
578 */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
579 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
580 /* Ada code */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
581 static char *Ada_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
|
582 { "ads", "adb", "ada", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
583 static char Ada_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
584 "In Ada code, functions, procedures, packages, tasks and types are\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
585 tags. Use the `--packages-only' option to create tags for\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
586 packages only.\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
587 Ada tag names have suffixes indicating the type of entity:\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
588 Entity type: Qualifier:\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
589 ------------ ----------\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
590 function /f\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
591 procedure /p\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
592 package spec /s\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
593 package body /b\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
594 type /t\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
595 task /k\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
596 Thus, `M-x find-tag <RET> bidule/b <RET>' will go directly to the\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
597 body of the package `bidule', while `M-x find-tag <RET> bidule <RET>'\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
598 will just search for any tag `bidule'."; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
599 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
600 /* Assembly code */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
601 static char *Asm_suffixes [] = |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
602 { "a", /* Unix assembler */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
603 "asm", /* Microcontroller assembly */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
604 "def", /* BSO/Tasking definition includes */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
605 "inc", /* Microcontroller include files */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
606 "ins", /* Microcontroller include files */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
607 "s", "sa", /* Unix assembler */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
608 "S", /* cpp-processed Unix assembler */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
609 "src", /* BSO/Tasking C compiler output */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
610 NULL |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
611 }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
612 static char Asm_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
613 "In assembler code, labels appearing at the beginning of a line,\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
614 followed by a colon, are tags."; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
615 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
616 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
617 /* Note that .c and .h can be considered C++, if the --c++ flag was |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
618 given, or if the `class' or `template' keyowrds are met inside the file. |
35740
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
619 That is why default_C_entries is called for these. */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
620 static char *default_C_suffixes [] = |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
621 { "c", "h", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
622 static char default_C_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
623 "In C code, any C function or typedef is a tag, and so are\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
624 definitions of `struct', `union' and `enum'. `#define' macro\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
625 definitions and `enum' constants are tags unless you specify\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
626 `--no-defines'. Global variables are tags unless you specify\n\ |
75680
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
627 `--no-globals' and so are struct members unless you specify\n\ |
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
628 `--no-members'. Use of `--no-globals', `--no-defines' and\n\ |
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
629 `--no-members' can make the tags table file much smaller.\n\ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
630 You can tag function declarations and external variables by\n\ |
75680
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
631 using `--declarations'."; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
632 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
633 static char *Cplusplus_suffixes [] = |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
634 { "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
|
635 "M", /* Objective C++ */ |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
636 "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
|
637 NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
638 static char Cplusplus_help [] = |
49360
d257d0cb93b4
(Cplusplus_help, Cjava_help): Re-phrase and avoid
Dave Love <fx@gnu.org>
parents:
49125
diff
changeset
|
639 "In C++ code, all the tag constructs of C code are tagged. (Use\n\ |
d257d0cb93b4
(Cplusplus_help, Cjava_help): Re-phrase and avoid
Dave Love <fx@gnu.org>
parents:
49125
diff
changeset
|
640 --help --lang=c --lang=c++ for full help.)\n\ |
75680
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
641 In addition to C tags, member functions are also recognized. Member\n\ |
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
642 variables are recognized unless you use the `--no-members' option.\n\ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
643 Tags for variables and functions in classes are named `CLASS::VARIABLE'\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
644 and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
645 `operator+'."; |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
646 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
647 static char *Cjava_suffixes [] = |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
648 { "java", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
649 static char Cjava_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
650 "In Java code, all the tags constructs of C and C++ code are\n\ |
49360
d257d0cb93b4
(Cplusplus_help, Cjava_help): Re-phrase and avoid
Dave Love <fx@gnu.org>
parents:
49125
diff
changeset
|
651 tagged. (Use --help --lang=c --lang=c++ --lang=java for full help.)"; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
652 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
653 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
654 static char *Cobol_suffixes [] = |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
655 { "COB", "cob", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
656 static char Cobol_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
657 "In Cobol code, tags are paragraph names; that is, any word\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
658 starting in column 8 and followed by a period."; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
659 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
660 static char *Cstar_suffixes [] = |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
661 { "cs", "hs", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
662 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
663 static char *Erlang_suffixes [] = |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
664 { "erl", "hrl", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
665 static char Erlang_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
666 "In Erlang code, the tags are the functions, records and macros\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
667 defined in the file."; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
668 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
669 char *Forth_suffixes [] = |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
670 { "fth", "tok", NULL }; |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
671 static char Forth_help [] = |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
672 "In Forth code, tags are words defined by `:',\n\ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
673 constant, code, create, defer, value, variable, buffer:, field."; |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
674 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
675 static char *Fortran_suffixes [] = |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
676 { "F", "f", "f90", "for", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
677 static char Fortran_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
678 "In Fortran code, functions, subroutines and block data are tags."; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
679 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
680 static char *HTML_suffixes [] = |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
681 { "htm", "html", "shtml", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
682 static char HTML_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
683 "In HTML input files, the tags are the `title' and the `h1', `h2',\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
684 `h3' headers. Also, tags are `name=' in anchors and all\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
685 occurrences of `id='."; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
686 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
687 static char *Lisp_suffixes [] = |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
688 { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
689 static char Lisp_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
690 "In Lisp code, any function defined with `defun', any variable\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
691 defined with `defvar' or `defconst', and in general the first\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
692 argument of any expression that starts with `(def' in column zero\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
693 is a tag."; |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
694 |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
695 static char *Lua_suffixes [] = |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
696 { "lua", "LUA", NULL }; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
697 static char Lua_help [] = |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
698 "In Lua scripts, all functions are tags."; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
699 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
700 static char *Makefile_filenames [] = |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
701 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
702 static char Makefile_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
703 "In makefiles, targets are tags; additionally, variables are tags\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
704 unless you specify `--no-globals'."; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
705 |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
706 static char *Objc_suffixes [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
707 { "lm", /* Objective lex file */ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
708 "m", /* Objective C file */ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
709 NULL }; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
710 static char Objc_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
711 "In Objective C code, tags include Objective C definitions for classes,\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
712 class categories, methods and protocols. Tags for variables and\n\ |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
713 functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\ |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
714 (Use --help --lang=c --lang=objc --lang=java for full help.)"; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
715 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
716 static char *Pascal_suffixes [] = |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
717 { "p", "pas", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
718 static char Pascal_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
719 "In Pascal code, the tags are the functions and procedures defined\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
720 in the file."; |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
721 /* " // this is for working around an Emacs highlighting bug... */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
722 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
723 static char *Perl_suffixes [] = |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
724 { "pl", "pm", NULL }; |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
725 static char *Perl_interpreters [] = |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
726 { "perl", "@PERL@", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
727 static char Perl_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
728 "In Perl code, the tags are the packages, subroutines and variables\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
729 defined by the `package', `sub', `my' and `local' keywords. Use\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
730 `--globals' if you want to tag global variables. Tags for\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
731 subroutines are named `PACKAGE::SUB'. The name for subroutines\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
732 defined in the default package is `main::SUB'."; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
733 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
734 static char *PHP_suffixes [] = |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
735 { "php", "php3", "php4", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
736 static char PHP_help [] = |
75680
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
737 "In PHP code, tags are functions, classes and defines. Unless you use\n\ |
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
738 the `--no-members' option, vars are tags too."; |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
739 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
740 static char *plain_C_suffixes [] = |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
741 { "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
|
742 NULL }; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
743 |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
744 static char *PS_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
|
745 { "ps", "psw", NULL }; /* .psw is for PSWrap */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
746 static char PS_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
747 "In PostScript code, the tags are the functions."; |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
748 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
749 static char *Prolog_suffixes [] = |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
750 { "prolog", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
751 static char Prolog_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
752 "In Prolog code, tags are predicates and rules at the beginning of\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
753 line."; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
754 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
755 static char *Python_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
|
756 { "py", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
757 static char Python_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
758 "In Python code, `def' or `class' at the beginning of a line\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
759 generate 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
|
760 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
761 /* Can't do the `SCM' or `scm' prefix with a version number. */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
762 static char *Scheme_suffixes [] = |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
763 { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
764 static char Scheme_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
765 "In Scheme code, tags include anything defined with `def' or with a\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
766 construct whose name starts with `def'. They also include\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
767 variables set with `set!' at top level in the file."; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
768 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
769 static char *TeX_suffixes [] = |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
770 { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
771 static char TeX_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
772 "In LaTeX text, the argument of any of the commands `\\chapter',\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
773 `\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
774 `\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
775 `\\index', `\\def', `\\newcommand', `\\renewcommand',\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
776 `\\newenvironment' or `\\renewenvironment' is a tag.\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
777 \n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
778 Other commands can be specified by setting the environment variable\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
779 `TEXTAGS' to a colon-separated list like, for example,\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
780 TEXTAGS=\"mycommand:myothercommand\"."; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
781 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
782 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
783 static char *Texinfo_suffixes [] = |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
784 { "texi", "texinfo", "txi", NULL }; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
785 static char Texinfo_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
786 "for texinfo files, lines starting with @node are tagged."; |
28663
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
787 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
788 static char *Yacc_suffixes [] = |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
789 { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
790 static char Yacc_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
791 "In Bison or Yacc input files, each rule defines as a tag the\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
792 nonterminal it constructs. The portions of the file that contain\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
793 C code are parsed as C code (use --help --lang=c --lang=yacc\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
794 for full help)."; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
795 |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
796 static char auto_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
797 "`auto' is not a real language, it indicates to use\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
798 a default language for files base on file name suffix and file contents."; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
799 |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
800 static char none_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
801 "`none' is not a real language, it indicates to only do\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
802 regexp processing on files."; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
803 |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
804 static char no_lang_help [] = |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
805 "No detailed help available for this language."; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
806 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
807 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
808 /* |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
809 * 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
|
810 * |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
811 * 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
|
812 * 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
|
813 */ |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
814 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
815 static language lang_names [] = |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
816 { |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
817 { "ada", Ada_help, Ada_funcs, Ada_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
818 { "asm", Asm_help, Asm_labels, Asm_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
819 { "c", default_C_help, default_C_entries, default_C_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
820 { "c++", Cplusplus_help, Cplusplus_entries, Cplusplus_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
821 { "c*", no_lang_help, Cstar_entries, Cstar_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
822 { "cobol", Cobol_help, Cobol_paragraphs, Cobol_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
823 { "erlang", Erlang_help, Erlang_functions, Erlang_suffixes }, |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
824 { "forth", Forth_help, Forth_words, Forth_suffixes }, |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
825 { "fortran", Fortran_help, Fortran_functions, Fortran_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
826 { "html", HTML_help, HTML_labels, HTML_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
827 { "java", Cjava_help, Cjava_entries, Cjava_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
828 { "lisp", Lisp_help, Lisp_functions, Lisp_suffixes }, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
829 { "lua", Lua_help, Lua_functions, Lua_suffixes }, |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
830 { "makefile", Makefile_help,Makefile_targets,NULL,Makefile_filenames}, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
831 { "objc", Objc_help, plain_C_entries, Objc_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
832 { "pascal", Pascal_help, Pascal_functions, Pascal_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
833 { "perl",Perl_help,Perl_functions,Perl_suffixes,NULL,Perl_interpreters}, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
834 { "php", PHP_help, PHP_functions, PHP_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
835 { "postscript",PS_help, PS_functions, PS_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
836 { "proc", no_lang_help, plain_C_entries, plain_C_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
837 { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
838 { "python", Python_help, Python_functions, Python_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
839 { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
840 { "tex", TeX_help, TeX_commands, TeX_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
841 { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
842 { "yacc", Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,TRUE}, |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
843 { "auto", auto_help }, /* default guessing scheme */ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
844 { "none", none_help, just_read_file }, /* regexp matching only */ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
845 { 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
|
846 }; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
847 |
240 | 848 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
849 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
|
850 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
|
851 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
852 language *lang; |
35302
6a51ef53518f
2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
35297
diff
changeset
|
853 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
|
854 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
855 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
|
856 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
|
857 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
|
858 { |
35302
6a51ef53518f
2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
35297
diff
changeset
|
859 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
|
860 if (lang->filenames != NULL) |
6a51ef53518f
2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
35297
diff
changeset
|
861 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
|
862 printf (" %s", *name); |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
863 if (lang->suffixes != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
864 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
|
865 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
|
866 puts (""); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
867 } |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
868 puts ("where `auto' means use default language for files based on file\n\ |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
869 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
|
870 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
|
871 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
|
872 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
|
873 Fortran is tried first; if no tags are found, C is tried next.\n\ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
874 When parsing any C file, a \"class\" or \"template\" keyword\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
875 switches to C++."); |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
876 puts ("Compressed files are supported using gzip and bzip2.\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
877 \n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
878 For detailed help on a given language use, for example,\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
879 etags --help --lang=ada."); |
9976
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 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
882 #ifndef EMACS_NAME |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
883 # define EMACS_NAME "standalone" |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
884 #endif |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
885 #ifndef VERSION |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
886 # define VERSION "17.34" |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
887 #endif |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
888 static void |
621 | 889 print_version () |
890 { | |
81223
58d377c5c5bb
(print_version): Add `emacs_copyright' string, for easier automatic
Glenn Morris <rgm@gnu.org>
parents:
80957
diff
changeset
|
891 /* Makes it easier to update automatically. */ |
81231 | 892 char emacs_copyright[] = "Copyright (C) 2007 Free Software Foundation, Inc."; |
81223
58d377c5c5bb
(print_version): Add `emacs_copyright' string, for easier automatic
Glenn Morris <rgm@gnu.org>
parents:
80957
diff
changeset
|
893 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
894 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); |
81223
58d377c5c5bb
(print_version): Add `emacs_copyright' string, for easier automatic
Glenn Morris <rgm@gnu.org>
parents:
80957
diff
changeset
|
895 puts (emacs_copyright); |
76181
ce4c0635bea7
Add University of California copyright and revised BSDL license.
Glenn Morris <rgm@gnu.org>
parents:
75680
diff
changeset
|
896 puts ("This program is distributed under the terms in ETAGS.README"); |
621 | 897 |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
898 exit (EXIT_SUCCESS); |
621 | 899 } |
900 | |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
901 #ifndef PRINT_UNDOCUMENTED_OPTIONS_HELP |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
902 # define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
903 #endif |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
904 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
905 static void |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
906 print_help (argbuffer) |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
907 argument *argbuffer; |
621 | 908 { |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
909 bool help_for_lang = FALSE; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
910 |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
911 for (; argbuffer->arg_type != at_end; argbuffer++) |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
912 if (argbuffer->arg_type == at_language) |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
913 { |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
914 if (help_for_lang) |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
915 puts (""); |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
916 puts (argbuffer->lang->help); |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
917 help_for_lang = TRUE; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
918 } |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
919 |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
920 if (help_for_lang) |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
921 exit (EXIT_SUCCESS); |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
922 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
923 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
|
924 \n\ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
925 These are the options accepted by %s.\n", progname, progname); |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
926 if (NO_LONG_OPTIONS) |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
927 puts ("WARNING: long option names do not work with this executable,\n\ |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
928 as it is not linked with GNU getopt."); |
57013
c2ab1ac6a36b
[LONG_OPTIONS]: make it TRUE (ifdef) or FALSE for ease of use.
Francesco Potortì <pot@gnu.org>
parents:
55408
diff
changeset
|
929 else |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
930 puts ("You may use unambiguous abbreviations for the long option names."); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
931 puts (" A - as file name means read names from stdin (one per line).\n\ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
932 Absolute names are stored in the output file as they are.\n\ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
933 Relative ones are stored relative to the output file's directory.\n"); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
934 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
935 puts ("-a, --append\n\ |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
936 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
|
937 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
938 puts ("--packages-only\n\ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
939 For Ada files, only generate tags for packages."); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
940 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
941 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
942 puts ("-B, --backward-search\n\ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
943 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
|
944 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
|
945 |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
946 /* 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
|
947 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
|
948 experimentation. In principle, we could want to tag as C++ even |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
949 before any "class" or "template" keyword. |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
950 puts ("-C, --c++\n\ |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
951 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
|
952 */ |
621 | 953 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
954 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
|
955 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
|
956 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
|
957 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
|
958 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
|
959 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
|
960 ("\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
|
961 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
962 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
963 puts ("-d, --defines\n\ |
16540
bf7e776e40f6
* etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
16394
diff
changeset
|
964 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
|
965 else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
966 puts ("-D, --no-defines\n\ |
16540
bf7e776e40f6
* etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
16394
diff
changeset
|
967 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
|
968 This makes the tags file smaller."); |
621 | 969 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
970 if (!CTAGS) |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
971 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
|
972 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
|
973 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
|
974 checking the current file."); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
975 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
976 puts ("-l LANG, --language=LANG\n\ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
977 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
|
978 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
|
979 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
980 if (CTAGS) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
981 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
|
982 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
|
983 else |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
984 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
|
985 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
|
986 languages. This makes the tags file smaller."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
987 |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
988 if (PRINT_UNDOCUMENTED_OPTIONS_HELP) |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
989 puts ("--no-line-directive\n\ |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
990 Ignore #line preprocessor directives in C and derived languages."); |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
991 |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
992 if (CTAGS) |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
993 puts ("--members\n\ |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
994 Create tag entries for members of structures in some languages."); |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
995 else |
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
996 puts ("--no-members\n\ |
75680
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
997 Do not create tag entries for members of structures\n\ |
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
998 in some languages."); |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
999 |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1000 puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
1001 Make a tag for each line matching a regular expression pattern\n\ |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1002 in the following files. {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\ |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1003 files only. REGEXFILE is a file containing one REGEXP per line.\n\ |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1004 REGEXP takes the form /TAGREGEXP/TAGNAME/MODS, where TAGNAME/ is\n\ |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1005 optional. The TAGREGEXP pattern is anchored (as if preceded by ^)."); |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1006 puts (" If TAGNAME/ is present, the tags created are named.\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
|
1007 For example Tcl named tags can be created with:\n\ |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1008 --regex=\"/proc[ \\t]+\\([^ \\t]+\\)/\\1/.\".\n\ |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1009 MODS are optional one-letter modifiers: `i' means to ignore case,\n\ |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1010 `m' means to allow multi-line matches, `s' implies `m' and\n\ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
1011 causes dot to match any character, including newline."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1012 |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
1013 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
|
1014 Don't create tags from regexps for the following files."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1015 |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
1016 puts ("-I, --ignore-indentation\n\ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
1017 In C and C++ do not assume that a closing brace in the first\n\ |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
1018 column is the final brace of a function or structure definition."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1019 |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
1020 puts ("-o FILE, --output=FILE\n\ |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
1021 Write the tags to FILE."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1022 |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
1023 puts ("--parse-stdin=NAME\n\ |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
1024 Read from standard input and record tags as belonging to file NAME."); |
621 | 1025 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1026 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1027 { |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1028 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
|
1029 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
|
1030 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
|
1031 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
|
1032 and C++ member functions."); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1033 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1034 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1035 if (CTAGS) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1036 puts ("-u, --update\n\ |
621 | 1037 Update the tag entries for the given files, leaving tag\n\ |
1038 entries for other files in place. Currently, this is\n\ | |
1039 implemented by deleting the existing entries for the given\n\ | |
1040 files and then rewriting the new entries at the end of the\n\ | |
1041 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
|
1042 tag file than to use this."); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1043 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1044 if (CTAGS) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1045 { |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1046 puts ("-v, --vgrind\n\ |
66985
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1047 Print on the standard output an index of items intended for\n\ |
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1048 human consumption, similar to the output of vgrind. The index\n\ |
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1049 is sorted, and gives the page number of each item."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1050 |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1051 if (PRINT_UNDOCUMENTED_OPTIONS_HELP) |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1052 puts ("-w, --no-duplicates\n\ |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
1053 Do not create duplicate tag entries, for compatibility with\n\ |
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
1054 traditional ctags."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1055 |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1056 if (PRINT_UNDOCUMENTED_OPTIONS_HELP) |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1057 puts ("-w, --no-warn\n\ |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
1058 Suppress warning messages about duplicate tag entries."); |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
1059 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1060 puts ("-x, --cxref\n\ |
621 | 1061 Like --vgrind, but in the style of cxref, rather than vgrind.\n\ |
1062 The output uses line numbers instead of page numbers, but\n\ | |
1063 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
|
1064 which you like."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1065 } |
621 | 1066 |
1067 puts ("-V, --version\n\ | |
1068 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
|
1069 -h, --help\n\ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1070 Print this help message.\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1071 Followed by one or more `--language' options prints detailed\n\ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1072 help about tag generation for the specified languages."); |
621 | 1073 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1074 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
|
1075 |
16373
d50369f4bb41
* etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents:
16086
diff
changeset
|
1076 puts (""); |
26323
98d99afb5ffb
* etags.c (print_help): Change email address to send bugs to.
Gerd Moellmann <gerd@gnu.org>
parents:
26262
diff
changeset
|
1077 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
|
1078 |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
1079 exit (EXIT_SUCCESS); |
621 | 1080 } |
1081 | |
1082 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1083 #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
|
1084 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1085 #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
|
1086 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1087 /* 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
|
1088 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
|
1089 #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
|
1090 typedef struct { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1091 short curlen; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1092 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
|
1093 } vspec; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1094 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1095 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1096 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
|
1097 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
|
1098 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
|
1099 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
|
1100 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
|
1101 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
|
1102 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
|
1103 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
|
1104 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
|
1105 |
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
|
1106 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
|
1107 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
|
1108 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
|
1109 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
|
1110 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1111 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1112 #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
|
1113 #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
|
1114 #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
|
1115 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
|
1116 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
|
1117 vspec *out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1118 char *in; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1119 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1120 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
|
1121 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
|
1122 static struct dsc$descriptor_s i; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1123 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
|
1124 long status; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1125 short retval; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1126 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1127 if (pass1) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1128 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1129 pass1 = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1130 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
|
1131 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
|
1132 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
|
1133 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
|
1134 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
|
1135 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
|
1136 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
|
1137 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
|
1138 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1139 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
|
1140 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1141 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
|
1142 return 1; |
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 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
|
1145 retval = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1146 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1147 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1148 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
|
1149 retval = -1; |
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 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
|
1152 pass1 = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1153 return retval; |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1154 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1155 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1156 /* |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1157 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
|
1158 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
|
1159 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1160 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
|
1161 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
|
1162 char *arg; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1163 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
|
1164 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1165 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
|
1166 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1167 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
|
1168 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1169 case 1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1170 *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
|
1171 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
|
1172 case 0: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1173 *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
|
1174 return NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1175 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1176 *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
|
1177 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
|
1178 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1179 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1180 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1181 #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
|
1182 system (cmd) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1183 char *cmd; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1184 { |
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
|
1185 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
|
1186 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1187 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1188 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1189 #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
|
1190 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
|
1191 char *s; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1192 { |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1193 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
|
1194 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1195 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
|
1196 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
|
1197 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1198 *s = EOS; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1199 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1200 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1201 else |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1202 *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
|
1203 return start; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1204 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1205 #endif /* VMS */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1206 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1207 |
15683 | 1208 int |
240 | 1209 main (argc, argv) |
1210 int argc; | |
1211 char *argv[]; | |
1212 { | |
1213 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
|
1214 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
|
1215 char **included_files; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1216 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
|
1217 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
|
1218 linebuffer filename_lb; |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1219 bool help_asked = FALSE; |
240 | 1220 #ifdef VMS |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1221 bool got_err; |
240 | 1222 #endif |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1223 char *optstring; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1224 int opt; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1225 |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1226 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
1227 #ifdef DOS_NT |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1228 _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
|
1229 #endif /* DOS_NT */ |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
1230 |
240 | 1231 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
|
1232 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
|
1233 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
|
1234 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
|
1235 file_count = 0; |
240 | 1236 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1237 /* 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
|
1238 is small. */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1239 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
|
1240 |
240 | 1241 /* |
1242 * If etags, always find typedefs and structure tags. Why not? | |
75680
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
1243 * Also default to find macro constants, enum constants, struct |
a3a7c25796a4
(default_C_help, Cplusplus_help, PHP_help, print_help)
Francesco Potortì <pot@gnu.org>
parents:
75675
diff
changeset
|
1244 * members and global variables. |
240 | 1245 */ |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1246 if (!CTAGS) |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1247 { |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
1248 typedefs = typedefs_or_cplusplus = constantypedefs = TRUE; |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
1249 globals = members = TRUE; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1250 } |
240 | 1251 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
1252 /* When the optstring begins with a '-' getopt_long does not rearrange the |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
1253 non-options arguments to be at the end, but leaves them alone. */ |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
1254 optstring = concat (NO_LONG_OPTIONS ? "" : "-", |
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
1255 "ac:Cf:Il:o:r:RSVhH", |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
1256 (CTAGS) ? "BxdtTuvw" : "Di:"); |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
1257 |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
1258 while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1259 switch (opt) |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1260 { |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1261 case 0: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1262 /* If getopt returns 0, then it has already processed a |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1263 long-named option. We should do nothing. */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1264 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1265 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1266 case 1: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1267 /* This means that a file name has been seen. Record it. */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1268 argbuffer[current_arg].arg_type = at_filename; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1269 argbuffer[current_arg].what = optarg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1270 ++current_arg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1271 ++file_count; |
621 | 1272 break; |
1273 | |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1274 case STDIN: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1275 /* Parse standard input. Idea by Vivek <vivek@etla.org>. */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1276 argbuffer[current_arg].arg_type = at_stdin; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1277 argbuffer[current_arg].what = optarg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1278 ++current_arg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1279 ++file_count; |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
1280 if (parsing_stdin) |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
1281 fatal ("cannot parse standard input more than once", (char *)NULL); |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1282 parsing_stdin = TRUE; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1283 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1284 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1285 /* Common options. */ |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
1286 case 'a': append_to_tagfile = TRUE; break; |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1287 case 'C': cplusplus = TRUE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1288 case 'f': /* for compatibility with old makefiles */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1289 case 'o': |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1290 if (tagfile) |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1291 { |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1292 error ("-o option may only be given once.", (char *)NULL); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1293 suggest_asking_for_help (); |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1294 /* NOTREACHED */ |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1295 } |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1296 tagfile = optarg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1297 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1298 case 'I': |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1299 case 'S': /* for backward compatibility */ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
1300 ignoreindent = TRUE; |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1301 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1302 case 'l': |
240 | 1303 { |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1304 language *lang = get_language_from_langname (optarg); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1305 if (lang != NULL) |
621 | 1306 { |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1307 argbuffer[current_arg].lang = lang; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1308 argbuffer[current_arg].arg_type = at_language; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1309 ++current_arg; |
240 | 1310 } |
1311 } | |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1312 break; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1313 case 'c': |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1314 /* Backward compatibility: support obsolete --ignore-case-regexp. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1315 optarg = concat (optarg, "i", ""); /* memory leak here */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1316 /* FALLTHRU */ |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1317 case 'r': |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1318 argbuffer[current_arg].arg_type = at_regexp; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1319 argbuffer[current_arg].what = optarg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1320 ++current_arg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1321 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1322 case 'R': |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1323 argbuffer[current_arg].arg_type = at_regexp; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1324 argbuffer[current_arg].what = NULL; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1325 ++current_arg; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1326 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1327 case 'V': |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1328 print_version (); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1329 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1330 case 'h': |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1331 case 'H': |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1332 help_asked = TRUE; |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1333 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1334 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1335 /* Etags options */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1336 case 'D': constantypedefs = FALSE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1337 case 'i': included_files[nincluded_files++] = optarg; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1338 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1339 /* Ctags options. */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1340 case 'B': searchar = '?'; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1341 case 'd': constantypedefs = TRUE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1342 case 't': typedefs = TRUE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1343 case 'T': typedefs = typedefs_or_cplusplus = TRUE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1344 case 'u': update = TRUE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1345 case 'v': vgrind_style = TRUE; /*FALLTHRU*/ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1346 case 'x': cxref_style = TRUE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1347 case 'w': no_warnings = TRUE; break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1348 default: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1349 suggest_asking_for_help (); |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1350 /* NOTREACHED */ |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1351 } |
240 | 1352 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
1353 /* No more options. Store the rest of arguments. */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1354 for (; optind < argc; optind++) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1355 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1356 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
|
1357 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
|
1358 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1359 ++file_count; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1360 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1361 |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1362 argbuffer[current_arg].arg_type = at_end; |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1363 |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1364 if (help_asked) |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1365 print_help (argbuffer); |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1366 /* NOTREACHED */ |
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1367 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1368 if (nincluded_files == 0 && file_count == 0) |
240 | 1369 { |
26507
aabdfbf65c68
1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26340
diff
changeset
|
1370 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
|
1371 suggest_asking_for_help (); |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1372 /* NOTREACHED */ |
240 | 1373 } |
1374 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1375 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
|
1376 tagfile = CTAGS ? "tags" : "TAGS"; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
1377 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
|
1378 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
|
1379 { |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
1380 char *oldcwd = cwd; |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
1381 cwd = concat (oldcwd, "/", ""); |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
1382 free (oldcwd); |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
1383 } |
57091
a02f327b4165
(main): When relative file names are given as argument,
Francesco Potortì <pot@gnu.org>
parents:
57084
diff
changeset
|
1384 /* Relative file names are made relative to the current directory. */ |
a02f327b4165
(main): When relative file names are given as argument,
Francesco Potortì <pot@gnu.org>
parents:
57084
diff
changeset
|
1385 if (streq (tagfile, "-") |
a02f327b4165
(main): When relative file names are given as argument,
Francesco Potortì <pot@gnu.org>
parents:
57084
diff
changeset
|
1386 || strneq (tagfile, "/dev/", 5)) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
1387 tagfiledir = cwd; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1388 else |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
1389 tagfiledir = absolute_dirname (tagfile, cwd); |
240 | 1390 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1391 init (); /* set up boolean "functions" */ |
240 | 1392 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1393 linebuffer_init (&lb); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1394 linebuffer_init (&filename_lb); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1395 linebuffer_init (&filebuf); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1396 linebuffer_init (&token_name); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1397 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1398 if (!CTAGS) |
240 | 1399 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1400 if (streq (tagfile, "-")) |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1401 { |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1402 tagf = stdout; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1403 #ifdef DOS_NT |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1404 /* 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
|
1405 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
|
1406 if (!isatty (fileno (stdout))) |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1407 setmode (fileno (stdout), O_BINARY); |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1408 #endif /* DOS_NT */ |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1409 } |
240 | 1410 else |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1411 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
|
1412 if (tagf == NULL) |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
1413 pfatal (tagfile); |
240 | 1414 } |
1415 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1416 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1417 * 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
|
1418 */ |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
1419 for (i = 0; i < current_arg; i++) |
240 | 1420 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1421 static language *lang; /* non-NULL if language is forced */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1422 char *this_file; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1423 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1424 switch (argbuffer[i].arg_type) |
240 | 1425 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1426 case at_language: |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1427 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
|
1428 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1429 case at_regexp: |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1430 analyse_regex (argbuffer[i].what); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1431 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1432 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
|
1433 #ifdef VMS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1434 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
|
1435 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1436 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
|
1437 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1438 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
|
1439 argc--, argv++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1440 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1441 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1442 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1443 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
|
1444 } |
240 | 1445 #else |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1446 this_file = argbuffer[i].what; |
240 | 1447 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1448 /* 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
|
1449 (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
|
1450 if (streq (this_file, "-")) |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1451 { |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1452 if (parsing_stdin) |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1453 fatal ("cannot parse standard input AND read file names from it", |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1454 (char *)NULL); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1455 while (readline_internal (&filename_lb, stdin) > 0) |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1456 process_file_name (filename_lb.buffer, lang); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1457 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1458 else |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1459 process_file_name (this_file, lang); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1460 #ifdef VMS |
240 | 1461 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1462 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1463 break; |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1464 case at_stdin: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1465 this_file = argbuffer[i].what; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1466 process_file (stdin, this_file, lang); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1467 break; |
240 | 1468 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1469 } |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
1470 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1471 free_regexps (); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1472 free (lb.buffer); |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1473 free (filebuf.buffer); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1474 free (token_name.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
|
1475 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1476 if (!CTAGS || cxref_style) |
240 | 1477 { |
66985
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1478 /* Write the remaining tags to tagf (ETAGS) or stdout (CXREF). */ |
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1479 put_entries (nodehead); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1480 free_tree (nodehead); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1481 nodehead = NULL; |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1482 if (!CTAGS) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1483 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1484 fdesc *fdp; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1485 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1486 /* Output file entries that have no tags. */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1487 for (fdp = fdhead; fdp != NULL; fdp = fdp->next) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1488 if (!fdp->written) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1489 fprintf (tagf, "\f\n%s,0\n", fdp->taggedfname); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1490 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1491 while (nincluded_files-- > 0) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1492 fprintf (tagf, "\f\n%s,include\n", *included_files++); |
66985
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1493 |
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1494 if (fclose (tagf) == EOF) |
bf8620d8ff03
Cxref mode writes to stdout: do not close tagf,
Francesco Potortì <pot@gnu.org>
parents:
66219
diff
changeset
|
1495 pfatal (tagfile); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1496 } |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1497 |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
1498 exit (EXIT_SUCCESS); |
240 | 1499 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1500 |
621 | 1501 if (update) |
240 | 1502 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1503 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
|
1504 for (i = 0; i < current_arg; ++i) |
240 | 1505 { |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1506 switch (argbuffer[i].arg_type) |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1507 { |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1508 case at_filename: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1509 case at_stdin: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1510 break; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1511 default: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1512 continue; /* the for loop */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1513 } |
240 | 1514 sprintf (cmd, |
1515 "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
|
1516 tagfile, argbuffer[i].what, tagfile); |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
1517 if (system (cmd) != EXIT_SUCCESS) |
16607
16b8d910795f
* etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents:
16573
diff
changeset
|
1518 fatal ("failed to execute shell command", (char *)NULL); |
240 | 1519 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1520 append_to_tagfile = TRUE; |
240 | 1521 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1522 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1523 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
|
1524 if (tagf == NULL) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1525 pfatal (tagfile); |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
1526 put_entries (nodehead); /* write all the tags (CTAGS) */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1527 free_tree (nodehead); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1528 nodehead = NULL; |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1529 if (fclose (tagf) == EOF) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1530 pfatal (tagfile); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1531 |
65714
fbae8bd411de
(main): In append mode, sort the tags file after writing it.
Francesco Potortì <pot@gnu.org>
parents:
65708
diff
changeset
|
1532 if (CTAGS) |
fbae8bd411de
(main): In append mode, sort the tags file after writing it.
Francesco Potortì <pot@gnu.org>
parents:
65708
diff
changeset
|
1533 if (append_to_tagfile || update) |
fbae8bd411de
(main): In append mode, sort the tags file after writing it.
Francesco Potortì <pot@gnu.org>
parents:
65708
diff
changeset
|
1534 { |
75037
baea8fa9d2eb
(main): Pass the -u option to sort in ctags mode.
Francesco Potortì <pot@gnu.org>
parents:
75034
diff
changeset
|
1535 char cmd[2*BUFSIZ+20]; |
baea8fa9d2eb
(main): Pass the -u option to sort in ctags mode.
Francesco Potortì <pot@gnu.org>
parents:
75034
diff
changeset
|
1536 /* Maybe these should be used: |
baea8fa9d2eb
(main): Pass the -u option to sort in ctags mode.
Francesco Potortì <pot@gnu.org>
parents:
75034
diff
changeset
|
1537 setenv ("LC_COLLATE", "C", 1); |
baea8fa9d2eb
(main): Pass the -u option to sort in ctags mode.
Francesco Potortì <pot@gnu.org>
parents:
75034
diff
changeset
|
1538 setenv ("LC_ALL", "C", 1); */ |
baea8fa9d2eb
(main): Pass the -u option to sort in ctags mode.
Francesco Potortì <pot@gnu.org>
parents:
75034
diff
changeset
|
1539 sprintf (cmd, "sort -u -o %.*s %.*s", BUFSIZ, tagfile, BUFSIZ, tagfile); |
65714
fbae8bd411de
(main): In append mode, sort the tags file after writing it.
Francesco Potortì <pot@gnu.org>
parents:
65708
diff
changeset
|
1540 exit (system (cmd)); |
fbae8bd411de
(main): In append mode, sort the tags file after writing it.
Francesco Potortì <pot@gnu.org>
parents:
65708
diff
changeset
|
1541 } |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
1542 return EXIT_SUCCESS; |
240 | 1543 } |
1544 | |
1545 | |
1546 /* | |
26262
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 * 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
|
1548 * 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
|
1549 * 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
|
1550 * and EXTPTR is not significant. |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
1551 * 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
|
1552 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1553 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
|
1554 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
|
1555 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
|
1556 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
|
1557 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1558 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
|
1559 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
|
1560 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1561 /* 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
|
1562 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
|
1563 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
|
1564 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
|
1565 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
|
1566 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
|
1567 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
|
1568 *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
|
1569 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
|
1570 /* 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
|
1571 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
|
1572 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
|
1573 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
|
1574 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1575 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
|
1576 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
|
1577 return compr; |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1578 if (!MSDOS) |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1579 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
|
1580 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
|
1581 *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
|
1582 } 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
|
1583 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
|
1584 } |
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 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1586 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1587 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1588 /* |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1589 * 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
|
1590 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1591 static language * |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1592 get_language_from_langname (name) |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
1593 const char *name; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1594 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1595 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
|
1596 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1597 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
|
1598 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
|
1599 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
|
1600 { |
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 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
|
1602 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
|
1603 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
|
1604 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
|
1605 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1606 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1607 return NULL; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1608 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1609 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1610 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
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 * 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
|
1613 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1614 static language * |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1615 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
|
1616 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
|
1617 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1618 language *lang; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1619 char **iname; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1620 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1621 if (interpreter == NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1622 return NULL; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1623 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
|
1624 if (lang->interpreters != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1625 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
|
1626 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
|
1627 return lang; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1628 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1629 return NULL; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1630 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1631 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1632 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1633 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1634 /* |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1635 * 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
|
1636 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1637 static language * |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1638 get_language_from_filename (file, case_sensitive) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1639 char *file; |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1640 bool case_sensitive; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1641 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1642 language *lang; |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1643 char **name, **ext, *suffix; |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1644 |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1645 /* Try whole file name first. */ |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1646 for (lang = lang_names; lang->name != NULL; lang++) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1647 if (lang->filenames != NULL) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1648 for (name = lang->filenames; *name != NULL; name++) |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1649 if ((case_sensitive) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1650 ? streq (*name, file) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1651 : strcaseeq (*name, file)) |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1652 return lang; |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1653 |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
1654 /* 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
|
1655 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
|
1656 if (suffix == NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1657 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
|
1658 suffix += 1; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1659 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
|
1660 if (lang->suffixes != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1661 for (ext = lang->suffixes; *ext != NULL; ext++) |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1662 if ((case_sensitive) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1663 ? streq (*ext, suffix) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1664 : strcaseeq (*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
|
1665 return lang; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1666 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
|
1667 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1668 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1669 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1670 /* |
240 | 1671 * This routine is called on each file argument. |
1672 */ | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1673 static void |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1674 process_file_name (file, lang) |
240 | 1675 char *file; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1676 language *lang; |
240 | 1677 { |
1678 struct stat stat_buf; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1679 FILE *inf; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1680 fdesc *fdp; |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1681 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
|
1682 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
|
1683 char *ext, *real_name; |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1684 int retval; |
26262
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 |
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 canonicalize_filename (file); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1687 if (streq (file, tagfile) && !streq (tagfile, "-")) |
240 | 1688 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1689 error ("skipping inclusion of %s in self.", file); |
240 | 1690 return; |
1691 } | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1692 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
|
1693 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1694 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
|
1695 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
|
1696 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1697 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
|
1698 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1699 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
|
1700 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
|
1701 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1702 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1703 /* If the canonicalized uncompressed name |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1704 has already been dealt with, skip it silently. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1705 for (fdp = fdhead; fdp != NULL; fdp = fdp->next) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1706 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1707 assert (fdp->infname != NULL); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1708 if (streq (uncompressed_name, fdp->infname)) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1709 goto cleanup; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1710 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1711 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1712 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
|
1713 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1714 /* 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
|
1715 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
|
1716 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
|
1717 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1718 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
|
1719 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
|
1720 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1721 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
|
1722 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1723 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
|
1724 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1725 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
|
1726 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
|
1727 { |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1728 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
|
1729 { |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1730 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
|
1731 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
|
1732 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
|
1733 { |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1734 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
|
1735 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
|
1736 { |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1737 real_name = compressed_name; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1738 break; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
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 } |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1741 if (real_name != NULL) |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1742 break; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1743 } /* 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
|
1744 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
|
1745 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
|
1746 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1747 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
|
1748 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1749 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
|
1750 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
|
1751 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1752 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1753 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1754 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
|
1755 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1756 perror (file); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1757 goto cleanup; |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1758 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1759 } /* 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
|
1760 |
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 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
|
1762 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1763 error ("skipping %s: it is not a regular file.", real_name); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1764 goto cleanup; |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1765 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1766 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
|
1767 { |
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 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
|
1769 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
|
1770 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
|
1771 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1772 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
|
1773 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
|
1774 if (inf == NULL) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1775 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1776 perror (real_name); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1777 goto cleanup; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1778 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1779 |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1780 process_file (inf, uncompressed_name, lang); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1781 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1782 if (real_name == compressed_name) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1783 retval = pclose (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
|
1784 else |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1785 retval = fclose (inf); |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1786 if (retval < 0) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
1787 pfatal (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
|
1788 |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1789 cleanup: |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1790 if (compressed_name) free (compressed_name); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1791 if (uncompressed_name) free (uncompressed_name); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1792 last_node = NULL; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1793 curfdp = NULL; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1794 return; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1795 } |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1796 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1797 static void |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1798 process_file (fh, fn, lang) |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1799 FILE *fh; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1800 char *fn; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1801 language *lang; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1802 { |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1803 static const fdesc emptyfdesc; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1804 fdesc *fdp; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1805 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1806 /* Create a new input file description entry. */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1807 fdp = xnew (1, fdesc); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1808 *fdp = emptyfdesc; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1809 fdp->next = fdhead; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1810 fdp->infname = savestr (fn); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1811 fdp->lang = lang; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1812 fdp->infabsname = absolute_filename (fn, cwd); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1813 fdp->infabsdir = absolute_dirname (fn, cwd); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1814 if (filename_is_absolute (fn)) |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1815 { |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1816 /* An absolute file name. Canonicalize it. */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1817 fdp->taggedfname = absolute_filename (fn, NULL); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1818 } |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1819 else |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1820 { |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1821 /* A file name relative to cwd. Make it relative |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1822 to the directory of the tags file. */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1823 fdp->taggedfname = relative_filename (fn, tagfiledir); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1824 } |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1825 fdp->usecharno = TRUE; /* use char position when making tags */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1826 fdp->prop = NULL; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
1827 fdp->written = FALSE; /* not written on tags file yet */ |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1828 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1829 fdhead = fdp; |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1830 curfdp = fdhead; /* the current file description */ |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1831 |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1832 find_entries (fh); |
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
1833 |
44614
5adf2b1c20bb
(find_entries): Bug fix in list management.
Francesco Potortì <pot@gnu.org>
parents:
44607
diff
changeset
|
1834 /* If not Ctags, and if this is not metasource and if it contained no #line |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1835 directives, we can write the tags and free all nodes pointing to |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1836 curfdp. */ |
44614
5adf2b1c20bb
(find_entries): Bug fix in list management.
Francesco Potortì <pot@gnu.org>
parents:
44607
diff
changeset
|
1837 if (!CTAGS |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1838 && curfdp->usecharno /* no #line directives in this file */ |
44614
5adf2b1c20bb
(find_entries): Bug fix in list management.
Francesco Potortì <pot@gnu.org>
parents:
44607
diff
changeset
|
1839 && !curfdp->lang->metasource) |
5adf2b1c20bb
(find_entries): Bug fix in list management.
Francesco Potortì <pot@gnu.org>
parents:
44607
diff
changeset
|
1840 { |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1841 node *np, *prev; |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1842 |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1843 /* Look for the head of the sublist relative to this file. See add_node |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1844 for the structure of the node tree. */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1845 prev = NULL; |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1846 for (np = nodehead; np != NULL; prev = np, np = np->left) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1847 if (np->fdp == curfdp) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1848 break; |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1849 |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1850 /* If we generated tags for this file, write and delete them. */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1851 if (np != NULL) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1852 { |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1853 /* This is the head of the last sublist, if any. The following |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1854 instructions depend on this being true. */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1855 assert (np->left == NULL); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1856 |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1857 assert (fdhead == curfdp); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1858 assert (last_node->fdp == curfdp); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1859 put_entries (np); /* write tags for file curfdp->taggedfname */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1860 free_tree (np); /* remove the written nodes */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1861 if (prev == NULL) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1862 nodehead = NULL; /* no nodes left */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1863 else |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1864 prev->left = NULL; /* delete the pointer to the sublist */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
1865 } |
44614
5adf2b1c20bb
(find_entries): Bug fix in list management.
Francesco Potortì <pot@gnu.org>
parents:
44607
diff
changeset
|
1866 } |
240 | 1867 } |
1868 | |
1869 /* | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3569
diff
changeset
|
1870 * 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
|
1871 * by setting boolean flags dependent upon the corresponding character. |
240 | 1872 * Every char which is NOT in that string is not a white char. Therefore, |
1873 * all of the array "_wht" is set to FALSE, and then the elements | |
1874 * subscripted by the chars in "white" are set to TRUE. Thus "_wht" | |
1875 * of a char is TRUE if it is the string "white", else FALSE. | |
1876 */ | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1877 static void |
240 | 1878 init () |
1879 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1880 register char *sp; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1881 register int i; |
240 | 1882 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
1883 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
|
1884 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
|
1885 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
|
1886 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
|
1887 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
|
1888 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
|
1889 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
|
1890 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
|
1891 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
|
1892 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
|
1893 endtoken('\0') = endtoken('\n'); |
240 | 1894 } |
1895 | |
1896 /* | |
1897 * This routine opens the specified file and calls the function | |
1898 * which finds the function and type definitions. | |
1899 */ | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
1900 static void |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1901 find_entries (inf) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1902 FILE *inf; |
240 | 1903 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1904 char *cp; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1905 language *lang = curfdp->lang; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1906 Lang_function *parser = 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
|
1907 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1908 /* 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
|
1909 if (lang != NULL && lang->function != NULL) |
240 | 1910 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1911 parser = lang->function; |
240 | 1912 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1913 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1914 /* Else try to guess the language given the file name. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1915 if (parser == NULL) |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1916 { |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1917 lang = get_language_from_filename (curfdp->infname, TRUE); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1918 if (lang != NULL && lang->function != NULL) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1919 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1920 curfdp->lang = lang; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1921 parser = lang->function; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1922 } |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1923 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1924 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1925 /* Else look for sharp-bang as the first two characters. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1926 if (parser == NULL |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1927 && 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
|
1928 && lb.len >= 2 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1929 && lb.buffer[0] == '#' |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1930 && lb.buffer[1] == '!') |
240 | 1931 { |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1932 char *lp; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1933 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1934 /* 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
|
1935 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
|
1936 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
|
1937 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
|
1938 if (lp != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1939 lp += 1; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1940 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
|
1941 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
|
1942 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
|
1943 *cp = '\0'; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1944 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1945 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
|
1946 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
1947 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
|
1948 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
|
1949 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1950 curfdp->lang = lang; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1951 parser = lang->function; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1952 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1953 } |
240 | 1954 } |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1955 |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1956 /* We rewind here, even if inf may be a pipe. We fail if the |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1957 length of the first line is longer than the pipe block size, |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1958 which is unlikely. */ |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1959 rewind (inf); |
44607
8f3420af28a8
* etags.c (get_language_from_filename): Add one argument.
Francesco Potortì <pot@gnu.org>
parents:
44605
diff
changeset
|
1960 |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1961 /* Else try to guess the language given the case insensitive file name. */ |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1962 if (parser == NULL) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1963 { |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1964 lang = get_language_from_filename (curfdp->infname, FALSE); |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1965 if (lang != NULL && lang->function != NULL) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1966 { |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1967 curfdp->lang = lang; |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1968 parser = lang->function; |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1969 } |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1970 } |
44607
8f3420af28a8
* etags.c (get_language_from_filename): Add one argument.
Francesco Potortì <pot@gnu.org>
parents:
44605
diff
changeset
|
1971 |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1972 /* Else try Fortran or C. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1973 if (parser == NULL) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1974 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1975 node *old_last_node = last_node; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1976 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1977 curfdp->lang = get_language_from_langname ("fortran"); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1978 find_entries (inf); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1979 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1980 if (old_last_node == last_node) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1981 /* No Fortran entries found. Try C. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1982 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1983 /* We do not tag if rewind fails. |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1984 Only the file name will be recorded in the tags file. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1985 rewind (inf); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1986 curfdp->lang = get_language_from_langname (cplusplus ? "c++" : "c"); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1987 find_entries (inf); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1988 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1989 return; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1990 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
1991 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1992 if (!no_line_directive |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1993 && curfdp->lang != NULL && curfdp->lang->metasource) |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1994 /* It may be that this is a bingo.y file, and we already parsed a bingo.c |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1995 file, or anyway we parsed a file that is automatically generated from |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
1996 this one. If this is the case, the bingo.c file contained #line |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1997 directives that generated tags pointing to this file. Let's delete |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1998 them all before parsing this file, which is the real source. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
1999 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2000 fdesc **fdpp = &fdhead; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2001 while (*fdpp != NULL) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2002 if (*fdpp != curfdp |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2003 && streq ((*fdpp)->taggedfname, curfdp->taggedfname)) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2004 /* We found one of those! We must delete both the file description |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2005 and all tags referring to it. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2006 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2007 fdesc *badfdp = *fdpp; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2008 |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2009 /* Delete the tags referring to badfdp->taggedfname |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2010 that were obtained from badfdp->infname. */ |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2011 invalidate_nodes (badfdp, &nodehead); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2012 |
44614
5adf2b1c20bb
(find_entries): Bug fix in list management.
Francesco Potortì <pot@gnu.org>
parents:
44607
diff
changeset
|
2013 *fdpp = badfdp->next; /* remove the bad description from the list */ |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2014 free_fdesc (badfdp); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2015 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2016 else |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2017 fdpp = &(*fdpp)->next; /* advance the list pointer */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2018 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2019 |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2020 assert (parser != NULL); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2021 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2022 /* Generic initialisations before reading from file. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2023 linebuffer_setlen (&filebuf, 0); /* reset the file buffer */ |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2024 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2025 /* Generic initialisations before parsing file with readline. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2026 lineno = 0; /* reset global line number */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2027 charno = 0; /* reset global char number */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2028 linecharno = 0; /* reset global char number of line start */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2029 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2030 parser (inf); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2031 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2032 regex_tag_multiline (); |
240 | 2033 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2034 |
240 | 2035 |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2036 /* |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2037 * Check whether an implicitly named tag should be created, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2038 * then call `pfnote'. |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2039 * NAME is a string that is internally copied by this function. |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2040 * |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2041 * TAGS format specification |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2042 * Idea by Sam Kendall <kendall@mv.mv.com> (1997) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2043 * The following is explained in some more detail in etc/ETAGS.EBNF. |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2044 * |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2045 * make_tag creates tags with "implicit tag names" (unnamed tags) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2046 * if the following are all true, assuming NONAM=" \f\t\n\r()=,;": |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2047 * 1. NAME does not contain any of the characters in NONAM; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2048 * 2. LINESTART contains name as either a rightmost, or rightmost but |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2049 * one character, substring; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2050 * 3. the character, if any, immediately before NAME in LINESTART must |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2051 * be a character in NONAM; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2052 * 4. the character, if any, immediately after NAME in LINESTART must |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2053 * also be a character in NONAM. |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2054 * |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2055 * The implementation uses the notinname() macro, which recognises the |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2056 * characters stored in the string `nonam'. |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2057 * etags.el needs to use the same characters that are in NONAM. |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2058 */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2059 static void |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2060 make_tag (name, namelen, is_func, linestart, linelen, lno, cno) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2061 char *name; /* tag name, or NULL if unnamed */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2062 int namelen; /* tag length */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2063 bool is_func; /* tag is a function */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2064 char *linestart; /* start of the line where tag is */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2065 int linelen; /* length of the line where tag is */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2066 int lno; /* line number */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2067 long cno; /* character number */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2068 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2069 bool named = (name != NULL && namelen > 0); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2070 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2071 if (!CTAGS && named) /* maybe set named to false */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2072 /* Let's try to make an implicit tag name, that is, create an unnamed tag |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2073 such that etags.el can guess a name from it. */ |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2074 { |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2075 int i; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2076 register char *cp = name; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2077 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2078 for (i = 0; i < namelen; i++) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2079 if (notinname (*cp++)) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2080 break; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2081 if (i == namelen) /* rule #1 */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2082 { |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2083 cp = linestart + linelen - namelen; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2084 if (notinname (linestart[linelen-1])) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2085 cp -= 1; /* rule #4 */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2086 if (cp >= linestart /* rule #2 */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2087 && (cp == linestart |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2088 || notinname (cp[-1])) /* rule #3 */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2089 && strneq (name, cp, namelen)) /* rule #2 */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2090 named = FALSE; /* use implicit tag name */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2091 } |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2092 } |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2093 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2094 if (named) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2095 name = savenstr (name, namelen); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2096 else |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2097 name = NULL; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2098 pfnote (name, is_func, linestart, linelen, lno, cno); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2099 } |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
2100 |
240 | 2101 /* Record a tag. */ |
27658
5980f19581dc
(pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents:
27595
diff
changeset
|
2102 static void |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2103 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
|
2104 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
|
2105 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
|
2106 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
|
2107 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
|
2108 int lno; /* line number */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2109 long cno; /* character number */ |
240 | 2110 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2111 register node *np; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2112 |
47218
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
2113 assert (name == NULL || name[0] != '\0'); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2114 if (CTAGS && name == NULL) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2115 return; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2116 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2117 np = xnew (1, node); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2118 |
240 | 2119 /* 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
|
2120 if (CTAGS && !cxref_style && streq (name, "main")) |
240 | 2121 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2122 register char *fp = etags_strrchr (curfdp->taggedfname, '/'); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2123 np->name = concat ("M", fp == NULL ? curfdp->taggedfname : fp + 1, ""); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2124 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
|
2125 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
|
2126 fp[0] = '\0'; |
240 | 2127 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2128 else |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2129 np->name = name; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2130 np->valid = TRUE; |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
2131 np->been_warned = FALSE; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2132 np->fdp = curfdp; |
240 | 2133 np->is_func = is_func; |
2134 np->lno = lno; | |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2135 if (np->fdp->usecharno) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2136 /* Our char numbers are 0-base, because of C language tradition? |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2137 ctags compatibility? old versions compatibility? I don't know. |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2138 Anyway, since emacs's are 1-base we expect etags.el to take care |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2139 of the difference. If we wanted to have 1-based numbers, we would |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2140 uncomment the +1 below. */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2141 np->cno = cno /* + 1 */ ; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2142 else |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2143 np->cno = invalidcharno; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2144 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
|
2145 if (CTAGS && !cxref_style) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2146 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2147 if (strlen (linestart) < 50) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2148 np->regex = concat (linestart, "$", ""); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2149 else |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2150 np->regex = savenstr (linestart, 50); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2151 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2152 else |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2153 np->regex = savenstr (linestart, linelen); |
240 | 2154 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2155 add_node (np, &nodehead); |
240 | 2156 } |
2157 | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2158 /* |
240 | 2159 * free_tree () |
2160 * recurse on left children, iterate on right children. | |
2161 */ | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
2162 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
|
2163 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
|
2164 register node *np; |
240 | 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 while (np) |
240 | 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 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
|
2169 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
|
2170 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
|
2171 free (np->name); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2172 free (np->regex); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2173 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
|
2174 np = node_right; |
240 | 2175 } |
2176 } | |
2177 | |
2178 /* | |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2179 * free_fdesc () |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2180 * delete a file description |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2181 */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2182 static void |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2183 free_fdesc (fdp) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2184 register fdesc *fdp; |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2185 { |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2186 if (fdp->infname != NULL) free (fdp->infname); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2187 if (fdp->infabsname != NULL) free (fdp->infabsname); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2188 if (fdp->infabsdir != NULL) free (fdp->infabsdir); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2189 if (fdp->taggedfname != NULL) free (fdp->taggedfname); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2190 if (fdp->prop != NULL) free (fdp->prop); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2191 free (fdp); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2192 } |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2193 |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2194 /* |
240 | 2195 * add_node () |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2196 * Adds a node to the tree of nodes. In etags mode, sort by file |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2197 * name. In ctags mode, sort by tag name. Make no attempt at |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2198 * balancing. |
240 | 2199 * |
2200 * add_node is the only function allowed to add nodes, so it can | |
2201 * maintain state. | |
2202 */ | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
2203 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
|
2204 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
|
2205 node *np, **cur_node_p; |
240 | 2206 { |
2207 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
|
2208 register node *cur_node = *cur_node_p; |
240 | 2209 |
2210 if (cur_node == NULL) | |
2211 { | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2212 *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
|
2213 last_node = np; |
240 | 2214 return; |
2215 } | |
2216 | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
2217 if (!CTAGS) |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2218 /* Etags Mode */ |
240 | 2219 { |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2220 /* For each file name, tags are in a linked sublist on the right |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2221 pointer. The first tags of different files are a linked list |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2222 on the left pointer. last_node points to the end of the last |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2223 used sublist. */ |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2224 if (last_node != NULL && last_node->fdp == np->fdp) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2225 { |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2226 /* Let's use the same sublist as the last added node. */ |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2227 assert (last_node->right == NULL); |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2228 last_node->right = np; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2229 last_node = np; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2230 } |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2231 else if (cur_node->fdp == np->fdp) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2232 { |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2233 /* Scanning the list we found the head of a sublist which is |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2234 good for us. Let's scan this sublist. */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2235 add_node (np, &cur_node->right); |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2236 } |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2237 else |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2238 /* The head of this sublist is not good for us. Let's try the |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2239 next one. */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2240 add_node (np, &cur_node->left); |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2241 } /* if ETAGS mode */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2242 |
240 | 2243 else |
2244 { | |
2245 /* 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
|
2246 dif = strcmp (np->name, cur_node->name); |
240 | 2247 |
2248 /* | |
2249 * If this tag name matches an existing one, then | |
2250 * do not add the node, but maybe print a warning. | |
2251 */ | |
75034
e7e8a2a0d0a9
(longopts): New undocumented option --no-duplicates.
Francesco Potortì <pot@gnu.org>
parents:
74951
diff
changeset
|
2252 if (no_duplicates && !dif) |
240 | 2253 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2254 if (np->fdp == cur_node->fdp) |
240 | 2255 { |
2256 if (!no_warnings) | |
2257 { | |
2258 fprintf (stderr, "Duplicate entry in file %s, line %d: %s\n", | |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2259 np->fdp->infname, lineno, np->name); |
240 | 2260 fprintf (stderr, "Second entry ignored\n"); |
2261 } | |
2262 } | |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2263 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
|
2264 { |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2265 fprintf |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2266 (stderr, |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2267 "Duplicate entry in files %s and %s: %s (Warning only)\n", |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2268 np->fdp->infname, cur_node->fdp->infname, np->name); |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2269 cur_node->been_warned = TRUE; |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2270 } |
240 | 2271 return; |
2272 } | |
2273 | |
2274 /* 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
|
2275 add_node (np, dif < 0 ? &cur_node->left : &cur_node->right); |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2276 } /* if CTAGS mode */ |
240 | 2277 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2278 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2279 /* |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2280 * invalidate_nodes () |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2281 * Scan the node tree and invalidate all nodes pointing to the |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2282 * given file description (CTAGS case) or free them (ETAGS case). |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2283 */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2284 static void |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2285 invalidate_nodes (badfdp, npp) |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2286 fdesc *badfdp; |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2287 node **npp; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2288 { |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2289 node *np = *npp; |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2290 |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2291 if (np == NULL) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2292 return; |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2293 |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2294 if (CTAGS) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2295 { |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2296 if (np->left != NULL) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2297 invalidate_nodes (badfdp, &np->left); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2298 if (np->fdp == badfdp) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
2299 np->valid = FALSE; |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2300 if (np->right != NULL) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2301 invalidate_nodes (badfdp, &np->right); |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2302 } |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2303 else |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2304 { |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
2305 assert (np->fdp != NULL); |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2306 if (np->fdp == badfdp) |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2307 { |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
2308 *npp = np->left; /* detach the sublist from the list */ |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2309 np->left = NULL; /* isolate it */ |
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2310 free_tree (np); /* free it */ |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
2311 invalidate_nodes (badfdp, npp); |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2312 } |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
2313 else |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
2314 invalidate_nodes (badfdp, &np->left); |
44735
98b894d1d3ad
(last_node): Make it a global variable.
Francesco Potortì <pot@gnu.org>
parents:
44614
diff
changeset
|
2315 } |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2316 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2317 |
240 | 2318 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2319 static int total_size_of_entries __P((node *)); |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2320 static int number_len __P((long)); |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2321 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2322 /* Length of a non-negative number's decimal representation. */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2323 static int |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2324 number_len (num) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2325 long num; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2326 { |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2327 int len = 1; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2328 while ((num /= 10) > 0) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2329 len += 1; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2330 return len; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2331 } |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2332 |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2333 /* |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2334 * Return total number of characters that put_entries will output for |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2335 * the nodes in the linked list at the right of the specified node. |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2336 * This count is irrelevant with etags.el since emacs 19.34 at least, |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2337 * but is still supplied for backward compatibility. |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2338 */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2339 static int |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2340 total_size_of_entries (np) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2341 register node *np; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2342 { |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2343 register int total = 0; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2344 |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2345 for (; np != NULL; np = np->right) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2346 if (np->valid) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2347 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2348 total += strlen (np->regex) + 1; /* pat\177 */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2349 if (np->name != NULL) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2350 total += strlen (np->name) + 1; /* name\001 */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2351 total += number_len ((long) np->lno) + 1; /* lno, */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2352 if (np->cno != invalidcharno) /* cno */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2353 total += number_len (np->cno); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2354 total += 1; /* newline */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2355 } |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2356 |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2357 return total; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2358 } |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2359 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
2360 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
|
2361 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
|
2362 register node *np; |
240 | 2363 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2364 register char *sp; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2365 static fdesc *fdp = NULL; |
240 | 2366 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2367 if (np == NULL) |
240 | 2368 return; |
2369 | |
2370 /* Output subentries that precede this one */ | |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2371 if (CTAGS) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2372 put_entries (np->left); |
240 | 2373 |
2374 /* Output this entry */ | |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2375 if (np->valid) |
240 | 2376 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2377 if (!CTAGS) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2378 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2379 /* Etags mode */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2380 if (fdp != np->fdp) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2381 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2382 fdp = np->fdp; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2383 fprintf (tagf, "\f\n%s,%d\n", |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2384 fdp->taggedfname, total_size_of_entries (np)); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2385 fdp->written = TRUE; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2386 } |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2387 fputs (np->regex, tagf); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2388 fputc ('\177', tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2389 if (np->name != NULL) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2390 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2391 fputs (np->name, tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2392 fputc ('\001', tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2393 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2394 fprintf (tagf, "%d,", np->lno); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2395 if (np->cno != invalidcharno) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2396 fprintf (tagf, "%ld", np->cno); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2397 fputs ("\n", tagf); |
240 | 2398 } |
2399 else | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2400 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2401 /* Ctags mode */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2402 if (np->name == NULL) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2403 error ("internal error: NULL name in ctags mode.", (char *)NULL); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2404 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2405 if (cxref_style) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2406 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2407 if (vgrind_style) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2408 fprintf (stdout, "%s %s %d\n", |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2409 np->name, np->fdp->taggedfname, (np->lno + 63) / 64); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2410 else |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2411 fprintf (stdout, "%-16s %3d %-16s %s\n", |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2412 np->name, np->lno, np->fdp->taggedfname, np->regex); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2413 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2414 else |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2415 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2416 fprintf (tagf, "%s\t%s\t", np->name, np->fdp->taggedfname); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2417 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2418 if (np->is_func) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2419 { /* function or #define macro with args */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2420 putc (searchar, tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2421 putc ('^', tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2422 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
2423 for (sp = np->regex; *sp; sp++) |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2424 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2425 if (*sp == '\\' || *sp == searchar) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2426 putc ('\\', tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2427 putc (*sp, tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2428 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2429 putc (searchar, tagf); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2430 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2431 else |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2432 { /* anything else; text pattern inadequate */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2433 fprintf (tagf, "%d", np->lno); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2434 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2435 putc ('\n', tagf); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2436 } |
240 | 2437 } |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
2438 } /* if this node contains a valid tag */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2439 |
240 | 2440 /* 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
|
2441 put_entries (np->right); |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2442 if (!CTAGS) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2443 put_entries (np->left); |
240 | 2444 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2445 |
240 | 2446 |
35740
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2447 /* C extensions. */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2448 #define C_EXT 0x00fff /* C extensions */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2449 #define C_PLAIN 0x00000 /* C */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2450 #define C_PLPL 0x00001 /* C++ */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2451 #define C_STAR 0x00003 /* C* */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2452 #define C_JAVA 0x00005 /* JAVA */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2453 #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
|
2454 #define YACC 0x10000 /* yacc file */ |
9a7c0217c7bd
Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents:
35665
diff
changeset
|
2455 |
240 | 2456 /* |
2457 * The C symbol tables. | |
2458 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2459 enum sym_type |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2460 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2461 st_none, |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2462 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
|
2463 st_C_gnumacro, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2464 st_C_ignore, st_C_attribute, |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2465 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
|
2466 st_C_operator, |
36361
e9d69d45eae4
When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents:
35775
diff
changeset
|
2467 st_C_class, st_C_template, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2468 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2469 }; |
240 | 2470 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2471 static unsigned int hash __P((const char *, unsigned int)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2472 static struct C_stab_entry * in_word_set __P((const char *, unsigned int)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2473 static enum sym_type C_symtype __P((char *, int, int)); |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
2474 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2475 /* Feed stuff between (but not including) %[ and %] lines to: |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2476 gperf -m 5 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2477 %[ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2478 %compare-strncmp |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2479 %enum |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2480 %struct-type |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2481 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
|
2482 %% |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2483 if, 0, st_C_ignore |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2484 for, 0, st_C_ignore |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2485 while, 0, st_C_ignore |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2486 switch, 0, st_C_ignore |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2487 return, 0, st_C_ignore |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2488 __attribute__, 0, st_C_attribute |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2489 @interface, 0, st_C_objprot |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2490 @protocol, 0, st_C_objprot |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2491 @implementation,0, st_C_objimpl |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2492 @end, 0, st_C_objend |
75675
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2493 import, (C_JAVA & ~C_PLPL), st_C_ignore |
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2494 package, (C_JAVA & ~C_PLPL), st_C_ignore |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2495 friend, C_PLPL, st_C_ignore |
75675
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2496 extends, (C_JAVA & ~C_PLPL), st_C_javastruct |
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2497 implements, (C_JAVA & ~C_PLPL), st_C_javastruct |
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2498 interface, (C_JAVA & ~C_PLPL), st_C_struct |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2499 class, 0, st_C_class |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2500 namespace, C_PLPL, st_C_struct |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2501 domain, C_STAR, st_C_struct |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2502 union, 0, st_C_struct |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2503 struct, 0, st_C_struct |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2504 extern, 0, st_C_extern |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2505 enum, 0, st_C_enum |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2506 typedef, 0, st_C_typedef |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2507 define, 0, st_C_define |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2508 undef, 0, st_C_define |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2509 operator, C_PLPL, st_C_operator |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2510 template, 0, st_C_template |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2511 # DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach). |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2512 DEFUN, 0, st_C_gnumacro |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2513 SYSCALL, 0, st_C_gnumacro |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2514 ENTRY, 0, st_C_gnumacro |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2515 PSEUDO, 0, st_C_gnumacro |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2516 # 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
|
2517 # EXFUN used in glibc, DEFVAR_* in emacs. |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2518 #EXFUN, 0, st_C_gnumacro |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2519 #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
|
2520 %] |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2521 and replace lines between %< and %> with its output, then: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2522 - remove the #if characterset check |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2523 - make in_word_set static and not inline. */ |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2524 /*%<*/ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2525 /* C code produced by gperf version 3.0.1 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2526 /* Command-line: gperf -m 5 */ |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2527 /* Computed positions: -k'2-3' */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2528 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2529 struct C_stab_entry { char *name; int c_ext; enum sym_type type; }; |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2530 /* maximum key range = 33, 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
|
2531 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2532 #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
|
2533 __inline |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2534 #else |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2535 #ifdef __cplusplus |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2536 inline |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2537 #endif |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2538 #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
|
2539 static unsigned int |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2540 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
|
2541 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
|
2542 register unsigned int len; |
240 | 2543 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2544 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
|
2545 { |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2546 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2547 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2548 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2549 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2550 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2551 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2552 35, 35, 35, 35, 35, 35, 35, 35, 35, 15, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2553 14, 35, 35, 35, 35, 35, 35, 35, 14, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2554 35, 35, 35, 12, 13, 35, 35, 35, 35, 12, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2555 35, 35, 35, 35, 35, 1, 35, 16, 35, 6, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2556 23, 0, 0, 35, 22, 0, 35, 35, 5, 0, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2557 0, 15, 1, 35, 6, 35, 8, 19, 35, 16, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2558 4, 5, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2559 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2560 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2561 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2562 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2563 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2564 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2565 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2566 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2567 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2568 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2569 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2570 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2571 35, 35, 35, 35, 35, 35 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2572 }; |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2573 register int hval = len; |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2574 |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2575 switch (hval) |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2576 { |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2577 default: |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2578 hval += asso_values[(unsigned char)str[2]]; |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2579 /*FALLTHROUGH*/ |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2580 case 2: |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2581 hval += asso_values[(unsigned char)str[1]]; |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2582 break; |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2583 } |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2584 return hval; |
240 | 2585 } |
2586 | |
35766
3584fc1b9b79
(in_word_set): Use `static' in definition (for pcc).
Dave Love <fx@gnu.org>
parents:
35758
diff
changeset
|
2587 static 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
|
2588 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
|
2589 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
|
2590 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
|
2591 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2592 enum |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2593 { |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2594 TOTAL_KEYWORDS = 32, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2595 MIN_WORD_LENGTH = 2, |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2596 MAX_WORD_LENGTH = 15, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2597 MIN_HASH_VALUE = 2, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2598 MAX_HASH_VALUE = 34 |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2599 }; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2600 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2601 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
|
2602 { |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2603 {""}, {""}, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2604 {"if", 0, st_C_ignore}, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2605 {""}, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2606 {"@end", 0, st_C_objend}, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2607 {"union", 0, st_C_struct}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2608 {"define", 0, st_C_define}, |
75675
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2609 {"import", (C_JAVA & ~C_PLPL), st_C_ignore}, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2610 {"template", 0, st_C_template}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2611 {"operator", C_PLPL, st_C_operator}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2612 {"@interface", 0, st_C_objprot}, |
75675
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2613 {"implements", (C_JAVA & ~C_PLPL), st_C_javastruct}, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2614 {"friend", C_PLPL, st_C_ignore}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2615 {"typedef", 0, st_C_typedef}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2616 {"return", 0, st_C_ignore}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2617 {"@implementation",0, st_C_objimpl}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2618 {"@protocol", 0, st_C_objprot}, |
75675
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2619 {"interface", (C_JAVA & ~C_PLPL), st_C_struct}, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2620 {"extern", 0, st_C_extern}, |
75675
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2621 {"extends", (C_JAVA & ~C_PLPL), st_C_javastruct}, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2622 {"struct", 0, st_C_struct}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2623 {"domain", C_STAR, st_C_struct}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2624 {"switch", 0, st_C_ignore}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2625 {"enum", 0, st_C_enum}, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2626 {"for", 0, st_C_ignore}, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2627 {"namespace", C_PLPL, st_C_struct}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2628 {"class", 0, st_C_class}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2629 {"while", 0, st_C_ignore}, |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2630 {"undef", 0, st_C_define}, |
75675
37aa3bcd315f
(gperf, in_word_set): changed attribute for Java to (C_JAVA & ~C_PLPL).
Francesco Potortì <pot@gnu.org>
parents:
75654
diff
changeset
|
2631 {"package", (C_JAVA & ~C_PLPL), st_C_ignore}, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2632 {"__attribute__", 0, st_C_attribute}, |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2633 {"SYSCALL", 0, st_C_gnumacro}, |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
2634 {"ENTRY", 0, st_C_gnumacro}, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2635 {"PSEUDO", 0, st_C_gnumacro}, |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2636 {"DEFUN", 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
|
2637 }; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2638 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2639 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
|
2640 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2641 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
|
2642 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2643 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
|
2644 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
2645 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
|
2646 |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2647 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2648 return &wordlist[key]; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2649 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2650 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2651 return 0; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2652 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2653 /*%>*/ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2654 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
2655 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
|
2656 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
|
2657 char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2658 int len; |
240 | 2659 int c_ext; |
2660 { | |
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
|
2661 register struct C_stab_entry *se = in_word_set (str, len); |
240 | 2662 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2663 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
|
2664 return st_none; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2665 return se->type; |
240 | 2666 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2667 |
240 | 2668 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2669 /* |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2670 * Ignoring __attribute__ ((list)) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2671 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2672 static bool inattribute; /* looking at an __attribute__ construct */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2673 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2674 /* |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2675 * 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
|
2676 * 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
|
2677 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2678 static enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2679 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2680 fvnone, /* nothing seen */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2681 fdefunkey, /* Emacs DEFUN keyword seen */ |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2682 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
|
2683 foperator, /* func: operator keyword seen (cplpl) */ |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2684 fvnameseen, /* function or variable name seen */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2685 fstartlist, /* func: just after open parenthesis */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2686 finlist, /* func: in parameter list */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2687 flistseen, /* func: after parameter list */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2688 fignore, /* func: before open brace */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2689 vignore /* var-like: ignore until ';' */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2690 } fvdef; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2691 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2692 static 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
|
2693 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2694 /* |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2695 * 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
|
2696 * typdef is its state variable. |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2697 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2698 static enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2699 { |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2700 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
|
2701 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
|
2702 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
|
2703 tinbody, /* inside typedef body */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2704 tend, /* just before typedef tag */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2705 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
|
2706 } typdef; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2707 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2708 /* |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2709 * 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
|
2710 * 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
|
2711 * variable. |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2712 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2713 static enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2714 { |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2715 snone, /* nothing seen yet, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2716 or in struct body if bracelev > 0 */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2717 skeyseen, /* struct-like keyword seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2718 stagseen, /* struct-like tag seen */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2719 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
|
2720 } structdef; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2721 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2722 /* |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2723 * 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
|
2724 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2725 static char *objtag = "<uninited>"; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2726 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2727 /* |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2728 * 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
|
2729 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2730 static enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2731 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2732 dnone, /* nothing seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2733 dsharpseen, /* '#' seen as first char on line */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2734 ddefineseen, /* '#' and 'define' seen */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
2735 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
|
2736 } definedef; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2737 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2738 /* |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2739 * 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
|
2740 * 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
|
2741 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2742 static enum |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2743 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2744 onone, /* nothing seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2745 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
|
2746 oimplementation, /* @implementations seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2747 otagseen, /* class name seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2748 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
|
2749 ocatseen, /* category name seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2750 oinbody, /* in @implementation body */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2751 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
|
2752 omethodtag, /* after method name */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2753 omethodcolon, /* after method colon */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2754 omethodparm, /* after method parameter */ |
14230
6b836f84bccf
(enum sym_type, anonymous enum): Delete final comma.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
2755 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
|
2756 } objdef; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2757 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2758 |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2759 /* |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2760 * 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
|
2761 * 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
|
2762 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2763 static struct tok |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2764 { |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2765 char *line; /* string containing the token */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2766 int offset; /* where the token starts in LINE */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2767 int length; /* token length */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2768 /* |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2769 The previous members can be used to pass strings around for generic |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2770 purposes. The following ones specifically refer to creating tags. In this |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2771 case the token contained here is the pattern that will be used to create a |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2772 tag. |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2773 */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2774 bool valid; /* do not create a tag; the token should be |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2775 invalidated whenever a state machine is |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2776 reset prematurely */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2777 bool named; /* create a named tag */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2778 int lineno; /* source line number of tag */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
2779 long linepos; /* source char number of tag */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2780 } token; /* latest token read */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2781 |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2782 /* |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2783 * 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
|
2784 * 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
|
2785 */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2786 static void pushclass_above __P((int, char *, int)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2787 static void popclass_above __P((int)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2788 static void write_classname __P((linebuffer *, char *qualifier)); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2789 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
2790 static struct { |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2791 char **cname; /* nested class names */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2792 int *bracelev; /* nested class brace level */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2793 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
|
2794 int size; /* length of the array */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2795 } cstack; /* stack for nested declaration tags */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2796 /* 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
|
2797 #define nestlev (cstack.nl) |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
2798 /* After struct keyword or in struct body, not inside a nested function. */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2799 #define instruct (structdef == snone && nestlev > 0 \ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2800 && bracelev == cstack.bracelev[nestlev-1] + 1) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2801 |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2802 static void |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2803 pushclass_above (bracelev, str, len) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2804 int bracelev; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2805 char *str; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2806 int len; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2807 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2808 int nl; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2809 |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2810 popclass_above (bracelev); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2811 nl = cstack.nl; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2812 if (nl >= cstack.size) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2813 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2814 int size = cstack.size *= 2; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2815 xrnew (cstack.cname, size, char *); |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2816 xrnew (cstack.bracelev, size, int); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2817 } |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2818 assert (nl == 0 || cstack.bracelev[nl-1] < bracelev); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2819 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len); |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2820 cstack.bracelev[nl] = bracelev; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2821 cstack.nl = nl + 1; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2822 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2823 |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2824 static void |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2825 popclass_above (bracelev) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2826 int bracelev; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2827 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2828 int nl; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2829 |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2830 for (nl = cstack.nl - 1; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2831 nl >= 0 && cstack.bracelev[nl] >= bracelev; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2832 nl--) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2833 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2834 if (cstack.cname[nl] != NULL) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2835 free (cstack.cname[nl]); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2836 cstack.nl = nl; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2837 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2838 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2839 |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2840 static void |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2841 write_classname (cn, qualifier) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2842 linebuffer *cn; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2843 char *qualifier; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2844 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2845 int i, len; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2846 int qlen = strlen (qualifier); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2847 |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2848 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
|
2849 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2850 len = 0; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2851 cn->len = 0; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2852 cn->buffer[0] = '\0'; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2853 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2854 else |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2855 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2856 len = strlen (cstack.cname[0]); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2857 linebuffer_setlen (cn, len); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2858 strcpy (cn->buffer, cstack.cname[0]); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2859 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2860 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
|
2861 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2862 char *s; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2863 int slen; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2864 |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2865 s = cstack.cname[i]; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2866 if (s == NULL) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2867 continue; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2868 slen = strlen (s); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2869 len += slen + qlen; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2870 linebuffer_setlen (cn, len); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2871 strncat (cn->buffer, qualifier, qlen); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2872 strncat (cn->buffer, s, slen); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2873 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2874 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2875 |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2876 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2877 static bool consider_token __P((char *, int, int, int *, int, int, bool *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
2878 static void make_C_tag __P((bool)); |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
2879 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2880 /* |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2881 * consider_token () |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2882 * 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
|
2883 * 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
|
2884 * 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
|
2885 * |
78472 | 2886 * *IS_FUNC gets TRUE if 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
|
2887 * 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
|
2888 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2889 * Globals |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2890 * fvdef IN OUT |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2891 * structdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2892 * definedef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2893 * typdef IN OUT |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2894 * objdef IN OUT |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2895 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2896 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
2897 static bool |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2898 consider_token (str, len, c, c_extp, bracelev, 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
|
2899 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
|
2900 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
|
2901 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
|
2902 int *c_extp; /* IN, OUT: C extensions mask */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2903 int bracelev; /* IN: brace level */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2904 int parlev; /* IN: parenthesis level */ |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
2905 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
|
2906 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2907 /* When structdef is stagseen, scolonseen, or snone with bracelev > 0, |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2908 structtype is the type of the preceding struct-like keyword, and |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2909 structbracelev is the 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
|
2910 static enum sym_type structtype; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2911 static int structbracelev; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2912 static enum sym_type toktype; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2913 |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
2914 |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
2915 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
|
2916 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2917 /* |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2918 * Skip __attribute__ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2919 */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2920 if (toktype == st_C_attribute) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2921 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2922 inattribute = TRUE; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2923 return FALSE; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2924 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2925 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2926 /* |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2927 * Advance the definedef state machine. |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2928 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2929 switch (definedef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2930 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2931 case dnone: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2932 /* We're not on a preprocessor line. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2933 if (toktype == st_C_gnumacro) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2934 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2935 fvdef = fdefunkey; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2936 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2937 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2938 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2939 case dsharpseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2940 if (toktype == st_C_define) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2941 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2942 definedef = ddefineseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2943 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2944 else |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2945 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2946 definedef = dignorerest; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2947 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2948 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2949 case ddefineseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2950 /* |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2951 * Make a tag for any macro, unless it is a constant |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2952 * and constantypedefs is FALSE. |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2953 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2954 definedef = dignorerest; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2955 *is_func_or_var = (c == '('); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2956 if (!*is_func_or_var && !constantypedefs) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2957 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2958 else |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2959 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2960 case dignorerest: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2961 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2962 default: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2963 error ("internal error: definedef value.", (char *)NULL); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2964 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2965 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2966 /* |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2967 * Now typedefs |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2968 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2969 switch (typdef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2970 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2971 case tnone: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2972 if (toktype == st_C_typedef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2973 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2974 if (typedefs) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2975 typdef = tkeyseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2976 fvextern = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2977 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2978 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2979 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2980 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2981 case tkeyseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2982 switch (toktype) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2983 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2984 case st_none: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2985 case st_C_class: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2986 case st_C_struct: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2987 case st_C_enum: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2988 typdef = ttypeseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2989 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2990 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2991 case ttypeseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2992 if (structdef == snone && fvdef == fvnone) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2993 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2994 fvdef = fvnameseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2995 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2996 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2997 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2998 case tend: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
2999 switch (toktype) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3000 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3001 case st_C_class: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3002 case st_C_struct: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3003 case st_C_enum: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3004 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3005 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3006 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3007 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3008 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3009 /* |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3010 * This structdef business is NOT invoked when we are ctags and the |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3011 * file is plain C. This is because a struct tag may have the same |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3012 * name as another tag, and this loses with ctags. |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3013 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3014 switch (toktype) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3015 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3016 case st_C_javastruct: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3017 if (structdef == stagseen) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3018 structdef = scolonseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3019 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3020 case st_C_template: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3021 case st_C_class: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3022 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3023 && bracelev == 0 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3024 && definedef == dnone && structdef == snone |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3025 && typdef == tnone && fvdef == fvnone) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3026 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3027 if (toktype == st_C_template) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3028 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3029 /* FALLTHRU */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3030 case st_C_struct: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3031 case st_C_enum: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3032 if (parlev == 0 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3033 && fvdef != vignore |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3034 && (typdef == tkeyseen |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3035 || (typedefs_or_cplusplus && structdef == snone))) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3036 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3037 structdef = skeyseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3038 structtype = toktype; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3039 structbracelev = bracelev; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3040 if (fvdef == fvnameseen) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3041 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3042 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3043 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3044 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3045 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3046 if (structdef == skeyseen) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3047 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3048 structdef = stagseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3049 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3050 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3051 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3052 if (typdef != tnone) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3053 definedef = dnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3054 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3055 /* Detect Objective C constructs. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3056 switch (objdef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3057 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3058 case onone: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3059 switch (toktype) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3060 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3061 case st_C_objprot: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3062 objdef = oprotocol; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3063 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3064 case st_C_objimpl: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3065 objdef = oimplementation; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3066 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3067 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3068 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3069 case oimplementation: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3070 /* Save the class tag for functions or variables defined inside. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3071 objtag = savenstr (str, len); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3072 objdef = oinbody; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3073 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3074 case oprotocol: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3075 /* Save the class tag for categories. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3076 objtag = savenstr (str, len); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3077 objdef = otagseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3078 *is_func_or_var = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3079 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3080 case oparenseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3081 objdef = ocatseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3082 *is_func_or_var = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3083 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3084 case oinbody: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3085 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3086 case omethodsign: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3087 if (parlev == 0) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3088 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3089 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3090 objdef = omethodtag; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3091 linebuffer_setlen (&token_name, len); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3092 strncpy (token_name.buffer, str, len); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3093 token_name.buffer[len] = '\0'; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3094 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3095 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3096 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3097 case omethodcolon: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3098 if (parlev == 0) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3099 objdef = omethodparm; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3100 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3101 case omethodparm: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3102 if (parlev == 0) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3103 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3104 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3105 objdef = omethodtag; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3106 linebuffer_setlen (&token_name, token_name.len + len); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3107 strncat (token_name.buffer, str, len); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3108 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3109 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3110 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3111 case oignore: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3112 if (toktype == st_C_objend) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3113 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3114 /* Memory leakage here: the string pointed by objtag is |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3115 never released, because many tests would be needed to |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3116 avoid breaking on incorrect input code. The amount of |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3117 memory leaked here is the sum of the lengths of the |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3118 class tags. |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3119 free (objtag); */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3120 objdef = onone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3121 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3122 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3123 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3124 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3125 /* A function, variable or enum constant? */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3126 switch (toktype) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3127 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3128 case st_C_extern: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3129 fvextern = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3130 switch (fvdef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3131 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3132 case finlist: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3133 case flistseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3134 case fignore: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3135 case vignore: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3136 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3137 default: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3138 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3139 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3140 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3141 case st_C_ignore: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3142 fvextern = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3143 fvdef = vignore; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3144 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3145 case st_C_operator: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3146 fvdef = foperator; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3147 *is_func_or_var = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3148 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3149 case st_none: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3150 if (constantypedefs |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3151 && structdef == snone |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3152 && structtype == st_C_enum && bracelev > structbracelev) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3153 return TRUE; /* enum constant */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3154 switch (fvdef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3155 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3156 case fdefunkey: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3157 if (bracelev > 0) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3158 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3159 fvdef = fdefunname; /* GNU macro */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3160 *is_func_or_var = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3161 return TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3162 case fvnone: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3163 switch (typdef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3164 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3165 case ttypeseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3166 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3167 case tnone: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3168 if ((strneq (str, "asm", 3) && endtoken (str[3])) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3169 || (strneq (str, "__asm__", 7) && endtoken (str[7]))) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3170 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3171 fvdef = vignore; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3172 return FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3173 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3174 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3175 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3176 /* FALLTHRU */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3177 case fvnameseen: |
52421
c6c2d0694257
(consider_token): check C++ `operator' only when the token len is long
Francesco Potortì <pot@gnu.org>
parents:
52401
diff
changeset
|
3178 if (len >= 10 && strneq (str+len-10, "::operator", 10)) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3179 { |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3180 if (*c_extp & C_AUTO) /* automatic detection of C++ */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3181 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3182 fvdef = foperator; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3183 *is_func_or_var = TRUE; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3184 return TRUE; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3185 } |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3186 if (bracelev > 0 && !instruct) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3187 break; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3188 fvdef = fvnameseen; /* function or variable */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3189 *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
|
3190 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3191 } |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
3192 break; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3193 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3194 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3195 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3196 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3197 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3198 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3199 /* |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3200 * 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
|
3201 * 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
|
3202 * them at end of line, it is possible to use those pointers. |
240 | 3203 */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
3204 static struct |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3205 { |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3206 long linepos; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3207 linebuffer lb; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3208 } lbs[2]; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3209 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3210 #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
|
3211 #define switch_line_buffers() (curndx = 1 - curndx) |
240 | 3212 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3213 #define curlb (lbs[curndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3214 #define newlb (lbs[newndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3215 #define curlinepos (lbs[curndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3216 #define newlinepos (lbs[newndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3217 |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3218 #define plainc ((c_ext & C_EXT) == C_PLAIN) |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3219 #define cplpl (c_ext & C_PLPL) |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3220 #define cjava ((c_ext & C_JAVA) == C_JAVA) |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3221 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
3222 #define CNL_SAVE_DEFINEDEF() \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3223 do { \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3224 curlinepos = charno; \ |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
3225 readline (&curlb, inf); \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3226 lp = curlb.buffer; \ |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
3227 quotednl = FALSE; \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3228 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
|
3229 } while (0) |
240 | 3230 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
3231 #define CNL() \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3232 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
|
3233 CNL_SAVE_DEFINEDEF(); \ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3234 if (savetoken.valid) \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3235 { \ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3236 token = savetoken; \ |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3237 savetoken.valid = FALSE; \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3238 } \ |
240 | 3239 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
|
3240 } while (0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3241 |
16607
16b8d910795f
* etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents:
16573
diff
changeset
|
3242 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
3243 static void |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3244 make_C_tag (isfun) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3245 bool isfun; |
16607
16b8d910795f
* etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents:
16573
diff
changeset
|
3246 { |
74768
75794203c470
(C_entries): DEFUN names were longer by one: corrected.
Francesco Potortì <pot@gnu.org>
parents:
74298
diff
changeset
|
3247 /* This function is never 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
|
3248 we must protect against invalid input or internal errors. */ |
45925
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
3249 if (!DEBUG && !token.valid) |
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
3250 return; |
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
3251 |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3252 if (token.valid) |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3253 make_tag (token_name.buffer, token_name.len, isfun, token.line, |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3254 token.offset+token.length+1, token.lineno, token.linepos); |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3255 else /* this case is optimised away if !DEBUG */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3256 make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""), |
45925
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
3257 token_name.len + 17, isfun, token.line, |
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
3258 token.offset+token.length+1, token.lineno, token.linepos); |
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
3259 |
5f3ac9accae3
Use, together with etags.el, an optimised form of tags,
Francesco Potortì <pot@gnu.org>
parents:
45918
diff
changeset
|
3260 token.valid = FALSE; |
16607
16b8d910795f
* etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents:
16573
diff
changeset
|
3261 } |
16b8d910795f
* etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents:
16573
diff
changeset
|
3262 |
240 | 3263 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3264 /* |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3265 * C_entries () |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3266 * This routine finds functions, variables, typedefs, |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3267 * #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
|
3268 * 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
|
3269 */ |
27658
5980f19581dc
(pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents:
27595
diff
changeset
|
3270 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3271 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
|
3272 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
|
3273 FILE *inf; /* input file */ |
240 | 3274 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3275 register char c; /* latest char read; '\0' for end of line */ |
240 | 3276 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
|
3277 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
|
3278 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
|
3279 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
|
3280 char *qualifier; /* string used to qualify names */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3281 int qlen; /* length of qualifier */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3282 int bracelev; /* current brace level */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3283 int bracketlev; /* current bracket 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
|
3284 int parlev; /* current parenthesis level */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3285 int attrparlev; /* __attribute__ parenthesis level */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3286 int templatelev; /* current template level */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3287 int typdefbracelev; /* bracelev where a typedef struct body begun */ |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3288 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
|
3289 bool yacc_rules; /* in the rules part of a yacc file */ |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
3290 struct tok savetoken = {0}; /* token saved during preprocessor handling */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3291 |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3292 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
3293 linebuffer_init (&lbs[0].lb); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
3294 linebuffer_init (&lbs[1].lb); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3295 if (cstack.size == 0) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3296 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3297 cstack.size = (DEBUG) ? 1 : 4; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3298 cstack.nl = 0; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3299 cstack.cname = xnew (cstack.size, char *); |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3300 cstack.bracelev = xnew (cstack.size, int); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3301 } |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
3302 |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3303 tokoff = toklen = typdefbracelev = 0; /* keep compiler quiet */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3304 curndx = newndx = 0; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3305 lp = curlb.buffer; |
240 | 3306 *lp = 0; |
3307 | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
3308 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
|
3309 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
|
3310 yacc_rules = FALSE; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3311 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
|
3312 token.valid = savetoken.valid = FALSE; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3313 bracelev = bracketlev = parlev = attrparlev = templatelev = 0; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3314 if (cjava) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3315 { qualifier = "."; qlen = 1; } |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3316 else |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3317 { qualifier = "::"; qlen = 2; } |
240 | 3318 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3319 |
240 | 3320 while (!feof (inf)) |
3321 { | |
3322 c = *lp++; | |
3323 if (c == '\\') | |
3324 { | |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3325 /* If we are at the end of the line, the next character is a |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3326 '\0'; do not skip it, because it is what tells us |
621 | 3327 to read the next line. */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3328 if (*lp == '\0') |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
3329 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3330 quotednl = TRUE; |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
3331 continue; |
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
3332 } |
401 | 3333 lp++; |
240 | 3334 c = ' '; |
3335 } | |
3336 else if (incomm) | |
3337 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3338 switch (c) |
240 | 3339 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3340 case '*': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3341 if (*lp == '/') |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3342 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3343 c = *lp++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3344 incomm = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3345 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3346 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3347 case '\0': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3348 /* 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
|
3349 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
|
3350 CNL_SAVE_DEFINEDEF (); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3351 break; |
240 | 3352 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3353 continue; |
240 | 3354 } |
3355 else if (inquote) | |
3356 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3357 switch (c) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3358 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3359 case '"': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3360 inquote = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3361 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3362 case '\0': |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3363 /* 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
|
3364 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
|
3365 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
|
3366 CNL_SAVE_DEFINEDEF (); |
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 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3369 continue; |
240 | 3370 } |
3371 else if (inchar) | |
3372 { | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3373 switch (c) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3374 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3375 case '\0': |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3376 /* 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
|
3377 CNL (); |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3378 /* FALLTHRU */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3379 case '\'': |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3380 inchar = FALSE; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3381 break; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3382 } |
240 | 3383 continue; |
3384 } | |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3385 else if (bracketlev > 0) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3386 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3387 switch (c) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3388 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3389 case ']': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3390 if (--bracketlev > 0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3391 continue; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3392 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3393 case '\0': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3394 CNL_SAVE_DEFINEDEF (); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3395 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3396 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3397 continue; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3398 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3399 else switch (c) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3400 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3401 case '"': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3402 inquote = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3403 if (inattribute) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3404 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3405 switch (fvdef) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3406 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3407 case fdefunkey: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3408 case fstartlist: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3409 case finlist: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3410 case fignore: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3411 case vignore: |
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
|
3412 break; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3413 default: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3414 fvextern = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3415 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3416 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3417 continue; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3418 case '\'': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3419 inchar = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3420 if (inattribute) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3421 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3422 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3423 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3424 fvextern = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3425 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3426 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3427 continue; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3428 case '/': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3429 if (*lp == '*') |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3430 { |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
3431 incomm = TRUE; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3432 lp++; |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
3433 c = ' '; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3434 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3435 else if (/* cplpl && */ *lp == '/') |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3436 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3437 c = '\0'; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3438 } |
80957
3de8e8f14f0d
Extern definitions of some more pointer functions for
Francesco Potortì <pot@gnu.org>
parents:
76181
diff
changeset
|
3439 break; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3440 case '%': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3441 if ((c_ext & YACC) && *lp == '%') |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3442 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3443 /* Entering or exiting rules section in yacc file. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3444 lp++; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3445 definedef = dnone; fvdef = fvnone; fvextern = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3446 typdef = tnone; structdef = snone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3447 midtoken = inquote = inchar = incomm = quotednl = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3448 bracelev = 0; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3449 yacc_rules = !yacc_rules; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3450 continue; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3451 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3452 else |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3453 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3454 case '#': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3455 if (definedef == dnone) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3456 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3457 char *cp; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3458 bool cpptoken = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3459 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3460 /* Look back on this line. If all blanks, or nonblanks |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3461 followed by an end of comment, this is a preprocessor |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3462 token. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3463 for (cp = newlb.buffer; cp < lp-1; cp++) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3464 if (!iswhite (*cp)) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3465 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3466 if (*cp == '*' && *(cp+1) == '/') |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3467 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3468 cp++; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3469 cpptoken = TRUE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3470 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3471 else |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3472 cpptoken = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3473 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3474 if (cpptoken) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3475 definedef = dsharpseen; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3476 } /* if (definedef == dnone) */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3477 continue; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3478 case '[': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3479 bracketlev++; |
240 | 3480 continue; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3481 } /* switch (c) */ |
240 | 3482 |
3483 | |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3484 /* 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
|
3485 if (typdef != tignore |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3486 && definedef != dignorerest |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3487 && fvdef != finlist |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3488 && templatelev == 0 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3489 && (definedef != dnone |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3490 || structdef != scolonseen) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3491 && !inattribute) |
240 | 3492 { |
3493 if (midtoken) | |
3494 { | |
3495 if (endtoken (c)) | |
3496 { | |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3497 if (c == ':' && *lp == ':' && begtoken (lp[1])) |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3498 /* This handles :: in the middle, |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3499 but not at the beginning of an identifier. |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3500 Also, space-separated :: is not recognised. */ |
240 | 3501 { |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3502 if (c_ext & C_AUTO) /* automatic detection of C++ */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3503 c_ext = (c_ext | C_PLPL) & ~C_AUTO; |
240 | 3504 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
|
3505 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
|
3506 c = lp[-1]; |
35758
aa069bbee4c8
Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents:
35741
diff
changeset
|
3507 goto still_in_token; |
240 | 3508 } |
3509 else | |
3510 { | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3511 bool funorvar = FALSE; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3512 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3513 if (yacc_rules |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3514 || consider_token (newlb.buffer + tokoff, toklen, c, |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3515 &c_ext, bracelev, parlev, |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3516 &funorvar)) |
240 | 3517 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
3518 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
|
3519 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
3520 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
|
3521 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
|
3522 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
|
3523 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
|
3524 while (*lp != '\0' |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
3525 && !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
|
3526 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
|
3527 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
|
3528 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
|
3529 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3530 token.named = FALSE; |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3531 if (!plainc |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3532 && nestlev > 0 && definedef == dnone) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3533 /* 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
|
3534 { |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3535 write_classname (&token_name, qualifier); |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3536 linebuffer_setlen (&token_name, |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3537 token_name.len+qlen+toklen); |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3538 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
|
3539 strncat (token_name.buffer, |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3540 newlb.buffer + tokoff, toklen); |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3541 token.named = TRUE; |
240 | 3542 } |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3543 else if (objdef == ocatseen) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3544 /* Objective C category */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3545 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3546 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
|
3547 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
|
3548 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
|
3549 strcat (token_name.buffer, "("); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3550 strncat (token_name.buffer, |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3551 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
|
3552 strcat (token_name.buffer, ")"); |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3553 token.named = TRUE; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3554 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3555 else if (objdef == omethodtag |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3556 || objdef == omethodparm) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3557 /* Objective C method */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3558 { |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3559 token.named = TRUE; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3560 } |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3561 else if (fvdef == fdefunname) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3562 /* GNU DEFUN and similar macros */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3563 { |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3564 bool defun = (newlb.buffer[tokoff] == 'F'); |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3565 int off = tokoff; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3566 int len = toklen; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3567 |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3568 /* 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
|
3569 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
|
3570 if (defun) |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3571 { |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3572 off += 1; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3573 len -= 1; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3574 } |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3575 linebuffer_setlen (&token_name, len); |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3576 strncpy (token_name.buffer, |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3577 newlb.buffer + off, len); |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3578 token_name.buffer[len] = '\0'; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3579 if (defun) |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3580 while (--len >= 0) |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3581 if (token_name.buffer[len] == '_') |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3582 token_name.buffer[len] = '-'; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3583 token.named = defun; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3584 } |
240 | 3585 else |
3586 { | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3587 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
|
3588 strncpy (token_name.buffer, |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3589 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
|
3590 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
|
3591 /* Name macros and members. */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3592 token.named = (structdef == stagseen |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3593 || typdef == ttypeseen |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3594 || typdef == tend |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3595 || (funorvar |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3596 && definedef == dignorerest) |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3597 || (funorvar |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3598 && definedef == dnone |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3599 && structdef == snone |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3600 && bracelev > 0)); |
240 | 3601 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3602 token.lineno = lineno; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3603 token.offset = tokoff; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3604 token.length = toklen; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3605 token.line = newlb.buffer; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3606 token.linepos = newlinepos; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3607 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
|
3608 |
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
|
3609 if (definedef == dnone |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3610 && (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
|
3611 || 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
|
3612 || structdef == stagseen |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3613 || typdef == tend |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3614 || typdef == ttypeseen |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3615 || objdef != onone)) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3616 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3617 if (current_lb_is_new) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3618 switch_line_buffers (); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3619 } |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3620 else if (definedef != dnone |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3621 || fvdef == fdefunname |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3622 || instruct) |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3623 make_C_tag (funorvar); |
240 | 3624 } |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3625 else /* not yacc and consider_token failed */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3626 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3627 if (inattribute && fvdef == fignore) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3628 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3629 /* We have just met __attribute__ after a |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3630 function parameter list: do not tag the |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3631 function again. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3632 fvdef = fvnone; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3633 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3634 } |
240 | 3635 midtoken = FALSE; |
3636 } | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3637 } /* if (endtoken (c)) */ |
240 | 3638 else if (intoken (c)) |
35758
aa069bbee4c8
Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents:
35741
diff
changeset
|
3639 still_in_token: |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3640 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3641 toklen++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3642 continue; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3643 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3644 } /* if (midtoken) */ |
240 | 3645 else if (begtoken (c)) |
3646 { | |
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
|
3647 switch (definedef) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3648 { |
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
|
3649 case dnone: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3650 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
|
3651 { |
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
|
3652 case fstartlist: |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3653 /* This prevents tagging fb in |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3654 void (__attribute__((noreturn)) *fb) (void); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3655 Fixing this is not easy and not very important. */ |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3656 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
|
3657 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
|
3658 case flistseen: |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3659 if (plainc || declarations) |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3660 { |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3661 make_C_tag (TRUE); /* a function */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3662 fvdef = fignore; |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3663 } |
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
|
3664 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
|
3665 } |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
3666 if (structdef == stagseen && !cjava) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3667 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3668 popclass_above (bracelev); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3669 structdef = snone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3670 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3671 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
|
3672 case dsharpseen: |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3673 savetoken = token; |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
3674 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3675 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3676 if (!yacc_rules || lp == newlb.buffer + 1) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3677 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3678 tokoff = lp - 1 - newlb.buffer; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3679 toklen = 1; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3680 midtoken = TRUE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3681 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3682 continue; |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
3683 } /* if (begtoken) */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3684 } /* if must look at token */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3685 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3686 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3687 /* 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
|
3688 after having handled a token.*/ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3689 switch (c) |
401 | 3690 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3691 case ':': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3692 if (inattribute) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3693 break; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3694 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
|
3695 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3696 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
|
3697 break; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3698 } |
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
|
3699 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
|
3700 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3701 switch (objdef) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3702 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3703 case otagseen: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3704 objdef = oignore; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3705 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
|
3706 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3707 case omethodtag: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3708 case omethodparm: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3709 objdef = omethodcolon; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3710 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
|
3711 strcat (token_name.buffer, ":"); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3712 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3713 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3714 if (structdef == stagseen) |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3715 { |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3716 structdef = scolonseen; |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3717 break; |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3718 } |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3719 /* Should be useless, but may be work as a safety net. */ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3720 if (cplpl && fvdef == flistseen) |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3721 { |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3722 make_C_tag (TRUE); /* a function */ |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3723 fvdef = fignore; |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3724 break; |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3725 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3726 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3727 case ';': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3728 if (definedef != dnone || inattribute) |
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
|
3729 break; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3730 switch (typdef) |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
3731 { |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3732 case tend: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3733 case ttypeseen: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3734 make_C_tag (FALSE); /* a typedef */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3735 typdef = tnone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3736 fvdef = fvnone; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3737 break; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3738 case tnone: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3739 case tinbody: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3740 case tignore: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3741 switch (fvdef) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3742 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3743 case fignore: |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3744 if (typdef == tignore || cplpl) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3745 fvdef = fvnone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3746 break; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3747 case fvnameseen: |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3748 if ((globals && bracelev == 0 && (!fvextern || declarations)) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3749 || (members && instruct)) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3750 make_C_tag (FALSE); /* a variable */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3751 fvextern = FALSE; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3752 fvdef = fvnone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3753 token.valid = FALSE; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3754 break; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3755 case flistseen: |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3756 if ((declarations |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3757 && (cplpl || !instruct) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3758 && (typdef == tnone || (typdef != tignore && instruct))) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3759 || (members |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3760 && plainc && instruct)) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3761 make_C_tag (TRUE); /* a function */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3762 /* FALLTHRU */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3763 default: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3764 fvextern = FALSE; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3765 fvdef = fvnone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3766 if (declarations |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3767 && cplpl && structdef == stagseen) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3768 make_C_tag (FALSE); /* forward declaration */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3769 else |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3770 token.valid = FALSE; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3771 } /* switch (fvdef) */ |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3772 /* FALLTHRU */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3773 default: |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3774 if (!instruct) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3775 typdef = tnone; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
3776 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3777 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3778 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3779 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3780 case ',': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3781 if (definedef != dnone || inattribute) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3782 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3783 switch (objdef) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3784 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3785 case omethodtag: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3786 case omethodparm: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3787 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
|
3788 objdef = oinbody; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3789 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3790 } |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3791 switch (fvdef) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3792 { |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3793 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
|
3794 case foperator: |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3795 case fstartlist: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3796 case finlist: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3797 case fignore: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3798 case vignore: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3799 break; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3800 case fdefunname: |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3801 fvdef = fignore; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3802 break; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3803 case fvnameseen: |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3804 if (parlev == 0 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3805 && ((globals |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3806 && bracelev == 0 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3807 && templatelev == 0 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3808 && (!fvextern || declarations)) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3809 || (members && instruct))) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3810 make_C_tag (FALSE); /* a variable */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3811 break; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3812 case flistseen: |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3813 if ((declarations && typdef == tnone && !instruct) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3814 || (members && typdef != tignore && instruct)) |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3815 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3816 make_C_tag (TRUE); /* a function */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3817 fvdef = fvnameseen; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3818 } |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3819 else if (!declarations) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3820 fvdef = fvnone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3821 token.valid = FALSE; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3822 break; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3823 default: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3824 fvdef = fvnone; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3825 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3826 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3827 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3828 break; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3829 case ']': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3830 if (definedef != dnone || inattribute) |
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
|
3831 break; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3832 if (structdef == stagseen) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3833 structdef = snone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3834 switch (typdef) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3835 { |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3836 case ttypeseen: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3837 case tend: |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3838 typdef = tignore; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3839 make_C_tag (FALSE); /* a typedef */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3840 break; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3841 case tnone: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3842 case tinbody: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3843 switch (fvdef) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3844 { |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3845 case foperator: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3846 case finlist: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3847 case fignore: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3848 case vignore: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3849 break; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3850 case fvnameseen: |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3851 if ((members && bracelev == 1) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3852 || (globals && bracelev == 0 |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3853 && (!fvextern || declarations))) |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3854 make_C_tag (FALSE); /* a variable */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3855 /* FALLTHRU */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3856 default: |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3857 fvdef = fvnone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3858 } |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3859 break; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3860 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3861 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3862 case '(': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3863 if (inattribute) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3864 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3865 attrparlev++; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3866 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3867 } |
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
|
3868 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
|
3869 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3870 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
|
3871 objdef = oparenseen; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3872 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
|
3873 { |
26262
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 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
|
3875 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
|
3876 && *lp != '*' |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3877 && !instruct) |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
3878 { |
26262
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 /* 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
|
3880 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
|
3881 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
|
3882 typdef = tignore; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3883 fvdef = fignore; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3884 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
|
3885 } |
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 /* 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
|
3887 case foperator: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3888 fvdef = fstartlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3889 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3890 case flistseen: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3891 fvdef = finlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3892 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
|
3893 } |
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
|
3894 parlev++; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3895 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3896 case ')': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3897 if (inattribute) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3898 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3899 if (--attrparlev == 0) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3900 inattribute = FALSE; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3901 break; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3902 } |
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
|
3903 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
|
3904 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3905 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
|
3906 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3907 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
|
3908 objdef = oignore; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3909 } |
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
|
3910 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
|
3911 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3912 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
|
3913 { |
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
|
3914 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
|
3915 case finlist: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3916 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
|
3917 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
|
3918 } |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3919 if (!instruct |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3920 && (typdef == tend |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3921 || typdef == ttypeseen)) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3922 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3923 typdef = tignore; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3924 make_C_tag (FALSE); /* a typedef */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3925 } |
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
|
3926 } |
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
|
3927 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
|
3928 parlev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3929 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3930 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
|
3931 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
|
3932 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
|
3933 if (typdef == ttypeseen) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3934 { |
36361
e9d69d45eae4
When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents:
35775
diff
changeset
|
3935 /* Whenever typdef is set to tinbody (currently only |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3936 here), typdefbracelev should be set to bracelev. */ |
36361
e9d69d45eae4
When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents:
35775
diff
changeset
|
3937 typdef = tinbody; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3938 typdefbracelev = bracelev; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3939 } |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3940 switch (fvdef) |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3941 { |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3942 case flistseen: |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3943 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
|
3944 /* FALLTHRU */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3945 case fignore: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3946 fvdef = fvnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3947 break; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3948 case fvnone: |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3949 switch (objdef) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3950 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3951 case otagseen: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3952 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
|
3953 objdef = oignore; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3954 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3955 case omethodtag: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3956 case omethodparm: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3957 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
|
3958 objdef = oinbody; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3959 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3960 default: |
16540
bf7e776e40f6
* etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
16394
diff
changeset
|
3961 /* Neutralize `extern "C" {' grot. */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3962 if (bracelev == 0 && structdef == snone && nestlev == 0 |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3963 && typdef == tnone) |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3964 bracelev = -1; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3965 } |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
3966 break; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3967 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3968 switch (structdef) |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3969 { |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3970 case skeyseen: /* unnamed struct */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3971 pushclass_above (bracelev, NULL, 0); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3972 structdef = snone; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3973 break; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3974 case stagseen: /* named struct or enum */ |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3975 case scolonseen: /* a class */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3976 pushclass_above (bracelev,token.line+token.offset, token.length); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3977 structdef = snone; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
3978 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
|
3979 break; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
3980 } |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3981 bracelev++; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3982 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3983 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
|
3984 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
|
3985 break; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
3986 if (fvdef == fstartlist) |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3987 { |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3988 fvdef = fvnone; /* avoid tagging `foo' in `foo (*bar()) ()' */ |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3989 token.valid = FALSE; |
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3990 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3991 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
3992 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
|
3993 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
|
3994 break; |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
3995 if (!ignoreindent && 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
|
3996 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3997 if (bracelev != 0) |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
3998 token.valid = FALSE; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
3999 bracelev = 0; /* reset brace level if first column */ |
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
|
4000 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
|
4001 } |
47157
e47f0756e65a
(consider_token, C_entries): Switch to C++ parsing when
Francesco Potortì <pot@gnu.org>
parents:
47103
diff
changeset
|
4002 else |
81933
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4003 { |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4004 if (--bracelev < 0) |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4005 { |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4006 bracelev = 0; |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4007 token.valid = FALSE; /* something gone amiss, token unreliable */ |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4008 } |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4009 if (bracelev == 0 && fvdef == vignore) |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4010 fvdef = fvnone; /* end of function */ |
a5a2ef19d358
* etags.c (C_entries): Reset the fvdef machine when out of function.
Francesco Potortì <pot@gnu.org>
parents:
81231
diff
changeset
|
4011 } |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4012 popclass_above (bracelev); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4013 structdef = snone; |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4014 /* Only if typdef == tinbody is typdefbracelev significant. */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4015 if (typdef == tinbody && bracelev <= typdefbracelev) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4016 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4017 assert (bracelev == typdefbracelev); |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4018 typdef = tend; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4019 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4020 break; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4021 case '=': |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4022 if (definedef != dnone) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4023 break; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4024 switch (fvdef) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4025 { |
26262
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 case foperator: |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4027 case finlist: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4028 case fignore: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4029 case vignore: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4030 break; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4031 case fvnameseen: |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4032 if ((members && bracelev == 1) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4033 || (globals && bracelev == 0 && (!fvextern || declarations))) |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4034 make_C_tag (FALSE); /* a variable */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4035 /* FALLTHRU */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4036 default: |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4037 fvdef = vignore; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4038 } |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4039 break; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4040 case '<': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4041 if (cplpl |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4042 && (structdef == stagseen || fvdef == fvnameseen)) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4043 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4044 templatelev++; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4045 break; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4046 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4047 goto resetfvdef; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4048 case '>': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4049 if (templatelev > 0) |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4050 { |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4051 templatelev--; |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4052 break; |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4053 } |
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4054 goto resetfvdef; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4055 case '+': |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4056 case '-': |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4057 if (objdef == oinbody && bracelev == 0) |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4058 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4059 objdef = omethodsign; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4060 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4061 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4062 /* FALLTHRU */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4063 resetfvdef: |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4064 case '#': case '~': case '&': case '%': case '/': |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
4065 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
|
4066 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
|
4067 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
|
4068 /* 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
|
4069 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
|
4070 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4071 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
|
4072 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
|
4073 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
|
4074 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
|
4075 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
|
4076 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
|
4077 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
|
4078 } |
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
|
4079 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4080 case '\0': |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4081 if (objdef == otagseen) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4082 { |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4083 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
|
4084 objdef = oignore; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4085 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4086 /* 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
|
4087 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
|
4088 CNL_SAVE_DEFINEDEF (); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4089 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
|
4090 CNL (); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4091 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4092 } /* switch (c) */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4093 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
4094 } /* while not eof */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4095 |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4096 free (lbs[0].lb.buffer); |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4097 free (lbs[1].lb.buffer); |
240 | 4098 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4099 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4100 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4101 * 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
|
4102 * 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
|
4103 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4104 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
|
4105 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
|
4106 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4107 { |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4108 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
|
4109 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4110 |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
4111 /* 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
|
4112 static void |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4113 plain_C_entries (inf) |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4114 FILE *inf; |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4115 { |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4116 C_entries (0, inf); |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4117 } |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4118 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4119 /* Always do C++. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4120 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
|
4121 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
|
4122 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4123 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4124 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
|
4125 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4126 |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
4127 /* Always do Java. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4128 static void |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4129 Cjava_entries (inf) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4130 FILE *inf; |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
4131 { |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
4132 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
|
4133 } |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
4134 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4135 /* Always do C*. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4136 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
|
4137 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
|
4138 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4139 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4140 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
|
4141 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4142 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4143 /* Always do Yacc. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4144 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
|
4145 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
|
4146 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4147 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4148 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
|
4149 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4150 |
240 | 4151 |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4152 /* Useful macros. */ |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4153 #define LOOP_ON_INPUT_LINES(file_pointer, line_buffer, char_pointer) \ |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
4154 for (; /* loop initialization */ \ |
26262
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 !feof (file_pointer) /* loop test */ \ |
45918
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
4156 && /* instructions at start of loop */ \ |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
4157 (readline (&line_buffer, file_pointer), \ |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
4158 char_pointer = line_buffer.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
|
4159 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
|
4160 ) |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4161 |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4162 #define LOOKING_AT(cp, kw) /* kw is the keyword, a literal string */ \ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4163 ((assert("" kw), TRUE) /* syntax error if not a literal string */ \ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4164 && strneq ((cp), kw, sizeof(kw)-1) /* cp points at kw */ \ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4165 && notinname ((cp)[sizeof(kw)-1]) /* end of kw */ \ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4166 && ((cp) = skip_spaces((cp)+sizeof(kw)-1))) /* skip spaces */ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4167 |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4168 /* Similar to LOOKING_AT but does not use notinname, does not skip */ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4169 #define LOOKING_AT_NOCASE(cp, kw) /* the keyword is a literal string */ \ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4170 ((assert("" kw), TRUE) /* syntax error if not a literal string */ \ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4171 && strncaseeq ((cp), kw, sizeof(kw)-1) /* cp points at kw */ \ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
4172 && ((cp) += sizeof(kw)-1)) /* skip spaces */ |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4173 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4174 /* |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4175 * 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
|
4176 * 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
|
4177 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4178 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
|
4179 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
|
4180 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
|
4181 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4182 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
|
4183 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4184 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
|
4185 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
|
4186 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4187 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4188 |
240 | 4189 /* Fortran parsing */ |
4190 | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4191 static void F_takeprec __P((void)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4192 static void F_getit __P((FILE *)); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4193 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4194 static void |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4195 F_takeprec () |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4196 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4197 dbp = skip_spaces (dbp); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4198 if (*dbp != '*') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4199 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4200 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
|
4201 dbp = skip_spaces (dbp); |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4202 if (strneq (dbp, "(*)", 3)) |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4203 { |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4204 dbp += 3; |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4205 return; |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4206 } |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
4207 if (!ISDIGIT (*dbp)) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4208 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4209 --dbp; /* force failure */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4210 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4211 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4212 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4213 dbp++; |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
4214 while (ISDIGIT (*dbp)); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4215 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4216 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4217 static void |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4218 F_getit (inf) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4219 FILE *inf; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4220 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4221 register char *cp; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4222 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4223 dbp = skip_spaces (dbp); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4224 if (*dbp == '\0') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4225 { |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
4226 readline (&lb, inf); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4227 dbp = lb.buffer; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4228 if (dbp[5] != '&') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4229 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4230 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
|
4231 dbp = skip_spaces (dbp); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4232 } |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
4233 if (!ISALPHA (*dbp) && *dbp != '_' && *dbp != '$') |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4234 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
|
4235 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
|
4236 continue; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4237 make_tag (dbp, cp-dbp, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4238 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
|
4239 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4240 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4241 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4242 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4243 Fortran_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4244 FILE *inf; |
240 | 4245 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4246 LOOP_ON_INPUT_LINES (inf, lb, dbp) |
240 | 4247 { |
4248 if (*dbp == '%') | |
4249 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
|
4250 dbp = skip_spaces (dbp); |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4251 if (*dbp == '\0') |
240 | 4252 continue; |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4253 switch (lowcase (*dbp)) |
240 | 4254 { |
4255 case 'i': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4256 if (nocase_tail ("integer")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4257 F_takeprec (); |
240 | 4258 break; |
4259 case 'r': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4260 if (nocase_tail ("real")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4261 F_takeprec (); |
240 | 4262 break; |
4263 case 'l': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4264 if (nocase_tail ("logical")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4265 F_takeprec (); |
240 | 4266 break; |
4267 case 'c': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4268 if (nocase_tail ("complex") || nocase_tail ("character")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4269 F_takeprec (); |
240 | 4270 break; |
4271 case 'd': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4272 if (nocase_tail ("double")) |
240 | 4273 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4274 dbp = skip_spaces (dbp); |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4275 if (*dbp == '\0') |
240 | 4276 continue; |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4277 if (nocase_tail ("precision")) |
240 | 4278 break; |
4279 continue; | |
4280 } | |
4281 break; | |
4282 } | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4283 dbp = skip_spaces (dbp); |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4284 if (*dbp == '\0') |
240 | 4285 continue; |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4286 switch (lowcase (*dbp)) |
240 | 4287 { |
4288 case 'f': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4289 if (nocase_tail ("function")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4290 F_getit (inf); |
240 | 4291 continue; |
4292 case 's': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4293 if (nocase_tail ("subroutine")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4294 F_getit (inf); |
240 | 4295 continue; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
4296 case 'e': |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4297 if (nocase_tail ("entry")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4298 F_getit (inf); |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
4299 continue; |
20788
2bf465c6cc6b
(getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents:
20071
diff
changeset
|
4300 case 'b': |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4301 if (nocase_tail ("blockdata") || nocase_tail ("block data")) |
20788
2bf465c6cc6b
(getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents:
20071
diff
changeset
|
4302 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4303 dbp = skip_spaces (dbp); |
20788
2bf465c6cc6b
(getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents:
20071
diff
changeset
|
4304 if (*dbp == '\0') /* assume un-named */ |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4305 make_tag ("blockdata", 9, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4306 lb.buffer, dbp - lb.buffer, lineno, linecharno); |
20788
2bf465c6cc6b
(getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents:
20071
diff
changeset
|
4307 else |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4308 F_getit (inf); /* look for name */ |
20788
2bf465c6cc6b
(getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents:
20071
diff
changeset
|
4309 } |
2bf465c6cc6b
(getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents:
20071
diff
changeset
|
4310 continue; |
240 | 4311 } |
4312 } | |
4313 } | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4314 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4315 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4316 /* |
26262
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 * Ada parsing |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4318 * Original code by |
51267
c21ab9f401a9
Remove Philippe Waroquier's email address, at his request.
Francesco Potortì <pot@gnu.org>
parents:
49360
diff
changeset
|
4319 * Philippe Waroquiers (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
|
4320 */ |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
4321 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4322 static void Ada_getit __P((FILE *, char *)); |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
4323 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4324 /* 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
|
4325 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
|
4326 static void |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4327 Ada_getit (inf, name_qualifier) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4328 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
|
4329 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
|
4330 { |
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 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
|
4332 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
|
4333 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
|
4334 |
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 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
|
4336 { |
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); |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4338 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
|
4339 || (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
|
4340 { |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
4341 readline (&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
|
4342 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
|
4343 } |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4344 switch (lowcase(*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
|
4345 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4346 case 'b': |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4347 if (nocase_tail ("body")) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4348 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4349 /* 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
|
4350 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
|
4351 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
|
4352 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
|
4353 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4354 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
|
4355 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
|
4356 /* Skipping type of task type or protected type ... */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4357 if (nocase_tail ("type")) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4358 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
|
4359 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
|
4360 } |
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 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
|
4362 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4363 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
|
4364 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
|
4365 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
|
4366 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4367 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
|
4368 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4369 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
|
4370 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
|
4371 (*cp != '\0' |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
4372 && (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
|
4373 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
|
4374 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
|
4375 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
|
4376 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
|
4377 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4378 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
|
4379 *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
|
4380 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
|
4381 *cp = c; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4382 make_tag (name, strlen (name), TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4383 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4384 free (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
|
4385 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
|
4386 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
|
4387 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
|
4388 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4389 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4390 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4391 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
|
4392 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
|
4393 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
|
4394 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4395 bool inquote = FALSE; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4396 bool skip_till_semicolumn = 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
|
4397 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4398 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
|
4399 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4400 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
|
4401 { |
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 /* 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
|
4403 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
|
4404 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4405 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
|
4406 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
|
4407 { |
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 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
|
4409 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
|
4410 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
|
4411 } |
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 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
|
4413 { |
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 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
|
4415 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
|
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 } |
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 |
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 /* 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
|
4420 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
|
4421 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
|
4422 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4423 /* 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
|
4424 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
|
4425 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
|
4426 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4427 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
|
4428 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
|
4429 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
|
4430 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
|
4431 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4432 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4433 if (skip_till_semicolumn) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4434 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4435 if (*dbp == ';') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4436 skip_till_semicolumn = FALSE; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4437 dbp++; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4438 continue; /* advance char */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4439 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
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 /* 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
|
4442 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
|
4443 { |
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 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
|
4445 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
|
4446 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4447 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4448 /* We are at the beginning of a token. */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4449 switch (lowcase(*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
|
4450 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4451 case 'f': |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4452 if (!packages_only && nocase_tail ("function")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4453 Ada_getit (inf, "/f"); |
26262
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 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
|
4455 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
|
4456 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
|
4457 case 'p': |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4458 if (!packages_only && nocase_tail ("procedure")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4459 Ada_getit (inf, "/p"); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4460 else if (nocase_tail ("package")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4461 Ada_getit (inf, "/s"); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4462 else if (nocase_tail ("protected")) /* protected type */ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4463 Ada_getit (inf, "/t"); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4464 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
|
4465 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
|
4466 continue; /* advance char */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4467 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4468 case 'u': |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4469 if (typedefs && !packages_only && nocase_tail ("use")) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4470 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4471 /* when tagging types, avoid tagging use type Pack.Typename; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4472 for this, we will skip everything till a ; */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4473 skip_till_semicolumn = TRUE; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4474 continue; /* advance char */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4475 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4476 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4477 case 't': |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4478 if (!packages_only && nocase_tail ("task")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4479 Ada_getit (inf, "/k"); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4480 else if (typedefs && !packages_only && nocase_tail ("type")) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4481 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4482 Ada_getit (inf, "/t"); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4483 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
|
4484 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
|
4485 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4486 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
|
4487 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
|
4488 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
|
4489 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4490 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4491 /* 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
|
4492 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
|
4493 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
|
4494 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4495 } /* 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
|
4496 } /* 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
|
4497 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4498 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4499 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4500 /* |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4501 * Unix and microcontroller assembly tag handling |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4502 * Labels: /^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]/ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4503 * Idea by Bob Weiner, Motorola Inc. (1994) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4504 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4505 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4506 Asm_labels (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4507 FILE *inf; |
240 | 4508 { |
4509 register char *cp; | |
4510 | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4511 LOOP_ON_INPUT_LINES (inf, lb, cp) |
240 | 4512 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4513 /* 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
|
4514 following identifier. */ |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
4515 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
|
4516 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4517 /* Read past label. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4518 cp++; |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
4519 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
|
4520 cp++; |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
4521 if (*cp == ':' || iswhite (*cp)) |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4522 /* Found end of label, so copy it and add it to the table. */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4523 make_tag (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
|
4524 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
|
4525 } |
240 | 4526 } |
4527 } | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4528 |
240 | 4529 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4530 /* |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4531 * Perl support |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4532 * Perl sub names: /^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
|
4533 * Perl variable names: /^(my|local).../ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4534 * Original code by Bart Robinson <lomew@cs.utah.edu> (1995) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4535 * Additions by Michael Ernst <mernst@alum.mit.edu> (1997) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4536 * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001) |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4537 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4538 static void |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4539 Perl_functions (inf) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4540 FILE *inf; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4541 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4542 char *package = savestr ("main"); /* current package name */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4543 register char *cp; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4544 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4545 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
|
4546 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4547 skip_spaces(cp); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4548 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4549 if (LOOKING_AT (cp, "package")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4550 { |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4551 free (package); |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4552 get_tag (cp, &package); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4553 } |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4554 else if (LOOKING_AT (cp, "sub")) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4555 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4556 char *pos; |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4557 char *sp = cp; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4558 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4559 while (!notinname (*cp)) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4560 cp++; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4561 if (cp == sp) |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4562 continue; /* nothing found */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4563 if ((pos = etags_strchr (sp, ':')) != NULL |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4564 && pos < cp && pos[1] == ':') |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4565 /* The name is already qualified. */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4566 make_tag (sp, cp - sp, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4567 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4568 else |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4569 /* Qualify it. */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4570 { |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4571 char savechar, *name; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4572 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4573 savechar = *cp; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4574 *cp = '\0'; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4575 name = concat (package, "::", sp); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4576 *cp = savechar; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4577 make_tag (name, strlen(name), TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4578 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4579 free (name); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4580 } |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4581 } |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4582 else if (globals) /* only if we are tagging global vars */ |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4583 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4584 /* Skip a qualifier, if any. */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4585 bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local"); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4586 /* After "my" or "local", but before any following paren or space. */ |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4587 char *varstart = cp; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4588 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4589 if (qual /* should this be removed? If yes, how? */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4590 && (*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
|
4591 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4592 varstart += 1; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4593 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
|
4594 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4595 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
|
4596 } |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4597 else if (qual) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4598 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4599 /* 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
|
4600 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
|
4601 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
|
4602 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
|
4603 } |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4604 else |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4605 continue; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4606 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4607 make_tag (varstart, cp - varstart, FALSE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4608 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4609 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4610 } |
70342
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
4611 free (package); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4612 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4613 |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4614 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4615 /* |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4616 * Python support |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4617 * Look for /^[\t]*def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4618 * Idea by Eric S. Raymond <esr@thyrsus.com> (1997) |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4619 * More ideas by seb bacon <seb@jamkit.com> (2002) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4620 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4621 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
|
4622 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
|
4623 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
|
4624 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4625 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
|
4626 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4627 LOOP_ON_INPUT_LINES (inf, lb, cp) |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4628 { |
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4629 cp = skip_spaces (cp); |
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4630 if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class")) |
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4631 { |
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4632 char *name = cp; |
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4633 while (!notinname (*cp) && *cp != ':') |
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4634 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4635 make_tag (name, cp - name, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4636 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4637 } |
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4638 } |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4639 } |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4640 |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4641 |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4642 /* |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4643 * PHP support |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4644 * Look for: |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4645 * - /^[ \t]*function[ \t\n]+[^ \t\n(]+/ |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4646 * - /^[ \t]*class[ \t\n]+[^ \t\n]+/ |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4647 * - /^[ \t]*define\(\"[^\"]+/ |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4648 * Only with --members: |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4649 * - /^[ \t]*var[ \t\n]+\$[^ \t\n=;]/ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4650 * Idea by Diez B. Roggisch (2001) |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4651 */ |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4652 static void |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4653 PHP_functions (inf) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4654 FILE *inf; |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4655 { |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4656 register char *cp, *name; |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4657 bool search_identifier = FALSE; |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4658 |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4659 LOOP_ON_INPUT_LINES (inf, lb, 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
|
4660 { |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4661 cp = skip_spaces (cp); |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4662 name = cp; |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4663 if (search_identifier |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4664 && *cp != '\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
|
4665 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4666 while (!notinname (*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
|
4667 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4668 make_tag (name, cp - name, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4669 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4670 search_identifier = 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
|
4671 } |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4672 else if (LOOKING_AT (cp, "function")) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4673 { |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4674 if(*cp == '&') |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4675 cp = skip_spaces (cp+1); |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4676 if(*cp != '\0') |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4677 { |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4678 name = cp; |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4679 while (!notinname (*cp)) |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4680 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4681 make_tag (name, cp - name, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4682 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4683 } |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4684 else |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4685 search_identifier = TRUE; |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4686 } |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4687 else if (LOOKING_AT (cp, "class")) |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4688 { |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4689 if (*cp != '\0') |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4690 { |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4691 name = cp; |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4692 while (*cp != '\0' && !iswhite (*cp)) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4693 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4694 make_tag (name, cp - name, FALSE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4695 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4696 } |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4697 else |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4698 search_identifier = TRUE; |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4699 } |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4700 else if (strneq (cp, "define", 6) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4701 && (cp = skip_spaces (cp+6)) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4702 && *cp++ == '(' |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4703 && (*cp == '"' || *cp == '\'')) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4704 { |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4705 char quote = *cp++; |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4706 name = cp; |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4707 while (*cp != quote && *cp != '\0') |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4708 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4709 make_tag (name, cp - name, FALSE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4710 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4711 } |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4712 else if (members |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4713 && LOOKING_AT (cp, "var") |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4714 && *cp == '$') |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4715 { |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
4716 name = cp; |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4717 while (!notinname(*cp)) |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
4718 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4719 make_tag (name, cp - name, FALSE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4720 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4721 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4722 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4723 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4724 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
4725 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4726 /* |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4727 * Cobol tag functions |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4728 * 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
|
4729 * i.e. anything that starts in column 8 is one word and ends in a full stop. |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4730 * Idea by Corny de Souza (1993) |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4731 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4732 static void |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4733 Cobol_paragraphs (inf) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4734 FILE *inf; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4735 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4736 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
|
4737 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4738 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
|
4739 { |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4740 if (lb.len < 9) |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4741 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
|
4742 bp += 8; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4743 |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4744 /* 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
|
4745 if (bp[-1] != ' ' || !ISALNUM (bp[0])) |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4746 continue; |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4747 |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
4748 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
|
4749 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
|
4750 if (*ep++ == '.') |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4751 make_tag (bp, ep - bp, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4752 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
|
4753 } |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4754 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4755 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
4756 |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4757 /* |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4758 * Makefile support |
45918
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
4759 * Ideas by Assar Westerlund <assar@sics.se> (2001) |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4760 */ |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4761 static void |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4762 Makefile_targets (inf) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4763 FILE *inf; |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4764 { |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4765 register char *bp; |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4766 |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4767 LOOP_ON_INPUT_LINES (inf, lb, bp) |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4768 { |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4769 if (*bp == '\t' || *bp == '#') |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4770 continue; |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4771 while (*bp != '\0' && *bp != '=' && *bp != ':') |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4772 bp++; |
45918
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
4773 if (*bp == ':' || (globals && *bp == '=')) |
74951
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4774 { |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4775 /* We should detect if there is more than one tag, but we do not. |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4776 We just skip initial and final spaces. */ |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4777 char * namestart = skip_spaces (lb.buffer); |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4778 while (--bp > namestart) |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4779 if (!notinname (*bp)) |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4780 break; |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4781 make_tag (namestart, bp - namestart + 1, TRUE, |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4782 lb.buffer, bp - lb.buffer + 2, lineno, linecharno); |
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
4783 } |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4784 } |
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4785 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4786 |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
4787 |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4788 /* |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4789 * Pascal parsing |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4790 * Original code by Mosur K. Mohan (1989) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4791 * |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4792 * 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
|
4793 * 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
|
4794 * "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
|
4795 * the tag is skipped. |
240 | 4796 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4797 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4798 Pascal_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4799 FILE *inf; |
240 | 4800 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4801 linebuffer tline; /* mostly copied from C_entries */ |
240 | 4802 long save_lcno; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4803 int save_lineno, namelen, taglen; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4804 char c, *name; |
240 | 4805 |
78472 | 4806 bool /* each of these flags is TRUE if: */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4807 incomment, /* point is inside a comment */ |
240 | 4808 inquote, /* point is inside '..' string */ |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4809 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
|
4810 keyword, so next item = potential tag */ |
240 | 4811 found_tag, /* point is after a potential tag */ |
4812 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
|
4813 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
|
4814 next token will determine whether this |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4815 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
|
4816 whether it is a real tag */ |
240 | 4817 |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4818 save_lcno = save_lineno = namelen = taglen = 0; /* keep compiler quiet */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4819 name = NULL; /* keep compiler quiet */ |
240 | 4820 dbp = lb.buffer; |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4821 *dbp = '\0'; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4822 linebuffer_init (&tline); |
240 | 4823 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4824 incomment = inquote = FALSE; |
240 | 4825 found_tag = FALSE; /* have a proc name; check if extern */ |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4826 get_tagname = FALSE; /* found "procedure" keyword */ |
240 | 4827 inparms = FALSE; /* found '(' after "proc" */ |
4828 verify_tag = FALSE; /* check if "extern" is ahead */ | |
4829 | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4830 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4831 while (!feof (inf)) /* long main loop to get next char */ |
240 | 4832 { |
4833 c = *dbp++; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4834 if (c == '\0') /* if end of line */ |
240 | 4835 { |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
4836 readline (&lb, inf); |
15243
c024dca549c5
* etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents:
14982
diff
changeset
|
4837 dbp = lb.buffer; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4838 if (*dbp == '\0') |
240 | 4839 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
|
4840 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
|
4841 || get_tagname)) |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4842 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
|
4843 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
|
4844 the procedure or function */ |
240 | 4845 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4846 if (incomment) |
240 | 4847 { |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4848 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
|
4849 incomment = FALSE; |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4850 else if (c == '*' && *dbp == ')') /* within (* *) comments */ |
240 | 4851 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4852 dbp++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4853 incomment = FALSE; |
240 | 4854 } |
4855 continue; | |
4856 } | |
4857 else if (inquote) | |
4858 { | |
4859 if (c == '\'') | |
4860 inquote = FALSE; | |
4861 continue; | |
4862 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4863 else |
240 | 4864 switch (c) |
4865 { | |
4866 case '\'': | |
4867 inquote = TRUE; /* found first quote */ | |
4868 continue; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4869 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
|
4870 incomment = TRUE; |
240 | 4871 continue; |
4872 case '(': | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4873 if (*dbp == '*') /* found open (* comment */ |
240 | 4874 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4875 incomment = TRUE; |
240 | 4876 dbp++; |
4877 } | |
4878 else if (found_tag) /* found '(' after tag, i.e., parm-list */ | |
4879 inparms = TRUE; | |
4880 continue; | |
4881 case ')': /* end of parms list */ | |
4882 if (inparms) | |
4883 inparms = FALSE; | |
4884 continue; | |
4885 case ';': | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4886 if (found_tag && !inparms) /* end of proc or fn stmt */ |
240 | 4887 { |
4888 verify_tag = TRUE; | |
4889 break; | |
4890 } | |
4891 continue; | |
4892 } | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4893 if (found_tag && verify_tag && (*dbp != ' ')) |
240 | 4894 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4895 /* 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
|
4896 if (*dbp == '\0') |
240 | 4897 continue; |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4898 if (lowcase (*dbp == 'e')) |
240 | 4899 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4900 if (nocase_tail ("extern")) /* superfluous, really! */ |
240 | 4901 { |
4902 found_tag = FALSE; | |
4903 verify_tag = FALSE; | |
4904 } | |
4905 } | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4906 else if (lowcase (*dbp) == 'f') |
240 | 4907 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
4908 if (nocase_tail ("forward")) /* check for forward reference */ |
240 | 4909 { |
4910 found_tag = FALSE; | |
4911 verify_tag = FALSE; | |
4912 } | |
4913 } | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4914 if (found_tag && verify_tag) /* not external proc, so make tag */ |
240 | 4915 { |
4916 found_tag = FALSE; | |
4917 verify_tag = FALSE; | |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4918 make_tag (name, namelen, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4919 tline.buffer, taglen, save_lineno, save_lcno); |
240 | 4920 continue; |
4921 } | |
4922 } | |
4923 if (get_tagname) /* grab name of proc or fn */ | |
4924 { | |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4925 char *cp; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4926 |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4927 if (*dbp == '\0') |
240 | 4928 continue; |
4929 | |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4930 /* Find block name. */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4931 for (cp = dbp + 1; *cp != '\0' && !endtoken (*cp); cp++) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4932 continue; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4933 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4934 /* 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
|
4935 linebuffer_setlen (&tline, lb.len); |
240 | 4936 strcpy (tline.buffer, lb.buffer); |
4937 save_lineno = lineno; | |
4938 save_lcno = linecharno; | |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4939 name = tline.buffer + (dbp - lb.buffer); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4940 namelen = cp - dbp; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4941 taglen = cp - lb.buffer + 1; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4942 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4943 dbp = cp; /* set dbp to e-o-token */ |
240 | 4944 get_tagname = FALSE; |
4945 found_tag = TRUE; | |
4946 continue; | |
4947 | |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4948 /* And proceed to check for "extern". */ |
240 | 4949 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4950 else if (!incomment && !inquote && !found_tag) |
240 | 4951 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4952 /* Check for proc/fn keywords. */ |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
4953 switch (lowcase (c)) |
240 | 4954 { |
4955 case 'p': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4956 if (nocase_tail ("rocedure")) /* c = 'p', dbp has advanced */ |
240 | 4957 get_tagname = TRUE; |
4958 continue; | |
4959 case 'f': | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4960 if (nocase_tail ("unction")) |
240 | 4961 get_tagname = TRUE; |
4962 continue; | |
4963 } | |
4964 } | |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4965 } /* while not eof */ |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
4966 |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4967 free (tline.buffer); |
240 | 4968 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4969 |
240 | 4970 |
4971 /* | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
4972 * Lisp tag functions |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4973 * look for (def or (DEF, quote or QUOTE |
240 | 4974 */ |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
4975 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4976 static void L_getit __P((void)); |
240 | 4977 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4978 static void |
240 | 4979 L_getit () |
4980 { | |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
4981 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
|
4982 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
|
4983 else if (*dbp == '(') |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
4984 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4985 dbp++; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4986 /* Try to skip "(quote " */ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4987 if (!LOOKING_AT (dbp, "quote") && !LOOKING_AT (dbp, "QUOTE")) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4988 /* Ok, then skip "(" before name in (defstruct (foo)) */ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
4989 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
|
4990 } |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
4991 get_tag (dbp, NULL); |
240 | 4992 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4993 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
4994 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4995 Lisp_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4996 FILE *inf; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
4997 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
4998 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
|
4999 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5000 if (dbp[0] != '(') |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5001 continue; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5002 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5003 if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3)) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5004 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5005 dbp = skip_non_spaces (dbp); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5006 dbp = skip_spaces (dbp); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5007 L_getit (); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5008 } |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5009 else |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5010 { |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5011 /* Check for (foo::defmumble name-defined ... */ |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5012 do |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5013 dbp++; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5014 while (!notinname (*dbp) && *dbp != ':'); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5015 if (*dbp == ':') |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5016 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5017 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5018 dbp++; |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5019 while (*dbp == ':'); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5020 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5021 if (strneq (dbp, "def", 3) || strneq (dbp, "DEF", 3)) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5022 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5023 dbp = skip_non_spaces (dbp); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5024 dbp = skip_spaces (dbp); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5025 L_getit (); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5026 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5027 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5028 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5029 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5030 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5031 |
240 | 5032 |
5033 /* | |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5034 * Lua script language parsing |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5035 * Original code by David A. Capello <dacap@users.sourceforge.net> (2004) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5036 * |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5037 * "function" and "local function" are tags if they start at column 1. |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5038 */ |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5039 static void |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5040 Lua_functions (inf) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5041 FILE *inf; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5042 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5043 register char *bp; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5044 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5045 LOOP_ON_INPUT_LINES (inf, lb, bp) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5046 { |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5047 if (bp[0] != 'f' && bp[0] != 'l') |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5048 continue; |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5049 |
74298
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
5050 (void)LOOKING_AT (bp, "local"); /* skip possible "local" */ |
57084
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5051 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5052 if (LOOKING_AT (bp, "function")) |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5053 get_tag (bp, NULL); |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5054 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5055 } |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5056 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5057 |
cdba91059d7d
[EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
Francesco Potortì <pot@gnu.org>
parents:
57013
diff
changeset
|
5058 /* |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5059 * Postscript tags |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5060 * 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
|
5061 * Also look at "defineps" for PSWrap |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5062 * Ideas by: |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5063 * Richard Mlynarik <mly@adoc.xerox.com> (1997) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5064 * 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
|
5065 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5066 static void |
49125
7ce72b4a2d94
changes for language-sepcific help by Philippe
Francesco Potortì <pot@gnu.org>
parents:
47218
diff
changeset
|
5067 PS_functions (inf) |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5068 FILE *inf; |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5069 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5070 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
|
5071 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5072 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
|
5073 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5074 if (bp[0] == '/') |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5075 { |
26262
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 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
|
5077 *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
|
5078 ep++) |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5079 continue; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5080 make_tag (bp, ep - bp, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5081 lb.buffer, ep - lb.buffer + 1, lineno, linecharno); |
26262
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 } |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5083 else if (LOOKING_AT (bp, "defineps")) |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5084 get_tag (bp, NULL); |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5085 } |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5086 } |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5087 |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5088 |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5089 /* |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5090 * Forth tags |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5091 * Ignore anything after \ followed by space or in ( ) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5092 * Look for words defined by : |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5093 * Look for constant, code, create, defer, value, and variable |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5094 * OBP extensions: Look for buffer:, field, |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5095 * Ideas by Eduardo Horvath <eeh@netbsd.org> (2004) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5096 */ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5097 static void |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5098 Forth_words (inf) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5099 FILE *inf; |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5100 { |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5101 register char *bp; |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5102 |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5103 LOOP_ON_INPUT_LINES (inf, lb, bp) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5104 while ((bp = skip_spaces (bp))[0] != '\0') |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5105 if (bp[0] == '\\' && iswhite(bp[1])) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5106 break; /* read next line */ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5107 else if (bp[0] == '(' && iswhite(bp[1])) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5108 do /* skip to ) or eol */ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5109 bp++; |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5110 while (*bp != ')' && *bp != '\0'); |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5111 else if ((bp[0] == ':' && iswhite(bp[1]) && bp++) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5112 || LOOKING_AT_NOCASE (bp, "constant") |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5113 || LOOKING_AT_NOCASE (bp, "code") |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5114 || LOOKING_AT_NOCASE (bp, "create") |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5115 || LOOKING_AT_NOCASE (bp, "defer") |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5116 || LOOKING_AT_NOCASE (bp, "value") |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5117 || LOOKING_AT_NOCASE (bp, "variable") |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5118 || LOOKING_AT_NOCASE (bp, "buffer:") |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5119 || LOOKING_AT_NOCASE (bp, "field")) |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5120 get_tag (skip_spaces (bp), NULL); /* Yay! A definition! */ |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5121 else |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5122 bp = skip_non_spaces (bp); |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5123 } |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5124 |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5125 |
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5126 /* |
240 | 5127 * Scheme tag functions |
5128 * look for (def... xyzzy | |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5129 * (def... (xyzzy |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5130 * (def ... ((...(xyzzy .... |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5131 * (set! xyzzy |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5132 * Original code by Ken Haase (1985?) |
240 | 5133 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5134 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5135 Scheme_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5136 FILE *inf; |
240 | 5137 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5138 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
|
5139 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5140 LOOP_ON_INPUT_LINES (inf, lb, bp) |
240 | 5141 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5142 if (strneq (bp, "(def", 4) || strneq (bp, "(DEF", 4)) |
240 | 5143 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5144 bp = skip_non_spaces (bp+4); |
240 | 5145 /* Skip over open parens and white space */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5146 while (notinname (*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
|
5147 bp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5148 get_tag (bp, NULL); |
240 | 5149 } |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5150 if (LOOKING_AT (bp, "(SET!") || LOOKING_AT (bp, "(set!")) |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5151 get_tag (bp, NULL); |
240 | 5152 } |
5153 } | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5154 |
240 | 5155 |
5156 /* Find tags in TeX and LaTeX input files. */ | |
5157 | |
5158 /* TEX_toktab is a table of TeX control sequences that define tags. | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5159 * Each entry records one such control sequence. |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5160 * |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5161 * Original code from who knows whom. |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5162 * Ideas by: |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5163 * Stefan Monnier (2002) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5164 */ |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5165 |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5166 static linebuffer *TEX_toktab = NULL; /* Table with tag tokens */ |
240 | 5167 |
5168 /* Default set of control sequences to put into TEX_toktab. | |
5169 The value of environment var TEXTAGS is prepended to this. */ | |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
5170 static char *TEX_defenv = "\ |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
5171 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5172 :part:appendix:entry:index:def\ |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5173 :newcommand:renewcommand:newenvironment:renewenvironment"; |
240 | 5174 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5175 static void TEX_mode __P((FILE *)); |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5176 static void TEX_decode_env __P((char *, char *)); |
240 | 5177 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
5178 static char TEX_esc = '\\'; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
5179 static char TEX_opgrp = '{'; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
5180 static char TEX_clgrp = '}'; |
240 | 5181 |
5182 /* | |
5183 * TeX/LaTeX scanning loop. | |
5184 */ | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5185 static void |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
5186 TeX_commands (inf) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5187 FILE *inf; |
240 | 5188 { |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5189 char *cp; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5190 linebuffer *key; |
240 | 5191 |
5192 /* 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
|
5193 TEX_mode (inf); |
240 | 5194 |
5195 /* Initialize token table once from environment. */ | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5196 if (TEX_toktab == NULL) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5197 TEX_decode_env ("TEXTAGS", TEX_defenv); |
240 | 5198 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5199 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
|
5200 { |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5201 /* Look at each TEX keyword in line. */ |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5202 for (;;) |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
5203 { |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5204 /* Look for a TEX escape. */ |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5205 while (*cp++ != TEX_esc) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5206 if (cp[-1] == '\0' || cp[-1] == '%') |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5207 goto tex_next_line; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5208 |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5209 for (key = TEX_toktab; key->buffer != NULL; key++) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5210 if (strneq (cp, key->buffer, key->len)) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5211 { |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5212 register char *p; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5213 int namelen, linelen; |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5214 bool opgrp = FALSE; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5215 |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5216 cp = skip_spaces (cp + key->len); |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5217 if (*cp == TEX_opgrp) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5218 { |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5219 opgrp = TRUE; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5220 cp++; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5221 } |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5222 for (p = cp; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5223 (!iswhite (*p) && *p != '#' && |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5224 *p != TEX_opgrp && *p != TEX_clgrp); |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5225 p++) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5226 continue; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5227 namelen = p - cp; |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5228 linelen = lb.len; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5229 if (!opgrp || *p == TEX_clgrp) |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5230 { |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5231 while (*p != '\0' && *p != TEX_opgrp && *p != TEX_clgrp) |
74298
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
5232 p++; |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5233 linelen = p - lb.buffer + 1; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5234 } |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5235 make_tag (cp, namelen, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5236 lb.buffer, linelen, lineno, linecharno); |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5237 goto tex_next_line; /* We only tag a line once */ |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5238 } |
240 | 5239 } |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5240 tex_next_line: |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5241 ; |
240 | 5242 } |
5243 } | |
5244 | |
5245 #define TEX_LESC '\\' | |
5246 #define TEX_SESC '!' | |
5247 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
5248 /* 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
|
5249 chars accordingly. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5250 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5251 TEX_mode (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5252 FILE *inf; |
240 | 5253 { |
5254 int c; | |
5255 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5256 while ((c = getc (inf)) != EOF) |
240 | 5257 { |
5258 /* Skip to next line if we hit the TeX comment char. */ | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5259 if (c == '%') |
72314
b0755f0706c2
* etags.c (TEX_mode): Check getc retruns EOF.
Jan Djärv <jan.h.d@swipnet.se>
parents:
72192
diff
changeset
|
5260 while (c != '\n' && c != EOF) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5261 c = getc (inf); |
240 | 5262 else if (c == TEX_LESC || c == TEX_SESC ) |
5263 break; | |
5264 } | |
5265 | |
5266 if (c == TEX_LESC) | |
5267 { | |
5268 TEX_esc = TEX_LESC; | |
5269 TEX_opgrp = '{'; | |
5270 TEX_clgrp = '}'; | |
5271 } | |
5272 else | |
5273 { | |
5274 TEX_esc = TEX_SESC; | |
5275 TEX_opgrp = '<'; | |
5276 TEX_clgrp = '>'; | |
5277 } | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5278 /* 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
|
5279 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
|
5280 rewind (inf); |
240 | 5281 } |
5282 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
5283 /* 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
|
5284 Build token table. */ |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5285 static void |
240 | 5286 TEX_decode_env (evarname, defenv) |
5287 char *evarname; | |
5288 char *defenv; | |
5289 { | |
5290 register char *env, *p; | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5291 int i, len; |
240 | 5292 |
5293 /* Append default string to environment. */ | |
5294 env = getenv (evarname); | |
5295 if (!env) | |
5296 env = defenv; | |
5297 else | |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5298 { |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5299 char *oldenv = env; |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5300 env = concat (oldenv, defenv, ""); |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5301 } |
240 | 5302 |
5303 /* Allocate a token table */ | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5304 for (len = 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
|
5305 if ((p = etags_strchr (p, ':')) && *++p != '\0') |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5306 len++; |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5307 TEX_toktab = xnew (len, linebuffer); |
240 | 5308 |
5309 /* Unpack environment string into token table. Be careful about */ | |
5310 /* zero-length strings (leading ':', "::" and trailing ':') */ | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5311 for (i = 0; *env != '\0';) |
240 | 5312 { |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
5313 p = etags_strchr (env, ':'); |
240 | 5314 if (!p) /* End of environment string. */ |
5315 p = env + strlen (env); | |
5316 if (p - env > 0) | |
5317 { /* Only non-zero strings. */ | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5318 TEX_toktab[i].buffer = savenstr (env, p - env); |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5319 TEX_toktab[i].len = p - env; |
240 | 5320 i++; |
5321 } | |
5322 if (*p) | |
5323 env = p + 1; | |
5324 else | |
5325 { | |
45654
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5326 TEX_toktab[i].buffer = NULL; /* Mark end of table. */ |
816b7344d062
(TeX_commands): Skip comments.
Francesco Potortì <pot@gnu.org>
parents:
45643
diff
changeset
|
5327 TEX_toktab[i].len = 0; |
240 | 5328 break; |
5329 } | |
5330 } | |
5331 } | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5332 |
240 | 5333 |
28663
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5334 /* Texinfo support. Dave Love, Mar. 2000. */ |
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5335 static void |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
5336 Texinfo_nodes (inf) |
28663
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5337 FILE * inf; |
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5338 { |
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5339 char *cp, *start; |
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5340 LOOP_ON_INPUT_LINES (inf, lb, cp) |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5341 if (LOOKING_AT (cp, "@node")) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5342 { |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5343 start = cp; |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5344 while (*cp != '\0' && *cp != ',') |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5345 cp++; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5346 make_tag (start, cp - start, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5347 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5348 } |
28663
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5349 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5350 |
28663
75826102199c
(Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents:
27948
diff
changeset
|
5351 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5352 /* |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5353 * HTML support. |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5354 * Contents of <title>, <h1>, <h2>, <h3> are tags. |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5355 * Contents of <a name=xxx> are tags with name xxx. |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5356 * |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5357 * Francesco Potort́, 2002. |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5358 */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5359 static void |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5360 HTML_labels (inf) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5361 FILE * inf; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5362 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5363 bool getnext = FALSE; /* next text outside of HTML tags is a tag */ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5364 bool skiptag = FALSE; /* skip to the end of the current HTML tag */ |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5365 bool intag = FALSE; /* inside an html tag, looking for ID= */ |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5366 bool inanchor = FALSE; /* when INTAG, is an anchor, look for NAME= */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5367 char *end; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5368 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5369 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5370 linebuffer_setlen (&token_name, 0); /* no name in buffer */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5371 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5372 LOOP_ON_INPUT_LINES (inf, lb, dbp) |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5373 for (;;) /* loop on the same line */ |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5374 { |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5375 if (skiptag) /* skip HTML tag */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5376 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5377 while (*dbp != '\0' && *dbp != '>') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5378 dbp++; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5379 if (*dbp == '>') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5380 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5381 dbp += 1; |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5382 skiptag = FALSE; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5383 continue; /* look on the same line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5384 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5385 break; /* go to next line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5386 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5387 |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5388 else if (intag) /* look for "name=" or "id=" */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5389 { |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5390 while (*dbp != '\0' && *dbp != '>' |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5391 && lowcase (*dbp) != 'n' && lowcase (*dbp) != 'i') |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5392 dbp++; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5393 if (*dbp == '\0') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5394 break; /* go to next line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5395 if (*dbp == '>') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5396 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5397 dbp += 1; |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5398 intag = FALSE; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5399 continue; /* look on the same line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5400 } |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5401 if ((inanchor && LOOKING_AT_NOCASE (dbp, "name=")) |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5402 || LOOKING_AT_NOCASE (dbp, "id=")) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5403 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5404 bool quoted = (dbp[0] == '"'); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5405 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5406 if (quoted) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5407 for (end = ++dbp; *end != '\0' && *end != '"'; end++) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5408 continue; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5409 else |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5410 for (end = dbp; *end != '\0' && intoken (*end); end++) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5411 continue; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5412 linebuffer_setlen (&token_name, end - dbp); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5413 strncpy (token_name.buffer, dbp, end - dbp); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5414 token_name.buffer[end - dbp] = '\0'; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5415 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5416 dbp = end; |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5417 intag = FALSE; /* we found what we looked for */ |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5418 skiptag = TRUE; /* skip to the end of the tag */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5419 getnext = TRUE; /* then grab the text */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5420 continue; /* look on the same line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5421 } |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5422 dbp += 1; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5423 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5424 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5425 else if (getnext) /* grab next tokens and tag them */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5426 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5427 dbp = skip_spaces (dbp); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5428 if (*dbp == '\0') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5429 break; /* go to next line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5430 if (*dbp == '<') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5431 { |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5432 intag = TRUE; |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5433 inanchor = (lowcase (dbp[1]) == 'a' && !intoken (dbp[2])); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5434 continue; /* look on the same line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5435 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5436 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5437 for (end = dbp + 1; *end != '\0' && *end != '<'; end++) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5438 continue; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5439 make_tag (token_name.buffer, token_name.len, TRUE, |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5440 dbp, end - dbp, lineno, linecharno); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5441 linebuffer_setlen (&token_name, 0); /* no name in buffer */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5442 getnext = FALSE; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5443 break; /* go to next line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5444 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5445 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5446 else /* look for an interesting HTML tag */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5447 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5448 while (*dbp != '\0' && *dbp != '<') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5449 dbp++; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5450 if (*dbp == '\0') |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5451 break; /* go to next line */ |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5452 intag = TRUE; |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5453 if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2])) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5454 { |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5455 inanchor = TRUE; |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5456 continue; /* look on the same line */ |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5457 } |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5458 else if (LOOKING_AT_NOCASE (dbp, "<title>") |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5459 || LOOKING_AT_NOCASE (dbp, "<h1>") |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5460 || LOOKING_AT_NOCASE (dbp, "<h2>") |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5461 || LOOKING_AT_NOCASE (dbp, "<h3>")) |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5462 { |
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5463 intag = FALSE; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5464 getnext = TRUE; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5465 continue; /* look on the same line */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5466 } |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5467 dbp += 1; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5468 } |
47103
4098bad57f21
(C_entries): Corrected a problem with const C++ funcs.
Francesco Potortì <pot@gnu.org>
parents:
47081
diff
changeset
|
5469 } |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5470 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5471 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5472 |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5473 /* |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5474 * Prolog support |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5475 * |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5476 * Assumes that the predicate or rule starts at column 0. |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5477 * Only the first clause of a predicate or rule is added. |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5478 * Original code by Sunichirou Sugou (1989) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5479 * Rewritten by Anders Lindgren (1996) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5480 */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5481 static int prolog_pr __P((char *, char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5482 static void prolog_skip_comment __P((linebuffer *, FILE *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5483 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
|
5484 |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5485 static void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5486 Prolog_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5487 FILE *inf; |
240 | 5488 { |
26262
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 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
|
5490 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5491 int allocated; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5492 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5493 allocated = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5494 len = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5495 last = NULL; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5496 |
26262
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 LOOP_ON_INPUT_LINES (inf, lb, cp) |
240 | 5498 { |
26262
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 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
|
5500 continue; |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
5501 else if (iswhite (cp[0])) /* Not a predicate */ |
240 | 5502 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
|
5503 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
|
5504 prolog_skip_comment (&lb, inf); |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5505 else if ((len = prolog_pr (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
|
5506 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5507 /* Predicate or rule. Store the function name so that we |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5508 only 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
|
5509 if (last == NULL) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5510 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
|
5511 else if (len + 1 > allocated) |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5512 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
|
5513 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
|
5514 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
|
5515 last[len] = '\0'; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5516 } |
240 | 5517 } |
70342
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5518 if (last != NULL) |
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5519 free (last); |
240 | 5520 } |
5521 | |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5522 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5523 static void |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5524 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
|
5525 linebuffer *plb; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
5526 FILE *inf; |
240 | 5527 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5528 char *cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5529 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5530 do |
240 | 5531 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5532 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
|
5533 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
|
5534 return; |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5535 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
|
5536 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5537 while (!feof(inf)); |
240 | 5538 } |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5539 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5540 /* |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5541 * A predicate or rule definition is added if it matches: |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5542 * <beginning of line><Prolog Atom><whitespace>( |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5543 * or <beginning of line><Prolog Atom><whitespace>:- |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5544 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5545 * 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
|
5546 * 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
|
5547 * |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5548 * Return the size of the name of the predicate or rule, or 0 if no |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5549 * header was found. |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5550 */ |
27658
5980f19581dc
(pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents:
27595
diff
changeset
|
5551 static int |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5552 prolog_pr (s, last) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5553 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5554 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
|
5555 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5556 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5557 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5558 |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5559 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
|
5560 if (pos < 1) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5561 return 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5562 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5563 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
|
5564 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
|
5565 |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5566 if ((s[pos] == '.' |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5567 || (s[pos] == '(' && (pos += 1)) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5568 || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2))) |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5569 && (last == NULL /* save only the first clause */ |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
5570 || len != (int)strlen (last) |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5571 || !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
|
5572 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5573 make_tag (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
|
5574 return len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5575 } |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5576 else |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
5577 return 0; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5578 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5579 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5580 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5581 * 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
|
5582 * 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
|
5583 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5584 * 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
|
5585 * - 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
|
5586 * - 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
|
5587 * Backslash quotes everything. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5588 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5589 static int |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5590 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
|
5591 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5592 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5593 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5594 int origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5595 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5596 origpos = pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5597 |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
5598 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
|
5599 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5600 /* 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
|
5601 pos++; |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
5602 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
|
5603 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5604 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5605 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5606 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5607 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5608 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
|
5609 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5610 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5611 |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
5612 for (;;) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5613 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5614 if (s[pos] == '\'') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5615 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5616 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5617 if (s[pos] != '\'') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5618 break; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5619 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
|
5620 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5621 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
|
5622 /* 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
|
5623 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5624 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
|
5625 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5626 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
|
5627 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5628 pos += 2; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5629 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5630 else |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5631 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5632 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5633 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5634 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5635 else |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5636 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5637 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5638 |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5639 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5640 /* |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5641 * Support for Erlang |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5642 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5643 * 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
|
5644 * Assumes that Erlang functions start at column 0. |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5645 * Original code by Anders Lindgren (1996) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5646 */ |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5647 static int erlang_func __P((char *, char *)); |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5648 static void erlang_attribute __P((char *)); |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5649 static int erlang_atom __P((char *)); |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5650 |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5651 static void |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5652 Erlang_functions (inf) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5653 FILE *inf; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5654 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5655 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
|
5656 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5657 int allocated; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5658 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5659 allocated = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5660 len = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5661 last = NULL; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5662 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5663 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
|
5664 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5665 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
|
5666 continue; |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
5667 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
|
5668 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
|
5669 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
|
5670 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
|
5671 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
|
5672 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
|
5673 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
|
5674 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5675 erlang_attribute (cp); |
70342
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5676 if (last != NULL) |
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5677 { |
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5678 free (last); |
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5679 last = NULL; |
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5680 } |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5681 } |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5682 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
|
5683 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5684 /* |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5685 * 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
|
5686 * 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
|
5687 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5688 if (last == NULL) |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5689 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
|
5690 else if (len + 1 > allocated) |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5691 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
|
5692 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
|
5693 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
|
5694 last[len] = '\0'; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5695 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5696 } |
70342
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5697 if (last != NULL) |
f483d24dc1dd
(Perl_functions): Free space allocated for var package.
Francesco Potortì <pot@gnu.org>
parents:
70282
diff
changeset
|
5698 free (last); |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5699 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5700 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5701 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5702 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5703 * 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
|
5704 * <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
|
5705 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5706 * 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
|
5707 * 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
|
5708 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5709 * 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
|
5710 * was found. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5711 */ |
27658
5980f19581dc
(pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents:
27595
diff
changeset
|
5712 static int |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5713 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
|
5714 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5715 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
|
5716 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5717 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5718 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5719 |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5720 pos = erlang_atom (s); |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5721 if (pos < 1) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5722 return 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5723 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5724 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
|
5725 pos = skip_spaces (s + pos) - s; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5726 |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5727 /* Save only the first clause. */ |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5728 if (s[pos++] == '(' |
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5729 && (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
|
5730 || len != (int)strlen (last) |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5731 || !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
|
5732 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5733 make_tag (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
|
5734 return len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5735 } |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5736 |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5737 return 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5738 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5739 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5740 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5741 /* |
26262
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 * 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
|
5743 * and records. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5744 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5745 * 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
|
5746 * -define(foo, bar). |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5747 * -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
|
5748 * -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
|
5749 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5750 static void |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5751 erlang_attribute (s) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5752 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5753 { |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5754 char *cp = s; |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5755 |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5756 if ((LOOKING_AT (cp, "-define") || LOOKING_AT (cp, "-record")) |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5757 && *cp++ == '(') |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5758 { |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5759 int len = erlang_atom (skip_spaces (cp)); |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5760 if (len > 0) |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
5761 make_tag (cp, len, TRUE, s, cp + len - s, lineno, linecharno); |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5762 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5763 return; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5764 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5765 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5766 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5767 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5768 * 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
|
5769 * 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
|
5770 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5771 static int |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5772 erlang_atom (s) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5773 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5774 { |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5775 int pos = 0; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5776 |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
5777 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
|
5778 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5779 /* The atom is unquoted. */ |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5780 do |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5781 pos++; |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5782 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
|
5783 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5784 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
|
5785 { |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5786 for (pos++; s[pos] != '\''; pos++) |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5787 if (s[pos] == '\0' /* multiline quoted atoms are ignored */ |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5788 || (s[pos] == '\\' && s[++pos] == '\0')) |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5789 return 0; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5790 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5791 } |
45809
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5792 |
cd830b0ced4d
* etags.c (erlang_atom, erlang_attribute): Bugs corrected.
Francesco Potortì <pot@gnu.org>
parents:
45798
diff
changeset
|
5793 return pos; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
5794 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
5795 |
240 | 5796 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5797 static char *scan_separators __P((char *)); |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5798 static void add_regex __P((char *, language *)); |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
5799 static char *substitute __P((char *, char *, struct re_registers *)); |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
5800 |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5801 /* |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5802 * Take a string like "/blah/" and turn it into "blah", verifying |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5803 * that the first and last characters are the same, and handling |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5804 * quoted separator characters. Actually, stops on the occurrence of |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5805 * an unquoted separator. Also process \t, \n, etc. and turn into |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5806 * appropriate characters. Works in place. Null terminates name string. |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5807 * Returns pointer to terminating separator, or NULL for |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5808 * unterminated regexps. |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5809 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5810 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
|
5811 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
|
5812 char *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5813 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5814 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
|
5815 char *copyto = name; |
18042
c378dd0b8de7
Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents:
17785
diff
changeset
|
5816 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
|
5817 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5818 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
|
5819 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5820 if (quoted) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5821 { |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5822 switch (*name) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5823 { |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5824 case 'a': *copyto++ = '\007'; break; /* BEL (bell) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5825 case 'b': *copyto++ = '\b'; break; /* BS (back space) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5826 case 'd': *copyto++ = 0177; break; /* DEL (delete) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5827 case 'e': *copyto++ = 033; break; /* ESC (delete) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5828 case 'f': *copyto++ = '\f'; break; /* FF (form feed) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5829 case 'n': *copyto++ = '\n'; break; /* NL (new line) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5830 case 'r': *copyto++ = '\r'; break; /* CR (carriage return) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5831 case 't': *copyto++ = '\t'; break; /* TAB (horizontal tab) */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5832 case 'v': *copyto++ = '\v'; break; /* VT (vertical tab) */ |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5833 default: |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5834 if (*name == sep) |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5835 *copyto++ = sep; |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5836 else |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5837 { |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5838 /* Something else is quoted, so preserve the quote. */ |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5839 *copyto++ = '\\'; |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5840 *copyto++ = *name; |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5841 } |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
5842 break; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5843 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5844 quoted = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5845 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5846 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
|
5847 quoted = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5848 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
|
5849 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5850 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5851 *copyto++ = *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5852 } |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5853 if (*name != sep) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5854 name = NULL; /* signal unterminated regexp */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5855 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5856 /* 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
|
5857 *copyto = '\0'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5858 return name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5859 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5860 |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5861 /* 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
|
5862 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
|
5863 static void |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5864 analyse_regex (regex_arg) |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5865 char *regex_arg; |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5866 { |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5867 if (regex_arg == NULL) |
39317
a7f40b000353
* etags.c (analyse_regex): If regex_arg is NULL, return
Francesco Potortì <pot@gnu.org>
parents:
37719
diff
changeset
|
5868 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5869 free_regexps (); /* --no-regex: remove existing regexps */ |
39317
a7f40b000353
* etags.c (analyse_regex): If regex_arg is NULL, return
Francesco Potortì <pot@gnu.org>
parents:
37719
diff
changeset
|
5870 return; |
a7f40b000353
* etags.c (analyse_regex): If regex_arg is NULL, return
Francesco Potortì <pot@gnu.org>
parents:
37719
diff
changeset
|
5871 } |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5872 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5873 /* 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
|
5874 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
|
5875 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5876 /* 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
|
5877 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
|
5878 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
|
5879 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
|
5880 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
|
5881 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5882 /* 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
|
5883 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
|
5884 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
|
5885 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5886 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
|
5887 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
|
5888 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
|
5889 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5890 /* 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
|
5891 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
|
5892 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
|
5893 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5894 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
|
5895 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
|
5896 } |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5897 linebuffer_init (®exbuf); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5898 while (readline_internal (®exbuf, regexfp) > 0) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5899 analyse_regex (regexbuf.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
|
5900 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
|
5901 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
|
5902 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5903 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
|
5904 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5905 /* 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
|
5906 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
|
5907 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5908 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
|
5909 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
|
5910 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
|
5911 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5912 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
|
5913 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
|
5914 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5915 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
|
5916 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
|
5917 } |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5918 *cp++ = '\0'; |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
5919 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
|
5920 if (lang == NULL) |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5921 return; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5922 add_regex (cp, lang); |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5923 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5924 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
|
5925 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
5926 /* 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
|
5927 default: |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5928 add_regex (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
|
5929 break; |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5930 } |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5931 } |
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
5932 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5933 /* Separate the regexp pattern, compile it, |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5934 and care for optional name and modifiers. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
5935 static void |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5936 add_regex (regexp_pattern, lang) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5937 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
|
5938 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
|
5939 { |
37719
9c4fdf982ba2
(add_regex): Reset the whole newly allocated pattern buffer instead of
Francesco Potortì <pot@gnu.org>
parents:
37502
diff
changeset
|
5940 static struct re_pattern_buffer zeropattern; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5941 char sep, *pat, *name, *modifiers; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5942 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
|
5943 struct re_pattern_buffer *patbuf; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5944 regexp *rp; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5945 bool |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5946 force_explicit_name = TRUE, /* do not use implicit tag names */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5947 ignore_case = FALSE, /* case is significant */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5948 multi_line = FALSE, /* matches are done one line at a time */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5949 single_line = FALSE; /* dot does not match newline */ |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5950 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5951 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5952 if (strlen(regexp_pattern) < 3) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5953 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5954 error ("null regexp", (char *)NULL); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5955 return; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5956 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5957 sep = regexp_pattern[0]; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5958 name = scan_separators (regexp_pattern); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5959 if (name == NULL) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5960 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5961 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
|
5962 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5963 } |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5964 if (name[1] == sep) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5965 { |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5966 error ("null name for regexp \"%s\"", regexp_pattern); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5967 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
5968 } |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5969 modifiers = scan_separators (name); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5970 if (modifiers == NULL) /* no terminating separator --> no name */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5971 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5972 modifiers = name; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5973 name = ""; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5974 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5975 else |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5976 modifiers += 1; /* skip separator */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5977 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5978 /* Parse regex modifiers. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5979 for (; modifiers[0] != '\0'; modifiers++) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5980 switch (modifiers[0]) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5981 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5982 case 'N': |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5983 if (modifiers == name) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5984 error ("forcing explicit tag name but no name, ignoring", NULL); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5985 force_explicit_name = TRUE; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
5986 break; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5987 case 'i': |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5988 ignore_case = TRUE; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5989 break; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5990 case 's': |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5991 single_line = TRUE; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5992 /* FALLTHRU */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5993 case 'm': |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5994 multi_line = TRUE; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5995 need_filebuf = TRUE; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5996 break; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
5997 default: |
45918
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
5998 { |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
5999 char wrongmod [2]; |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
6000 wrongmod[0] = modifiers[0]; |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
6001 wrongmod[1] = '\0'; |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
6002 error ("invalid regexp modifier `%s', ignoring", wrongmod); |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
6003 } |
1c3f7d78e90a
(add_regex): Invalid regexp modifiers are ignored.
Francesco Potortì <pot@gnu.org>
parents:
45809
diff
changeset
|
6004 break; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6005 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6006 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6007 patbuf = xnew (1, struct re_pattern_buffer); |
37719
9c4fdf982ba2
(add_regex): Reset the whole newly allocated pattern buffer instead of
Francesco Potortì <pot@gnu.org>
parents:
37502
diff
changeset
|
6008 *patbuf = zeropattern; |
9c4fdf982ba2
(add_regex): Reset the whole newly allocated pattern buffer instead of
Francesco Potortì <pot@gnu.org>
parents:
37502
diff
changeset
|
6009 if (ignore_case) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6010 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6011 static char lc_trans[CHARS]; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6012 int i; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6013 for (i = 0; i < CHARS; i++) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6014 lc_trans[i] = lowcase (i); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6015 patbuf->translate = lc_trans; /* translation table to fold case */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6016 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6017 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6018 if (multi_line) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6019 pat = concat ("^", regexp_pattern, ""); /* anchor to beginning of line */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6020 else |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6021 pat = regexp_pattern; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6022 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6023 if (single_line) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6024 re_set_syntax (RE_SYNTAX_EMACS | RE_DOT_NEWLINE); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6025 else |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6026 re_set_syntax (RE_SYNTAX_EMACS); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6027 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6028 err = re_compile_pattern (pat, strlen (regexp_pattern), patbuf); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6029 if (multi_line) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6030 free (pat); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6031 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
|
6032 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6033 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
|
6034 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6035 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6036 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6037 rp = p_head; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6038 p_head = xnew (1, regexp); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6039 p_head->pattern = savestr (regexp_pattern); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6040 p_head->p_next = rp; |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6041 p_head->lang = lang; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6042 p_head->pat = patbuf; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6043 p_head->name = savestr (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
|
6044 p_head->error_signaled = FALSE; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6045 p_head->force_explicit_name = force_explicit_name; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6046 p_head->ignore_case = ignore_case; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6047 p_head->multi_line = multi_line; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6048 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6049 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6050 /* |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
6051 * 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
|
6052 * arguments. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6053 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6054 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
|
6055 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
|
6056 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
|
6057 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
|
6058 { |
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
|
6059 char *result, *t; |
17602
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6060 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
|
6061 |
1b5cc3740793
Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
17168
diff
changeset
|
6062 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
|
6063 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
|
6064 |
17602
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6065 /* 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
|
6066 if (out[size - 1] == '\\') |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6067 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
|
6068 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
|
6069 t != NULL; |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6070 t = etags_strchr (t + 2, '\\')) |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
6071 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
|
6072 { |
17602
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6073 dig = t[1] - '0'; |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6074 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
|
6075 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
|
6076 } |
17602
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6077 else |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6078 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
|
6079 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6080 /* Allocate space and do the substitutions. */ |
47218
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6081 assert (size >= 0); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6082 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
|
6083 |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6084 for (t = result; *out != '\0'; out++) |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
6085 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
|
6086 { |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6087 dig = *out - '0'; |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6088 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
|
6089 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
|
6090 t += diglen; |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6091 } |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6092 else |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6093 *t++ = *out; |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6094 *t = '\0'; |
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6095 |
47218
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6096 assert (t <= result + size); |
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6097 assert (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
|
6098 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6099 return result; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6100 } |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6101 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6102 /* Deallocate all regexps. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6103 static void |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6104 free_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
|
6105 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6106 regexp *rp; |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6107 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
|
6108 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6109 rp = p_head->p_next; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6110 free (p_head->pattern); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6111 free (p_head->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
|
6112 free (p_head); |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6113 p_head = rp; |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6114 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6115 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
|
6116 } |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6117 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6118 /* |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6119 * Reads the whole file as a single string from `filebuf' and looks for |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6120 * multi-line regular expressions, creating tags on matches. |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6121 * readline already dealt with normal regexps. |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6122 * |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6123 * Idea by Ben Wing <ben@666.com> (2002). |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6124 */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6125 static void |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6126 regex_tag_multiline () |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6127 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6128 char *buffer = filebuf.buffer; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6129 regexp *rp; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6130 char *name; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6131 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6132 for (rp = p_head; rp != NULL; rp = rp->p_next) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6133 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6134 int match = 0; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6135 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6136 if (!rp->multi_line) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6137 continue; /* skip normal regexps */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6138 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6139 /* Generic initialisations before parsing file from memory. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6140 lineno = 1; /* reset global line number */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6141 charno = 0; /* reset global char number */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6142 linecharno = 0; /* reset global char number of line start */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6143 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6144 /* Only use generic regexps or those for the current language. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6145 if (rp->lang != NULL && rp->lang != curfdp->lang) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6146 continue; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6147 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6148 while (match >= 0 && match < filebuf.len) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6149 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6150 match = re_search (rp->pat, buffer, filebuf.len, charno, |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6151 filebuf.len - match, &rp->regs); |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6152 switch (match) |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6153 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6154 case -2: |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6155 /* Some error. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6156 if (!rp->error_signaled) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6157 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6158 error ("regexp stack overflow while matching \"%s\"", |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6159 rp->pattern); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6160 rp->error_signaled = TRUE; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6161 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6162 break; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6163 case -1: |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6164 /* No match. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6165 break; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6166 default: |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6167 if (match == rp->regs.end[0]) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6168 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6169 if (!rp->error_signaled) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6170 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6171 error ("regexp matches the empty string: \"%s\"", |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6172 rp->pattern); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6173 rp->error_signaled = TRUE; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6174 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6175 match = -3; /* exit from while loop */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6176 break; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6177 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6178 |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6179 /* Match occurred. Construct a tag. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6180 while (charno < rp->regs.end[0]) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6181 if (buffer[charno++] == '\n') |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6182 lineno++, linecharno = charno; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6183 name = rp->name; |
47218
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6184 if (name[0] == '\0') |
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6185 name = NULL; |
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6186 else /* make a named tag */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6187 name = substitute (buffer, rp->name, &rp->regs); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6188 if (rp->force_explicit_name) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6189 /* Force explicit tag name, if a name is there. */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6190 pfnote (name, TRUE, buffer + linecharno, |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6191 charno - linecharno + 1, lineno, linecharno); |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6192 else |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6193 make_tag (name, strlen (name), TRUE, buffer + linecharno, |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6194 charno - linecharno + 1, lineno, linecharno); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6195 break; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6196 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6197 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6198 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6199 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6200 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6201 |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6202 static bool |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6203 nocase_tail (cp) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6204 char *cp; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6205 { |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6206 register int len = 0; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6207 |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6208 while (*cp != '\0' && lowcase (*cp) == lowcase (dbp[len])) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6209 cp++, len++; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6210 if (*cp == '\0' && !intoken (dbp[len])) |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6211 { |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6212 dbp += len; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6213 return TRUE; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6214 } |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6215 return FALSE; |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6216 } |
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6217 |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6218 static void |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6219 get_tag (bp, namepp) |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6220 register char *bp; |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6221 char **namepp; |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6222 { |
45950
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6223 register char *cp = bp; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6224 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6225 if (*bp != '\0') |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6226 { |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6227 /* Go till you get to white space or a syntactic break */ |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6228 for (cp = bp + 1; !notinname (*cp); cp++) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6229 continue; |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6230 make_tag (bp, cp - bp, TRUE, |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6231 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6232 } |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6233 |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6234 if (namepp != NULL) |
74a2581262b0
(F_getit, Fortran_functions, Ada_getit, Asm_labels)
Francesco Potortì <pot@gnu.org>
parents:
45926
diff
changeset
|
6235 *namepp = savenstr (bp, cp - 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
|
6236 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6237 |
240 | 6238 /* |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6239 * 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
|
6240 * 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
|
6241 * `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
|
6242 * |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6243 * On DOS or Windows we do not count the CR character, if any before the |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6244 * NL, in the returned length; this mirrors the behavior of Emacs on those |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6245 * 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
|
6246 * file). |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6247 * |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6248 * If multi-line regular expressions are requested, each line read is |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6249 * appended to `filebuf'. |
240 | 6250 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6251 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
|
6252 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
|
6253 linebuffer *lbp; |
240 | 6254 register FILE *stream; |
6255 { | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6256 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
|
6257 register char *p = lbp->buffer; |
240 | 6258 register char *pend; |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6259 int chars_deleted; |
240 | 6260 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6261 pend = p + lbp->size; /* Separate to avoid 386/IX compiler bug. */ |
240 | 6262 |
45655
a4c27d23899f
(enum arg_type): New label at_stdin.
Francesco Potortì <pot@gnu.org>
parents:
45654
diff
changeset
|
6263 for (;;) |
240 | 6264 { |
6265 register int c = getc (stream); | |
6266 if (p == pend) | |
6267 { | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6268 /* 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
|
6269 lbp->size *= 2; |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6270 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
|
6271 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
|
6272 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
|
6273 lbp->buffer = buffer; |
240 | 6274 } |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6275 if (c == EOF) |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6276 { |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
6277 *p = '\0'; |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6278 chars_deleted = 0; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6279 break; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6280 } |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6281 if (c == '\n') |
240 | 6282 { |
10990
c0ceaa45ded7
* etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents:
10801
diff
changeset
|
6283 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
|
6284 { |
17602
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6285 p -= 1; |
15772
eb1cef7102e3
(readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents:
15683
diff
changeset
|
6286 #ifdef DOS_NT |
16373
d50369f4bb41
* etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents:
16086
diff
changeset
|
6287 /* 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
|
6288 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
|
6289 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
|
6290 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
|
6291 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
|
6292 chars_deleted = 1; |
eb1cef7102e3
(readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents:
15683
diff
changeset
|
6293 #else |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6294 chars_deleted = 2; |
15772
eb1cef7102e3
(readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents:
15683
diff
changeset
|
6295 #endif |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6296 } |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6297 else |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6298 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6299 chars_deleted = 1; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
6300 } |
17602
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6301 *p = '\0'; |
240 | 6302 break; |
6303 } | |
6304 *p++ = c; | |
6305 } | |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6306 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
|
6307 |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6308 if (need_filebuf /* we need filebuf for multi-line regexps */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6309 && chars_deleted > 0) /* not at EOF */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6310 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6311 while (filebuf.size <= filebuf.len + lbp->len + 1) /* +1 for \n */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6312 { |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6313 /* Expand filebuf. */ |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6314 filebuf.size *= 2; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6315 xrnew (filebuf.buffer, filebuf.size, char); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6316 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6317 strncpy (filebuf.buffer + filebuf.len, lbp->buffer, lbp->len); |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6318 filebuf.len += lbp->len; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6319 filebuf.buffer[filebuf.len++] = '\n'; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6320 filebuf.buffer[filebuf.len] = '\0'; |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6321 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6322 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6323 return lbp->len + chars_deleted; |
240 | 6324 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6325 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6326 /* |
17602
39b58a508be6
* etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents:
17477
diff
changeset
|
6327 * Like readline_internal, above, but in addition try to match the |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6328 * input line against relevant regular expressions and manage #line |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6329 * directives. |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6330 */ |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6331 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
|
6332 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
|
6333 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
|
6334 FILE *stream; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6335 { |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6336 long result; |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6337 |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6338 linecharno = charno; /* update global char number of line start */ |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6339 result = readline_internal (lbp, stream); /* read line */ |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6340 lineno += 1; /* increment global line number */ |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6341 charno += result; /* increment global char number */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6342 |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
6343 /* Honour #line directives. */ |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6344 if (!no_line_directive) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6345 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6346 static bool discard_until_line_directive; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6347 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6348 /* Check whether this is a #line directive. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6349 if (result > 12 && strneq (lbp->buffer, "#line ", 6)) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6350 { |
74298
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
6351 unsigned int lno; |
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
6352 int start = 0; |
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
6353 |
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
6354 if (sscanf (lbp->buffer, "#line %u \"%n", &lno, &start) >= 1 |
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
6355 && start > 0) /* double quote character found */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6356 { |
74298
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
6357 char *endp = lbp->buffer + start; |
e3d189507be0
Previous changes checked in by jhd checked and cleaned up:
Francesco Potortì <pot@gnu.org>
parents:
72329
diff
changeset
|
6358 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6359 while ((endp = etags_strchr (endp, '"')) != NULL |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6360 && endp[-1] == '\\') |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6361 endp++; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6362 if (endp != NULL) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6363 /* Ok, this is a real #line directive. Let's deal with it. */ |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
6364 { |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6365 char *taggedabsname; /* absolute name of original file */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6366 char *taggedfname; /* name of original file as given */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6367 char *name; /* temp var */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6368 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6369 discard_until_line_directive = FALSE; /* found it */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6370 name = lbp->buffer + start; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6371 *endp = '\0'; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6372 canonicalize_filename (name); /* for DOS */ |
74951
96636bda161b
(readline): When creating a relative file name from a
Francesco Potortì <pot@gnu.org>
parents:
74768
diff
changeset
|
6373 taggedabsname = absolute_filename (name, tagfiledir); |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6374 if (filename_is_absolute (name) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6375 || filename_is_absolute (curfdp->infname)) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6376 taggedfname = savestr (taggedabsname); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6377 else |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6378 taggedfname = relative_filename (taggedabsname,tagfiledir); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6379 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6380 if (streq (curfdp->taggedfname, taggedfname)) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6381 /* The #line directive is only a line number change. We |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6382 deal with this afterwards. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6383 free (taggedfname); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6384 else |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6385 /* The tags following this #line directive should be |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6386 attributed to taggedfname. In order to do this, set |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6387 curfdp accordingly. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6388 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6389 fdesc *fdp; /* file description pointer */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6390 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6391 /* Go look for a file description already set up for the |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6392 file indicated in the #line directive. If there is |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6393 one, use it from now until the next #line |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6394 directive. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6395 for (fdp = fdhead; fdp != NULL; fdp = fdp->next) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6396 if (streq (fdp->infname, curfdp->infname) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6397 && streq (fdp->taggedfname, taggedfname)) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6398 /* If we remove the second test above (after the &&) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6399 then all entries pertaining to the same file are |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6400 coalesced in the tags file. If we use it, then |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6401 entries pertaining to the same file but generated |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6402 from different files (via #line directives) will |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6403 go into separate sections in the tags file. These |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6404 alternatives look equivalent. The first one |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6405 destroys some apparently useless information. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6406 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6407 curfdp = fdp; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6408 free (taggedfname); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6409 break; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6410 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6411 /* Else, if we already tagged the real file, skip all |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6412 input lines until the next #line directive. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6413 if (fdp == NULL) /* not found */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6414 for (fdp = fdhead; fdp != NULL; fdp = fdp->next) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6415 if (streq (fdp->infabsname, taggedabsname)) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6416 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6417 discard_until_line_directive = TRUE; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6418 free (taggedfname); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6419 break; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6420 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6421 /* Else create a new file description and use that from |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6422 now on, until the next #line directive. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6423 if (fdp == NULL) /* not found */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6424 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6425 fdp = fdhead; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6426 fdhead = xnew (1, fdesc); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6427 *fdhead = *curfdp; /* copy curr. file description */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6428 fdhead->next = fdp; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6429 fdhead->infname = savestr (curfdp->infname); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6430 fdhead->infabsname = savestr (curfdp->infabsname); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6431 fdhead->infabsdir = savestr (curfdp->infabsdir); |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6432 fdhead->taggedfname = taggedfname; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6433 fdhead->usecharno = FALSE; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6434 fdhead->prop = NULL; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6435 fdhead->written = FALSE; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6436 curfdp = fdhead; |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6437 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6438 } |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6439 free (taggedabsname); |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6440 lineno = lno - 1; |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6441 readline (lbp, stream); |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6442 return; |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6443 } /* if a real #line directive */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6444 } /* if #line is followed by a a number */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6445 } /* if line begins with "#line " */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6446 |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6447 /* If we are here, no #line directive was found. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6448 if (discard_until_line_directive) |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6449 { |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6450 if (result > 0) |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6451 { |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6452 /* Do a tail recursion on ourselves, thus discarding the contents |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6453 of the line buffer. */ |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6454 readline (lbp, stream); |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6455 return; |
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6456 } |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6457 /* End of file. */ |
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6458 discard_until_line_directive = FALSE; |
45665
466c8ca0e543
(scan_separators): Support all character escape
Francesco Potortì <pot@gnu.org>
parents:
45655
diff
changeset
|
6459 return; |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6460 } |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6461 } /* if #line directives should be considered */ |
43854
e71940336640
* etags.c (Python_functions): Skip spaces at beginning of lines.
Francesco Potortì <pot@gnu.org>
parents:
43759
diff
changeset
|
6462 |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6463 { |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6464 int match; |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6465 regexp *rp; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6466 char *name; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6467 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6468 /* Match against relevant regexps. */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6469 if (lbp->len > 0) |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6470 for (rp = p_head; rp != NULL; rp = rp->p_next) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6471 { |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6472 /* Only use generic regexps or those for the current language. |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6473 Also do not use multiline regexps, which is the job of |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6474 regex_tag_multiline. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6475 if ((rp->lang != NULL && rp->lang != fdhead->lang) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6476 || rp->multi_line) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6477 continue; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6478 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6479 match = re_match (rp->pat, lbp->buffer, lbp->len, 0, &rp->regs); |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6480 switch (match) |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6481 { |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6482 case -2: |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6483 /* Some error. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6484 if (!rp->error_signaled) |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6485 { |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6486 error ("regexp stack overflow while matching \"%s\"", |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6487 rp->pattern); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6488 rp->error_signaled = TRUE; |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6489 } |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6490 break; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6491 case -1: |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6492 /* No match. */ |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6493 break; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6494 case 0: |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6495 /* Empty string matched. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6496 if (!rp->error_signaled) |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6497 { |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6498 error ("regexp matches the empty string: \"%s\"", rp->pattern); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6499 rp->error_signaled = TRUE; |
45798
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6500 } |
a486496c2006
New multi-line regexp and new regexp syntax.
Francesco Potortì <pot@gnu.org>
parents:
45665
diff
changeset
|
6501 break; |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6502 default: |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6503 /* Match occurred. Construct a tag. */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6504 name = rp->name; |
47218
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6505 if (name[0] == '\0') |
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6506 name = NULL; |
66c5d66d21f6
(regex_tag_multiline, readline): Never pass pfnote a
Francesco Potortì <pot@gnu.org>
parents:
47157
diff
changeset
|
6507 else /* make a named tag */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6508 name = substitute (lbp->buffer, rp->name, &rp->regs); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6509 if (rp->force_explicit_name) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6510 /* Force explicit tag name, if a name is there. */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6511 pfnote (name, TRUE, lbp->buffer, match, lineno, linecharno); |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6512 else |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6513 make_tag (name, strlen (name), TRUE, |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6514 lbp->buffer, match, lineno, linecharno); |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6515 break; |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6516 } |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6517 } |
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6518 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6519 } |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6520 |
240 | 6521 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
6522 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
6523 * 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
|
6524 * 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
|
6525 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6526 static char * |
240 | 6527 savestr (cp) |
6528 char *cp; | |
6529 { | |
6530 return savenstr (cp, strlen (cp)); | |
6531 } | |
6532 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
6533 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
6534 * 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
|
6535 * 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
|
6536 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6537 static char * |
240 | 6538 savenstr (cp, len) |
6539 char *cp; | |
6540 int len; | |
6541 { | |
6542 register char *dp; | |
6543 | |
6544 dp = xnew (len + 1, char); | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
6545 strncpy (dp, cp, len); |
240 | 6546 dp[len] = '\0'; |
6547 return dp; | |
6548 } | |
6549 | |
6550 /* | |
6551 * Return the ptr in sp at which the character c last | |
6552 * appears; NULL if not found | |
6553 * | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6554 * Identical to POSIX strrchr, included for portability. |
240 | 6555 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6556 static char * |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6557 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
|
6558 register const char *sp; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6559 register int c; |
240 | 6560 { |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6561 register const char *r; |
240 | 6562 |
6563 r = NULL; | |
6564 do | |
6565 { | |
6566 if (*sp == c) | |
6567 r = sp; | |
6568 } while (*sp++); | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6569 return (char *)r; |
240 | 6570 } |
6571 | |
6572 /* | |
6573 * Return the ptr in sp at which the character c first | |
6574 * appears; NULL if not found | |
6575 * | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6576 * Identical to POSIX strchr, included for portability. |
240 | 6577 */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6578 static char * |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6579 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
|
6580 register const char *sp; |
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6581 register int c; |
240 | 6582 { |
6583 do | |
6584 { | |
6585 if (*sp == c) | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6586 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
|
6587 } while (*sp++); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
6588 return NULL; |
240 | 6589 } |
6590 | |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6591 /* |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6592 * Compare two strings, ignoring case for alphabetic characters. |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6593 * |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6594 * Same as BSD's strcasecmp, included for portability. |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6595 */ |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6596 static int |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6597 etags_strcasecmp (s1, s2) |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6598 register const char *s1; |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6599 register const char *s2; |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6600 { |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6601 while (*s1 != '\0' |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6602 && (ISALPHA (*s1) && ISALPHA (*s2) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6603 ? lowcase (*s1) == lowcase (*s2) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6604 : *s1 == *s2)) |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6605 s1++, s2++; |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6606 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6607 return (ISALPHA (*s1) && ISALPHA (*s2) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6608 ? lowcase (*s1) - lowcase (*s2) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6609 : *s1 - *s2); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6610 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6611 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6612 /* |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6613 * Compare two strings, ignoring case for alphabetic characters. |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6614 * Stop after a given number of characters |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6615 * |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6616 * Same as BSD's strncasecmp, included for portability. |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6617 */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6618 static int |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6619 etags_strncasecmp (s1, s2, n) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6620 register const char *s1; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6621 register const char *s2; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6622 register int n; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6623 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6624 while (*s1 != '\0' && n-- > 0 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6625 && (ISALPHA (*s1) && ISALPHA (*s2) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6626 ? lowcase (*s1) == lowcase (*s2) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6627 : *s1 == *s2)) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6628 s1++, s2++; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6629 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6630 if (n < 0) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6631 return 0; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6632 else |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6633 return (ISALPHA (*s1) && ISALPHA (*s2) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6634 ? lowcase (*s1) - lowcase (*s2) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6635 : *s1 - *s2); |
44605
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6636 } |
1bec0b430206
Bug fix. New version to come soon.
Francesco Potortì <pot@gnu.org>
parents:
44604
diff
changeset
|
6637 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
6638 /* Skip spaces (end of string is not space), return new pointer. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6639 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
|
6640 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
|
6641 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
|
6642 { |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
6643 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
|
6644 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
|
6645 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
|
6646 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6647 |
65708
824d09eb82bf
Preliminary Forth support.
Francesco Potortì <pot@gnu.org>
parents:
64769
diff
changeset
|
6648 /* Skip non spaces, except end of string, return new pointer. */ |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6649 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
|
6650 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
|
6651 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
|
6652 { |
27661
c8b3e7e83e09
2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents:
27658
diff
changeset
|
6653 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
|
6654 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
|
6655 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
|
6656 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6657 |
240 | 6658 /* Print error message and exit. */ |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6659 void |
240 | 6660 fatal (s1, s2) |
6661 char *s1, *s2; | |
6662 { | |
6663 error (s1, s2); | |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
6664 exit (EXIT_FAILURE); |
240 | 6665 } |
6666 | |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6667 static void |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6668 pfatal (s1) |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6669 char *s1; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6670 { |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6671 perror (s1); |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
6672 exit (EXIT_FAILURE); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6673 } |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6674 |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6675 static void |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
6676 suggest_asking_for_help () |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
6677 { |
57013
c2ab1ac6a36b
[LONG_OPTIONS]: make it TRUE (ifdef) or FALSE for ease of use.
Francesco Potortì <pot@gnu.org>
parents:
55408
diff
changeset
|
6678 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", |
72192
15be100e5afb
Adrian Aichner: <adrian@xemacs.org>
Francesco Potortì <pot@gnu.org>
parents:
71783
diff
changeset
|
6679 progname, NO_LONG_OPTIONS ? "-h" : "--help"); |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
6680 exit (EXIT_FAILURE); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
6681 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
6682 |
240 | 6683 /* 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
|
6684 static void |
240 | 6685 error (s1, s2) |
27595
25ed45af9355
2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26507
diff
changeset
|
6686 const char *s1, *s2; |
240 | 6687 { |
6688 fprintf (stderr, "%s: ", progname); | |
6689 fprintf (stderr, s1, s2); | |
6690 fprintf (stderr, "\n"); | |
6691 } | |
6692 | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6693 /* Return a newly-allocated string whose contents |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6694 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
|
6695 static char * |
240 | 6696 concat (s1, s2, s3) |
6697 char *s1, *s2, *s3; | |
6698 { | |
6699 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | |
6700 char *result = xnew (len1 + len2 + len3 + 1, char); | |
6701 | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
6702 strcpy (result, s1); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
6703 strcpy (result + len1, s2); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
6704 strcpy (result + len1 + len2, s3); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6705 result[len1 + len2 + len3] = '\0'; |
240 | 6706 |
6707 return result; | |
6708 } | |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6709 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6710 |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6711 /* 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
|
6712 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
|
6713 static char * |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
6714 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
|
6715 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6716 #ifdef HAVE_GETCWD |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6717 int bufsize = 200; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6718 char *path = xnew (bufsize, char); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6719 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6720 while (getcwd (path, bufsize) == NULL) |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6721 { |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
6722 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
|
6723 pfatal ("getcwd"); |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
6724 bufsize *= 2; |
17778
c3ff4c535c9c
* etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents:
17602
diff
changeset
|
6725 free (path); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6726 path = xnew (bufsize, char); |
8789
81a2817b99b2
(etags_getcwd): Use getcwd if available.
Karl Heuer <kwzh@gnu.org>
parents:
8180
diff
changeset
|
6727 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6728 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6729 canonicalize_filename (path); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6730 return path; |
16394
675944d1abc9
(etags_getcwd) [WINDOWSNT]: Convert backslashes to slashes.
Richard M. Stallman <rms@gnu.org>
parents:
16373
diff
changeset
|
6731 |
16086
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6732 #else /* not HAVE_GETCWD */ |
35665
2ce207b252dc
Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents:
35653
diff
changeset
|
6733 #if MSDOS |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6734 |
16086
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6735 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
|
6736 |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6737 getwd (path); |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6738 |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6739 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
|
6740 if (*p == '\\') |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6741 *p = '/'; |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6742 else |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6743 *p = lowcase (*p); |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6744 |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6745 return strdup (path); |
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6746 #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
|
6747 linebuffer path; |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6748 FILE *pipe; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6749 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6750 linebuffer_init (&path); |
11990
1e5d25c997ca
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11957
diff
changeset
|
6751 pipe = (FILE *) popen ("pwd 2>/dev/null", "r"); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6752 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
|
6753 pfatal ("pwd"); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6754 pclose (pipe); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6755 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6756 return path.buffer; |
16086
33519c691e63
(etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
15772
diff
changeset
|
6757 #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
|
6758 #endif /* not HAVE_GETCWD */ |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
6759 } |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6760 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6761 /* 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
|
6762 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
|
6763 static char * |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6764 relative_filename (file, dir) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6765 char *file, *dir; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6766 { |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6767 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
|
6768 int i; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6769 |
16540
bf7e776e40f6
* etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
16394
diff
changeset
|
6770 /* 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
|
6771 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
|
6772 fp = afn; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6773 dp = dir; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6774 while (*fp++ == *dp++) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6775 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
|
6776 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
|
6777 #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
|
6778 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
|
6779 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
|
6780 #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
|
6781 do /* look at the equal chars until '/' */ |
16540
bf7e776e40f6
* etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
16394
diff
changeset
|
6782 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
|
6783 while (*fp != '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6784 |
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
|
6785 /* 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
|
6786 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
|
6787 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
|
6788 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
|
6789 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
|
6790 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
|
6791 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
|
6792 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
|
6793 |
1b5cc3740793
Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
17168
diff
changeset
|
6794 /* 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
|
6795 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
|
6796 free (afn); |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
6797 |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
6798 return res; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6799 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6800 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6801 /* 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
|
6802 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
|
6803 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
|
6804 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
|
6805 char *file, *dir; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6806 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6807 char *slashp, *cp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6808 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6809 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
|
6810 res = savestr (file); |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
6811 #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
|
6812 /* 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
|
6813 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
|
6814 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
|
6815 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
|
6816 #endif |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6817 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
|
6818 res = concat (dir, file, ""); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6819 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6820 /* Delete the "/dirname/.." and "/." substrings. */ |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6821 slashp = etags_strchr (res, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6822 while (slashp != NULL && slashp[0] != '\0') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6823 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6824 if (slashp[1] == '.') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6825 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6826 if (slashp[2] == '.' |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6827 && (slashp[3] == '/' || slashp[3] == '\0')) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6828 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6829 cp = slashp; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6830 do |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6831 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
|
6832 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
|
6833 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
|
6834 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
|
6835 #ifdef DOS_NT |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
6836 /* 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
|
6837 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
|
6838 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
|
6839 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
|
6840 cp = slashp; |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
6841 #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
|
6842 strcpy (cp, slashp + 3); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6843 slashp = cp; |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
6844 continue; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6845 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6846 else if (slashp[2] == '/' || slashp[2] == '\0') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6847 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6848 strcpy (slashp, slashp + 2); |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
6849 continue; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6850 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6851 } |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
6852 |
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
6853 slashp = etags_strchr (slashp + 1, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6854 } |
24140
9e4d1d3eab09
(etags_getcwd, absolute_filename) [DOS_NT]: Canonicalize
Geoff Voelker <voelker@cs.washington.edu>
parents:
24059
diff
changeset
|
6855 |
71783
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
6856 if (res[0] == '\0') /* just a safety net: should never happen */ |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
6857 { |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
6858 free (res); |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
6859 return savestr ("/"); |
b442d7e84235
(absolute_filename): Free unused space (cosmetic change).
Francesco Potortì <pot@gnu.org>
parents:
70342
diff
changeset
|
6860 } |
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
|
6861 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
|
6862 return res; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6863 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6864 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6865 /* 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
|
6866 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
|
6867 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
|
6868 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
|
6869 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
|
6870 char *file, *dir; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6871 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6872 char *slashp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6873 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
|
6874 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6875 canonicalize_filename (file); |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
6876 slashp = etags_strrchr (file, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6877 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
|
6878 return savestr (dir); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6879 save = slashp[1]; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6880 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
|
6881 res = absolute_filename (file, dir); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6882 slashp[1] = save; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6883 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6884 return res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6885 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
6886 |
26262
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6887 /* 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
|
6888 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
|
6889 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
|
6890 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
|
6891 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
|
6892 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6893 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
|
6894 #ifdef DOS_NT |
34608
9286b7ab7104
(ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents:
30969
diff
changeset
|
6895 || (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
|
6896 #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
|
6897 ); |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6898 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6899 |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6900 /* 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
|
6901 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
|
6902 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
|
6903 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
|
6904 { |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6905 #ifdef DOS_NT |
26507
aabdfbf65c68
1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
26340
diff
changeset
|
6906 /* Canonicalize drive letter case. */ |
35297
e268b7b500f0
Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents:
34635
diff
changeset
|
6907 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
|
6908 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
|
6909 /* 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
|
6910 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
|
6911 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
|
6912 *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
|
6913 #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
|
6914 /* 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
|
6915 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
|
6916 #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
|
6917 } |
c416a18b0a5d
Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents:
26083
diff
changeset
|
6918 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6919 |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6920 /* Initialize a linebuffer for use */ |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6921 static void |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6922 linebuffer_init (lbp) |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6923 linebuffer *lbp; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6924 { |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6925 lbp->size = (DEBUG) ? 3 : 200; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6926 lbp->buffer = xnew (lbp->size, char); |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6927 lbp->buffer[0] = '\0'; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6928 lbp->len = 0; |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6929 } |
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6930 |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6931 /* 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
|
6932 static void |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6933 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
|
6934 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
|
6935 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
|
6936 { |
35574
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6937 while (lbp->size <= toksize) |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6938 { |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6939 lbp->size *= 2; |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6940 xrnew (lbp->buffer, lbp->size, char); |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6941 } |
ede82ab0ae24
Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents:
35302
diff
changeset
|
6942 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
|
6943 } |
4ed8667d6bd9
Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents:
16540
diff
changeset
|
6944 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6945 /* Like malloc but get fatal error if memory is exhausted. */ |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6946 static PTR |
240 | 6947 xmalloc (size) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
6948 unsigned int size; |
240 | 6949 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6950 PTR result = (PTR) malloc (size); |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
6951 if (result == NULL) |
16607
16b8d910795f
* etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents:
16573
diff
changeset
|
6952 fatal ("virtual memory exhausted", (char *)NULL); |
240 | 6953 return result; |
6954 } | |
6955 | |
43723
5cd450d9f443
* etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents:
42345
diff
changeset
|
6956 static PTR |
240 | 6957 xrealloc (ptr, size) |
6958 char *ptr; | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
6959 unsigned int size; |
240 | 6960 { |
42345
7d2776273a81
support for Perl packages
Francesco Potortì <pot@gnu.org>
parents:
42042
diff
changeset
|
6961 PTR result = (PTR) realloc (ptr, size); |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
6962 if (result == NULL) |
16607
16b8d910795f
* etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents:
16573
diff
changeset
|
6963 fatal ("virtual memory exhausted", (char *)NULL); |
240 | 6964 return result; |
6965 } | |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
6966 |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
6967 /* |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
6968 * Local Variables: |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
6969 * indent-tabs-mode: t |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
6970 * tab-width: 8 |
44604
4702b23921b4
Avoid doubly tagging parse.y when both parse.c and parse.y are given on
Francesco Potortì <pot@gnu.org>
parents:
44114
diff
changeset
|
6971 * fill-column: 79 |
47081
9c058ffb550b
Two bug corrections and one new feature.
Francesco Potortì <pot@gnu.org>
parents:
45950
diff
changeset
|
6972 * c-font-lock-extra-types: ("FILE" "bool" "language" "linebuffer" "fdesc" "node" "regexp") |
75654
8f0016c7d0b9
Fix file local variables c-file-style specification.
Glenn Morris <rgm@gnu.org>
parents:
75348
diff
changeset
|
6973 * c-file-style: "gnu" |
42042
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
6974 * End: |
481d38f6aec2
* etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents:
39317
diff
changeset
|
6975 */ |
52401 | 6976 |
6977 /* arch-tag: 8a9b748d-390c-4922-99db-2eeefa921051 | |
6978 (do not change this comment) */ | |
55408
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
6979 |
1c425ce93ce9
(GOOD, BAD): Delete macros. Throughout,
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52421
diff
changeset
|
6980 /* etags.c ends here */ |