Mercurial > emacs
annotate lib-src/etags.c @ 10811:7f9e55cdc349
(set-fill-prefix): start from left-margin.
(fill-region-as-paragraph): don't delete hard newlines. ignore whitespace
at beginning of region. Remove justification indentation.
(fill-region): Don't use paragraph-movement commands when use-hard-newlines
is true, just search for hard newlines.
(current-justification): take care at EOB.
(set-justification): new argWHOLE-PAR. Callers changed.
(justify-current-line): Error if JUSTIFY arg is not reasonable.
Better interaction if there is a fill-prefix.
"Line too long" warning removed.
(unjustify-current-line, unjustify-region): New functions.
author | Boris Goldowsky <boris@gnu.org> |
---|---|
date | Thu, 23 Feb 1995 18:22:04 +0000 |
parents | 32f98b512dd9 |
children | c0ceaa45ded7 |
rev | line source |
---|---|
240 | 1 /* Tags file maker to go with GNU Emacs |
7307 | 2 Copyright (C) 1984,87,88,89,93,94 Free Software Foundation, Inc. and Ken Arnold |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
3 This file is not considered part of GNU Emacs. |
240 | 4 |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
5 This program is free software; you can redistribute it and/or modify |
240 | 6 it under the terms of the GNU General Public License as published by |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
7 the Free Software Foundation; either version 2 of the License, or |
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
8 (at your option) any later version. |
240 | 9 |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
240 | 11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 GNU General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU General Public License | |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
16 along with this program; if not, write to the Free Software |
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
240 | 18 |
19 /* | |
20 * Authors: | |
21 * Ctags originally by Ken Arnold. | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
22 * Fortran added by Jim Kleckner. |
240 | 23 * Ed Pelegri-Llopart added C typedefs. |
24 * Gnu Emacs TAGS format and modifications by RMS? | |
25 * Sam Kendall added C++. | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
26 * Francesco Potorti` reorganised C and C++ based on work by Joe Wells. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
27 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
28 * Regexp tags by Tom Tromey. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
29 #endif |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
30 * |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
31 * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer. |
240 | 32 */ |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
33 |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
34 char pot_etags_version[] = "@(#) pot revision number is 11.25"; |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
35 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
36 #define TRUE 1 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
37 #define FALSE 0 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
38 #ifndef DEBUG |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
39 # define DEBUG FALSE |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
40 #endif |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
41 |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
42 #ifdef MSDOS |
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
43 #include <fcntl.h> |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
44 #include <sys/param.h> |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
45 #endif /* MSDOS */ |
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
46 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
47 #ifdef WINDOWSNT |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
48 #include <stdlib.h> |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
49 #include <fcntl.h> |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
50 #include <string.h> |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
51 #define MAXPATHLEN _MAX_PATH |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
52 #endif |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
53 |
4052
9535e8ffb209
* etags.c (alloca): removed all references to it.
Jim Blandy <jimb@redhat.com>
parents:
4051
diff
changeset
|
54 #ifdef HAVE_CONFIG_H |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
55 #include <config.h> |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
56 /* On some systems, Emacs defines static as nothing for the sake |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
57 of unexec. We don't want that here since we don't use unexec. */ |
6831 | 58 #undef static |
3208
daf2762a353c
* etags.c: Replace the CPP tangle for alloca with the one from the
Jim Blandy <jimb@redhat.com>
parents:
3099
diff
changeset
|
59 #endif |
401 | 60 |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
61 #include <stdio.h> |
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
62 #include <ctype.h> |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
63 #include <errno.h> |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
64 #ifndef errno |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
65 extern int errno; |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
66 #endif |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
67 #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
|
68 #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
|
69 |
4804
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
70 #if !defined (S_ISREG) && defined (S_IFREG) |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
71 # 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
|
72 #endif |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
73 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
74 #include <getopt.h> |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
75 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
76 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
77 #include <regex.h> |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
78 #endif /* ETAGS_REGEXPS */ |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
79 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
80 /* Define CTAGS to make the program "ctags" compatible with the usual one. |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
81 Let it undefined to make the program "etags", which makes emacs-style |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
82 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
|
83 #ifdef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
84 # undef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
85 # define CTAGS TRUE |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
86 #else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
87 # define CTAGS FALSE |
240 | 88 #endif |
89 | |
90 /* Exit codes for success and failure. */ | |
91 #ifdef VMS | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
92 #define GOOD 1 |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
93 #define BAD 0 |
240 | 94 #else |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
95 #define GOOD 0 |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
96 #define BAD 1 |
240 | 97 #endif |
98 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
99 /* C extensions. */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
100 #define C_PLPL 0x00001 /* C++ */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
101 #define C_STAR 0x00003 /* C* */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
102 #define YACC 0x10000 /* yacc file */ |
240 | 103 |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
104 #define streq(s,t) (strcmp (s, t) == 0) |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
105 #define strneq(s,t,n) (strncmp (s, t, n) == 0) |
240 | 106 |
107 #define iswhite(arg) (_wht[arg]) /* T if char is white */ | |
108 #define begtoken(arg) (_btk[arg]) /* T if char can start token */ | |
109 #define intoken(arg) (_itk[arg]) /* T if char can be in token */ | |
110 #define endtoken(arg) (_etk[arg]) /* T if char ends tokens */ | |
111 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
112 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
113 * xnew -- allocate storage |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
114 * |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
115 * SYNOPSIS: Type *xnew (int n, Type); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
116 */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
117 #define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type))) |
240 | 118 |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
119 typedef int logical; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
120 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
121 typedef struct nd_st |
240 | 122 { /* sorting structure */ |
123 char *name; /* function or type name */ | |
124 char *file; /* file name */ | |
125 logical is_func; /* use pattern or line no */ | |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
126 logical named; /* list name separately */ |
240 | 127 logical been_warned; /* set if noticed dup */ |
128 int lno; /* line number tag is on */ | |
129 long cno; /* character number line starts on */ | |
130 char *pat; /* search pattern */ | |
131 struct nd_st *left, *right; /* left and right sons */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
132 } NODE; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
133 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
134 extern char *getenv (); |
240 | 135 |
136 char *concat (); | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
137 char *savenstr (), *savestr (); |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
138 char *etags_strchr (), *etags_strrchr (); |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
139 char *etags_getcwd (); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
140 char *relative_filename (), *absolute_filename (), *absolute_dirname (); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
141 char *xmalloc (), *xrealloc (); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
142 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
143 typedef void Lang_function (); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
144 #if FALSE /* many compilers barf on this */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
145 Lang_function Asm_labels; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
146 Lang_function default_C_entries; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
147 Lang_function C_entries; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
148 Lang_function Cplusplus_entries; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
149 Lang_function Cstar_entries; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
150 Lang_function Fortran_functions; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
151 Lang_function Yacc_entries; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
152 Lang_function Lisp_functions; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
153 Lang_function Pascal_functions; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
154 Lang_function Prolog_functions; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
155 Lang_function Scheme_functions; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
156 Lang_function TeX_functions; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
157 Lang_function just_read_file; |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
158 #else /* so let's write it this way */ |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
159 void Asm_labels (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
160 void default_C_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
161 void C_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
162 void Cplusplus_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
163 void Cstar_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
164 void Fortran_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
165 void Yacc_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
166 void Lisp_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
167 void Pascal_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
168 void Prolog_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
169 void Scheme_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
170 void TeX_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
171 void just_read_file (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
172 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
173 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
174 logical get_language (); |
240 | 175 int total_size_of_entries (); |
176 long readline (); | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
177 long readline_internal (); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
178 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
179 void add_regex (); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
180 #endif |
240 | 181 void add_node (); |
182 void error (); | |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
183 void fatal (), pfatal (); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
184 void find_entries (); |
240 | 185 void free_tree (); |
186 void getit (); | |
187 void init (); | |
188 void initbuffer (); | |
189 void pfnote (); | |
190 void process_file (); | |
191 void put_entries (); | |
192 void takeprec (); | |
193 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
194 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
195 char searchar = '/'; /* use /.../ searches */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
196 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
197 int lineno; /* line number of current line */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
198 long charno; /* current character number */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
199 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
200 long linecharno; /* charno of start of line; not used by C, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
201 but by every other language. */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
202 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
203 char *curfile; /* current input file name */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
204 char *tagfile; /* output file */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
205 char *progname; /* name this program was invoked with */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
206 char *cwd; /* current working directory */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
207 char *tagfiledir; /* directory of tagfile */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
208 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
209 FILE *tagf; /* ioptr for tags file */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
210 NODE *head; /* the head of the binary tree of tags */ |
240 | 211 |
212 /* | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
213 * A `struct linebuffer' is a structure which holds a line of text. |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
214 * `readline' reads a line from a stream into a linebuffer and works |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
215 * regardless of the length of the line. |
240 | 216 */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
217 struct linebuffer |
240 | 218 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
219 long size; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
220 char *buffer; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
221 }; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
222 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
223 struct linebuffer lb; /* the current line */ |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
224 struct linebuffer token_name; /* used by C_entries as temporary area */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
225 struct |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
226 { |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
227 long linepos; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
228 struct linebuffer lb; /* used by C_entries instead of lb */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
229 } lbs[2]; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
230 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
231 /* boolean "functions" (see init) */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
232 logical _wht[0177], _etk[0177], _itk[0177], _btk[0177]; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
233 char |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
234 *white = " \f\t\n\013", /* white chars */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
235 *endtk = " \t\n\013\"'#()[]{}=-+%*/&|^~!<>;,.:?", /* token ending chars */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
236 /* token starting chars */ |
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
|
237 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~", |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
238 /* valid in-token chars */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
239 *intk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; |
240 | 240 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
241 logical append_to_tagfile; /* -a: append to tags */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
242 /* The following three default to TRUE for etags, but to FALSE for ctags. */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
243 logical typedefs; /* -t: create tags for typedefs */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
244 logical typedefs_and_cplusplus; /* -T: create tags for typedefs, level */ |
240 | 245 /* 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
|
246 /* member functions. */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
247 logical constantypedefs; /* -d: create tags for C #define and enum */ |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
248 /* constants. Enum consts not implemented. */ |
240 | 249 /* -D: opposite of -d. Default under ctags. */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
250 logical update; /* -u: update tags */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
251 logical vgrind_style; /* -v: create vgrind style index output */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
252 logical no_warnings; /* -w: suppress warnings */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
253 logical cxref_style; /* -x: create cxref style output */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
254 logical cplusplus; /* .[hc] means C++, not C */ |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
255 logical noindentypedefs; /* -I: ignore indentation in C */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
256 #define permit_duplicates TRUE /* allow duplicate tags */ |
240 | 257 |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
258 struct option longopts[] = |
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
259 { |
621 | 260 { "append", no_argument, NULL, 'a' }, |
261 { "backward-search", no_argument, NULL, 'B' }, | |
262 { "c++", no_argument, NULL, 'C' }, | |
263 { "cxref", no_argument, NULL, 'x' }, | |
264 { "defines", no_argument, NULL, 'd' }, | |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
265 { "help", no_argument, NULL, 'h' }, |
621 | 266 { "help", no_argument, NULL, 'H' }, |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
267 { "ignore-indentation", no_argument, NULL, 'I' }, |
621 | 268 { "include", required_argument, NULL, 'i' }, |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
269 { "language", required_argument, NULL, 'l' }, |
621 | 270 { "no-defines", no_argument, NULL, 'D' }, |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
271 { "no-regex", no_argument, NULL, 'R' }, |
621 | 272 { "no-warn", no_argument, NULL, 'w' }, |
273 { "output", required_argument, NULL, 'o' }, | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
274 { "regex", required_argument, NULL, 'r' }, |
621 | 275 { "typedefs", no_argument, NULL, 't' }, |
276 { "typedefs-and-c++", no_argument, NULL, 'T' }, | |
277 { "update", no_argument, NULL, 'u' }, | |
278 { "version", no_argument, NULL, 'V' }, | |
279 { "vgrind", no_argument, NULL, 'v' }, | |
280 { 0 } | |
281 }; | |
282 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
283 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
284 /* Structure defining a regular expression. Elements are |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
285 the compiled pattern, and the name string. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
286 struct pattern |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
287 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
288 struct re_pattern_buffer *pattern; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
289 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
|
290 char *name_pattern; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
291 logical error_signaled; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
292 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
293 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
294 /* Number of regexps found. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
295 int num_patterns = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
296 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
297 /* Array of all regexps. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
298 struct pattern *patterns = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
299 #endif /* ETAGS_REGEXPS */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
300 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
301 /* Language stuff. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
302 struct lang_entry |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
303 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
304 char *extension; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
305 Lang_function *function; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
306 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
307 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
308 /* Table of language names and corresponding functions. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
309 /* It is ok for a given function to be listed under more than one |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
310 name. I just didn't. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
311 /* "auto" language reverts to default behavior. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
312 struct lang_entry lang_names[] = |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
313 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
314 { "asm", Asm_labels }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
315 { "c", default_C_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
316 { "c++", Cplusplus_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
317 { "c*", Cstar_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
318 { "fortran", Fortran_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
319 { "lisp", Lisp_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
320 { "none", just_read_file }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
321 { "pascal", Pascal_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
322 { "scheme" , Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
323 { "tex", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
324 { "auto", NULL }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
325 { NULL, NULL } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
326 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
327 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
328 /* Table of file extensions and corresponding language functions. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
329 struct lang_entry lang_extensions[] = |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
330 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
331 /* Assume that ".s" or ".a" is assembly code. -wolfgang. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
332 Or even ".sa". */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
333 { "a", Asm_labels }, /* Unix assembler */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
334 { "asm", Asm_labels }, /* Microcontroller assembly */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
335 { "def", Asm_labels }, /* BSO/Tasking definition includes */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
336 { "inc", Asm_labels }, /* Microcontroller include files */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
337 { "ins", Asm_labels }, /* Microcontroller include files */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
338 { "s", Asm_labels }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
339 { "sa", Asm_labels }, /* Unix assembler */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
340 { "src", Asm_labels }, /* BSO/Tasking C compiler output */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
341 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
342 /* .aux, .bbl, .clo, .cls, .dtx or .tex implies LaTeX source code. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
343 { "aux", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
344 { "bbl", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
345 { "clo", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
346 { "cls", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
347 { "dtx", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
348 { "sty", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
349 { "tex", TeX_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
350 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
351 /* .l or .el or .lisp (or .cl or .clisp or ...) implies lisp source code */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
352 { "cl", Lisp_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
353 { "clisp", Lisp_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
354 { "el", Lisp_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
355 { "l", Lisp_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
356 { "lisp", Lisp_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
357 { "lsp", Lisp_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
358 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
359 /* .scm or .sm or .scheme implies scheme source code */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
360 { "SCM", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
361 { "SM", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
362 { "oak", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
363 { "sch", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
364 { "scheme", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
365 { "scm", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
366 { "sm", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
367 { "t", Scheme_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
368 /* FIXME Can't do the `SCM' or `scm' prefix with a version number */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
369 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
370 /* Note that ".c" and ".h" can be considered C++, if the --c++ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
371 flag was given. That is why default_C_entries is called here. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
372 { "c", default_C_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
373 { "h", default_C_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
374 |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
375 /* .C or .H or .c++ or .cc or .cpp or .cxx or .h++ or .hh or .hxx: |
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
376 a C++ file */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
377 { "C", Cplusplus_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
378 { "H", Cplusplus_entries }, |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
379 { "c++", Cplusplus_entries }, |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
380 { "cc", Cplusplus_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
381 { "cpp", Cplusplus_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
382 { "cxx", Cplusplus_entries }, |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
383 { "h++", Cplusplus_entries }, |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
384 { "hh", Cplusplus_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
385 { "hxx", Cplusplus_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
386 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
387 /* .y: a yacc file */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
388 { "y", Yacc_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
389 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
390 /* .cs or .hs: a C* file */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
391 { "cs", Cstar_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
392 { "hs", Cstar_entries }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
393 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
394 /* .f and .for are FORTRAN. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
395 { "F", Fortran_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
396 { "f", Fortran_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
397 { "for", Fortran_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
398 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
399 /* .pl implies prolog source code */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
400 { "pl", Prolog_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
401 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
402 /* .p or .pas: a Pascal file */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
403 { "p", Pascal_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
404 { "pas", Pascal_functions }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
405 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
406 { NULL, NULL } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
407 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
408 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
409 /* Non-NULL if language fixed. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
410 Lang_function *lang_func = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
411 |
240 | 412 |
413 void | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
414 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
|
415 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
416 struct lang_entry *name, *ext; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
417 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
418 puts ("\nThese are the currently supported languages, along with the\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
419 default extensions for files:"); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
420 for (name = lang_names; name->extension; ++name) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
421 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
422 printf ("\t%s\t", name->extension); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
423 for (ext = lang_extensions; ext->extension; ++ext) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
424 if (name->function == ext->function) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
425 printf (" .%s", ext->extension); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
426 puts (""); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
427 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
428 puts ("Where `auto' means use default language for files based on filename\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
429 extension, and `none' means only do regexp processing on files.\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
430 If no language is specified and no extension is found for some file,\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
431 Fortran is tried first; if no tags are found, C is tried next."); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
432 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
433 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
434 void |
621 | 435 print_version () |
436 { | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
437 #ifdef VERSION |
7049
47965b6c2195
(print_version): Print VERSION as a string.
Richard M. Stallman <rms@gnu.org>
parents:
6945
diff
changeset
|
438 printf ("%s for Emacs version %s.\n", (CTAGS) ? "CTAGS" : "ETAGS", VERSION); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
439 #else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
440 printf ("%s for Emacs version 19.\n", (CTAGS) ? "CTAGS" : "ETAGS"); |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
441 #endif |
621 | 442 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
443 exit (GOOD); |
621 | 444 } |
445 | |
446 void | |
447 print_help () | |
448 { | |
449 printf ("These are the options accepted by %s. You may use unambiguous\n\ | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
450 abbreviations for the long option names. A - as file name means read\n\ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
451 names from stdin.\n\n", progname); |
621 | 452 |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
453 puts ("-a, --append\n\ |
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
454 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
|
455 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
456 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
457 puts ("-B, --backward-search\n\ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
458 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
|
459 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
|
460 |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
461 puts ("-C, --c++\n\ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
462 Treat files whose extension defaults to C language as C++ files."); |
621 | 463 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
464 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
465 puts ("-d, --defines\n\ |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
466 Create tag entries for constant C #defines, too."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
467 else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
468 puts ("-D, --no-defines\n\ |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
469 Don't create tag entries for constant C #defines. This makes\n\ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
470 the tags file smaller."); |
621 | 471 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
472 if (!CTAGS) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
473 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 checking the current file."); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
478 puts ("-l LANG, --language=LANG\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
479 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
|
480 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
|
481 } |
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
482 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
483 #ifdef ETAGS_REGEXPS |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
484 puts ("-r /REGEXP/, --regex=/REGEXP/\n\ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
485 Make a tag for each line matching pattern REGEXP 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
|
486 following files. REGEXP is anchored (as if preceded by ^).\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
487 The form /REGEXP/NAME/ creates a named tag. For example Tcl\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
488 named tags can be created with:\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
489 --regex=/proc[ \\t]+\\([^ \\t]+\\)/\\1/."); |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
490 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
|
491 Don't create tags from regexps for the following files."); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
492 #endif /* ETAGS_REGEXPS */ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
493 puts ("-o FILE, --output=FILE\n\ |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
494 Write the tags to FILE."); |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
495 puts ("-I, --ignore-indentation\n\ |
621 | 496 Don't rely on indentation quite as much as normal. Currently,\n\ |
497 this means not to assume that a closing brace in the first\n\ | |
498 column is the final brace of a function or structure\n\ | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
499 definition in C and C++."); |
621 | 500 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
501 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
502 { |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
503 puts ("-t, --typedefs\n\ |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
504 Generate tag entries for C typedefs."); |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
505 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
|
506 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
|
507 and C++ member functions."); |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
508 puts ("-u, --update\n\ |
621 | 509 Update the tag entries for the given files, leaving tag\n\ |
510 entries for other files in place. Currently, this is\n\ | |
511 implemented by deleting the existing entries for the given\n\ | |
512 files and then rewriting the new entries at the end of the\n\ | |
513 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
|
514 tag file than to use this."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
515 puts ("-v, --vgrind\n\ |
621 | 516 Generates an index of items intended for human consumption,\n\ |
517 similar to the output of vgrind. The index is sorted, and\n\ | |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
518 gives the page number of each item."); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
519 puts ("-w, --no-warn\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
520 Suppress warning messages about entries defined in multiple\n\ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
521 files."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
522 puts ("-x, --cxref\n\ |
621 | 523 Like --vgrind, but in the style of cxref, rather than vgrind.\n\ |
524 The output uses line numbers instead of page numbers, but\n\ | |
525 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
|
526 which you like."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
527 } |
621 | 528 |
529 puts ("-V, --version\n\ | |
530 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
|
531 -h, --help\n\ |
621 | 532 Print this help message."); |
533 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
534 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
|
535 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
536 exit (GOOD); |
621 | 537 } |
538 | |
539 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
540 enum argument_type |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
541 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
542 at_language, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
543 at_regexp, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
544 at_filename |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
545 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
546 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
547 /* This structure helps us allow mixing of --lang and filenames. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
548 typedef struct |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
549 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
550 enum argument_type arg_type; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
551 char *what; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
552 Lang_function *function; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
553 } ARGUMENT; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
554 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
555 #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
|
556 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
557 #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
|
558 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
559 /* 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
|
560 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
|
561 #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
|
562 typedef struct { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
563 short curlen; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
564 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
|
565 } vspec; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
566 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
567 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
568 v1.05 nmm 26-Jun-86 fn_exp - expand specification of list of file names |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
569 returning in each successive call the next filename matching the input |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
570 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
|
571 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
|
572 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
|
573 is returned, the function ignores the value of in_spec, and will |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
574 only start processing a new spec with the following call. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
575 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
|
576 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
|
577 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
578 With each successive filename returned in out_spec, the |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
579 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
|
580 names the function returns zero. If on the first call no file |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
581 matches in_spec, or there is any other error, -1 is returned. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
582 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
583 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
584 #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
|
585 #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
|
586 #define OUTSIZE MAX_FILE_SPEC_LEN |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
587 short |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
588 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
|
589 vspec *out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
590 char *in; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
591 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
592 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
|
593 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
|
594 static struct dsc$descriptor_s i; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
595 static logical pass1 = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
596 long status; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
597 short retval; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
598 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
599 if (pass1) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
600 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
601 pass1 = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
602 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
|
603 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
|
604 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
|
605 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
|
606 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
|
607 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
|
608 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
|
609 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
|
610 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
611 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
|
612 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
613 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
|
614 return 1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
615 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
616 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
|
617 retval = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
618 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
619 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
620 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
|
621 retval = -1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
622 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
623 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
|
624 pass1 = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
625 return retval; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
626 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
627 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
628 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
629 v1.01 nmm 19-Aug-85 gfnames - return in successive calls the |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
630 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
|
631 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
632 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
633 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
|
634 char *arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
635 logical *p_error; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
636 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
637 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
|
638 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
639 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
|
640 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
641 case 1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
642 *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
|
643 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
|
644 case 0: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
645 *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
|
646 return NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
647 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
648 *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
|
649 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
|
650 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
651 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
652 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
653 #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
|
654 system (cmd) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
655 char *cmd; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
656 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
657 fprintf (stderr, "system() function not implemented under VMS\n"); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
658 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
659 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
660 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
661 #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
|
662 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
|
663 char *s; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
664 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
665 char *start = s; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
666 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
667 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
|
668 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
|
669 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
670 *s = EOS; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
671 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
672 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
673 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
674 *s = tolower(*s); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
675 return start; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
676 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
677 #endif /* VMS */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
678 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
679 |
621 | 680 void |
240 | 681 main (argc, argv) |
682 int argc; | |
683 char *argv[]; | |
684 { | |
685 int i; | |
401 | 686 unsigned int nincluded_files = 0; |
4052
9535e8ffb209
* etags.c (alloca): removed all references to it.
Jim Blandy <jimb@redhat.com>
parents:
4051
diff
changeset
|
687 char **included_files = xnew (argc, char *); |
240 | 688 char *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
|
689 ARGUMENT *argbuffer; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
690 int current_arg = 0, file_count = 0; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
691 struct linebuffer filename_lb; |
240 | 692 #ifdef VMS |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
693 logical got_err; |
240 | 694 #endif |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
695 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
696 #ifdef DOS_NT |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
697 _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
|
698 #endif /* DOS_NT */ |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
699 |
240 | 700 progname = argv[0]; |
701 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
702 /* 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
|
703 is small. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
704 argbuffer = xnew (argc, ARGUMENT); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
705 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
706 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
707 /* Set syntax for regular expression routines. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
708 re_set_syntax (RE_SYNTAX_EMACS); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
709 #endif /* ETAGS_REGEXPS */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
710 |
240 | 711 /* |
712 * If etags, always find typedefs and structure tags. Why not? | |
713 * Also default is to find macro constants. | |
714 */ | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
715 if (!CTAGS) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
716 typedefs = typedefs_and_cplusplus = constantypedefs = TRUE; |
240 | 717 |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
718 while (1) |
240 | 719 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
720 int opt = getopt_long (argc, argv, |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
721 "-aCdDf:Il:o:r:RStTi:BuvxwVhH", longopts, 0); |
621 | 722 |
723 if (opt == EOF) | |
724 break; | |
725 | |
726 switch (opt) | |
240 | 727 { |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
728 case 0: |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
729 /* If getopt returns 0, then it has already processed a |
621 | 730 long-named option. We should do nothing. */ |
731 break; | |
240 | 732 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
733 case 1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
734 /* This means that a filename has been seen. Record it. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
735 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
|
736 argbuffer[current_arg].what = optarg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
737 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
738 ++file_count; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
739 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
740 |
621 | 741 /* Common options. */ |
742 case 'a': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
743 append_to_tagfile = TRUE; |
621 | 744 break; |
745 case 'C': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
746 cplusplus = TRUE; |
621 | 747 break; |
748 case 'd': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
749 constantypedefs = TRUE; |
621 | 750 break; |
751 case 'D': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
752 constantypedefs = FALSE; |
621 | 753 break; |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
754 case 'f': /* for compatibility with old makefiles */ |
621 | 755 case 'o': |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
756 if (tagfile) |
621 | 757 { |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
758 fprintf (stderr, "%s: -%c option may only be given once.\n", |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
759 progname, opt); |
240 | 760 goto usage; |
761 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
762 tagfile = optarg; |
621 | 763 break; |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
764 case 'I': |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
765 case 'S': /* for backward compatibility */ |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
766 noindentypedefs = TRUE; |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
767 break; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
768 case 'l': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
769 if (!get_language (optarg, &argbuffer[current_arg].function)) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
770 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
771 fprintf (stderr, "%s: language \"%s\" not recognized.\n", |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
772 progname, optarg); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
773 goto usage; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
774 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
775 argbuffer[current_arg].arg_type = at_language; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
776 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
777 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
778 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
779 case 'r': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
780 argbuffer[current_arg].arg_type = at_regexp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
781 argbuffer[current_arg].what = optarg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
782 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
783 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
784 case 'R': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
785 argbuffer[current_arg].arg_type = at_regexp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
786 argbuffer[current_arg].what = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
787 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
788 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
789 #endif /* ETAGS_REGEXPS */ |
621 | 790 case 'V': |
791 print_version (); | |
792 break; | |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
793 case 'h': |
621 | 794 case 'H': |
795 print_help (); | |
796 break; | |
8180
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
797 case 't': |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
798 typedefs = TRUE; |
8180
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
799 break; |
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
800 case 'T': |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
801 typedefs = typedefs_and_cplusplus = TRUE; |
8180
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
802 break; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
803 #if (!CTAGS) |
621 | 804 /* Etags options */ |
805 case 'i': | |
806 included_files[nincluded_files++] = optarg; | |
807 break; | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
808 #else /* CTAGS */ |
621 | 809 /* Ctags options. */ |
810 case 'B': | |
811 searchar = '?'; | |
812 break; | |
813 case 'u': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
814 update = TRUE; |
621 | 815 break; |
816 case 'v': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
817 vgrind_style = TRUE; |
621 | 818 /*FALLTHRU*/ |
819 case 'x': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
820 cxref_style = TRUE; |
621 | 821 break; |
822 case 'w': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
823 no_warnings = TRUE; |
621 | 824 break; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
825 #endif /* CTAGS */ |
621 | 826 default: |
827 goto usage; | |
240 | 828 } |
829 } | |
830 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
831 for (; optind < argc; ++optind) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
832 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
833 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
|
834 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
|
835 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
836 ++file_count; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
837 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
838 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
839 if (nincluded_files == 0 && file_count == 0) |
240 | 840 { |
621 | 841 fprintf (stderr, "%s: No input files specified.\n", progname); |
842 | |
240 | 843 usage: |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
844 fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n", |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
845 progname); |
240 | 846 exit (BAD); |
847 } | |
848 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
849 if (tagfile == NULL) |
240 | 850 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
851 tagfile = CTAGS ? "tags" : "TAGS"; |
240 | 852 } |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
853 cwd = etags_getcwd (); /* the current working directory */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
854 strcat (cwd, "/"); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
855 if (streq (tagfile, "-")) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
856 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
857 tagfiledir = cwd; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
858 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
859 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
860 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
861 tagfiledir = absolute_dirname (tagfile, cwd); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
862 } |
240 | 863 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
864 init (); /* set up boolean "functions" */ |
240 | 865 |
866 initbuffer (&lb); | |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
867 initbuffer (&token_name); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
868 initbuffer (&lbs[0].lb); |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
869 initbuffer (&lbs[1].lb); |
240 | 870 initbuffer (&filename_lb); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
871 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
872 if (!CTAGS) |
240 | 873 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
874 if (streq (tagfile, "-")) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
875 tagf = stdout; |
240 | 876 else |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
877 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
|
878 if (tagf == NULL) |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
879 pfatal (tagfile); |
240 | 880 } |
881 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
882 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
883 * 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
|
884 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
885 for (i = 0; i < current_arg; ++i) |
240 | 886 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
887 switch (argbuffer[i].arg_type) |
240 | 888 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
889 case at_language: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
890 lang_func = argbuffer[i].function; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
891 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
892 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
893 case at_regexp: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
894 add_regex (argbuffer[i].what); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
895 break; |
240 | 896 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
897 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
|
898 #ifdef VMS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
899 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
|
900 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
901 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
|
902 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
903 error ("Can't find file %s\n", this_file); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
904 argc--, argv++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
905 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
906 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
907 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
908 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
|
909 } |
240 | 910 #else |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
911 this_file = argbuffer[i].what; |
240 | 912 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
913 /* Input file named "-" means read file names from stdin |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
914 and use them. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
915 if (streq (this_file, "-")) |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
916 while (readline_internal (&filename_lb, stdin) > 0) |
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
917 process_file (filename_lb.buffer); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
918 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
919 process_file (this_file); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
920 #ifdef VMS |
240 | 921 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
922 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
923 break; |
240 | 924 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
925 } |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
926 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
927 if (!CTAGS) |
240 | 928 { |
401 | 929 while (nincluded_files-- > 0) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
930 fprintf (tagf, "\f\n%s,include\n", *included_files++); |
401 | 931 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
932 fclose (tagf); |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
933 exit (GOOD); |
240 | 934 } |
935 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
936 /* If CTAGS, we are here. process_file did not write the tags yet, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
937 because we want them ordered. Let's do it now. */ |
240 | 938 if (cxref_style) |
939 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
940 tagf = fopen (tagfile, append_to_tagfile ? "a" : "w"); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
941 if (tagf == NULL) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
942 pfatal (tagfile); |
240 | 943 put_entries (head); |
944 exit (GOOD); | |
945 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
946 |
621 | 947 if (update) |
240 | 948 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
949 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
|
950 for (i = 0; i < current_arg; ++i) |
240 | 951 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
952 if (argbuffer[i].arg_type != at_filename) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
953 continue; |
240 | 954 sprintf (cmd, |
955 "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
|
956 tagfile, argbuffer[i].what, tagfile); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
957 if (system (cmd) != GOOD) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
958 fatal ("failed to execute shell command"); |
240 | 959 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
960 append_to_tagfile = TRUE; |
240 | 961 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
962 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
963 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
|
964 if (tagf == NULL) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
965 pfatal (tagfile); |
240 | 966 put_entries (head); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
967 fclose (tagf); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
968 |
240 | 969 if (update) |
970 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
971 char cmd[BUFSIZ]; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
972 sprintf (cmd, "sort %s -o %s", tagfile, tagfile); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
973 exit (system (cmd)); |
240 | 974 } |
975 exit (GOOD); | |
976 } | |
977 | |
978 | |
979 /* | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
980 * Set the language, given the name. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
981 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
982 logical |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
983 get_language (language, func) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
984 char *language; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
985 Lang_function **func; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
986 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
987 struct lang_entry *lang; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
988 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
989 for (lang = lang_names; lang->extension; ++lang) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
990 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
991 if (streq (language, lang->extension)) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
992 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
993 *func = lang->function; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
994 return TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
995 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
996 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
997 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
998 return FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
999 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1000 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1001 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1002 /* |
240 | 1003 * This routine is called on each file argument. |
1004 */ | |
1005 void | |
1006 process_file (file) | |
1007 char *file; | |
1008 { | |
1009 struct stat stat_buf; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1010 FILE *inf; |
240 | 1011 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1012 if (stat (file, &stat_buf) == 0 && !S_ISREG (stat_buf.st_mode)) |
240 | 1013 { |
1014 fprintf (stderr, "Skipping %s: it is not a regular file.\n", file); | |
1015 return; | |
1016 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1017 if (streq (file, tagfile) && !streq (tagfile, "-")) |
240 | 1018 { |
1019 fprintf (stderr, "Skipping inclusion of %s in self.\n", file); | |
1020 return; | |
1021 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1022 inf = fopen (file, "r"); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1023 if (inf == NULL) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1024 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1025 perror (file); |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1026 return; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1027 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1028 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1029 find_entries (file, inf); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1030 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1031 if (!CTAGS) |
240 | 1032 { |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1033 char *filename; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1034 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1035 if (file[0] == '/') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1036 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1037 /* file is an absolute filename. Canonicalise it. */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1038 filename = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1039 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1040 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1041 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1042 /* file is a filename relative to cwd. Make it relative |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1043 to the directory of the tags file. */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1044 filename = relative_filename (file, tagfiledir); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1045 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1046 fprintf (tagf, "\f\n%s,%d\n", filename, total_size_of_entries (head)); |
240 | 1047 put_entries (head); |
1048 free_tree (head); | |
1049 head = NULL; | |
1050 } | |
1051 } | |
1052 | |
1053 /* | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3569
diff
changeset
|
1054 * This routine sets up the boolean pseudo-functions which work |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1055 * by setting boolean flags dependent upon the corresponding character |
240 | 1056 * Every char which is NOT in that string is not a white char. Therefore, |
1057 * all of the array "_wht" is set to FALSE, and then the elements | |
1058 * subscripted by the chars in "white" are set to TRUE. Thus "_wht" | |
1059 * of a char is TRUE if it is the string "white", else FALSE. | |
1060 */ | |
1061 void | |
1062 init () | |
1063 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1064 register char *sp; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1065 register int i; |
240 | 1066 |
1067 for (i = 0; i < 0177; i++) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1068 _wht[i] = _etk[i] = _itk[i] = _btk[i] = FALSE; |
240 | 1069 for (sp = white; *sp; sp++) |
1070 _wht[*sp] = TRUE; | |
1071 for (sp = endtk; *sp; sp++) | |
1072 _etk[*sp] = TRUE; | |
1073 for (sp = intk; *sp; sp++) | |
1074 _itk[*sp] = TRUE; | |
1075 for (sp = begtk; *sp; sp++) | |
1076 _btk[*sp] = TRUE; | |
1077 _wht[0] = _wht['\n']; | |
1078 _etk[0] = _etk['\n']; | |
1079 _btk[0] = _btk['\n']; | |
1080 _itk[0] = _itk['\n']; | |
1081 } | |
1082 | |
1083 /* | |
1084 * This routine opens the specified file and calls the function | |
1085 * which finds the function and type definitions. | |
1086 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1087 void |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1088 find_entries (file, inf) |
240 | 1089 char *file; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1090 FILE *inf; |
240 | 1091 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1092 char *cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1093 struct lang_entry *lang; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1094 NODE *old_last_node; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1095 extern NODE *last_node; |
240 | 1096 |
1097 curfile = savestr (file); | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
1098 cp = etags_strrchr (file, '.'); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1099 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1100 /* If user specified a language, use it. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1101 if (lang_func != NULL) |
240 | 1102 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1103 lang_func (inf); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1104 fclose (inf); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1105 return; |
240 | 1106 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1107 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1108 if (cp) |
240 | 1109 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1110 ++cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1111 for (lang = lang_extensions; lang->extension; ++lang) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1112 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1113 if (streq (cp, lang->extension)) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1114 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1115 lang->function (inf); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1116 fclose (inf); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1117 return; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1118 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1119 } |
240 | 1120 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1121 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1122 /* Try Fortran. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1123 old_last_node = last_node; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1124 Fortran_functions (inf); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1125 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1126 /* No Fortran entries found. Try C. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1127 if (old_last_node == last_node) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1128 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
|
1129 fclose (inf); |
240 | 1130 } |
1131 | |
1132 /* Record a tag. */ | |
1133 void | |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
1134 pfnote (name, is_func, named, linestart, linelen, lno, cno) |
240 | 1135 char *name; /* tag name */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1136 logical is_func; /* tag is a function */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1137 logical named; /* tag different from text of definition */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1138 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
|
1139 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
|
1140 int lno; /* line number */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1141 long cno; /* character number */ |
240 | 1142 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1143 register NODE *np = xnew (1, NODE); |
240 | 1144 register char *fp; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1145 |
240 | 1146 /* 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
|
1147 if (CTAGS && !cxref_style && streq (name, "main")) |
240 | 1148 { |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
1149 fp = etags_strrchr (curfile, '/'); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1150 np->name = concat ("M", fp == 0 ? curfile : fp + 1, ""); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1151 fp = etags_strrchr (np->name, '.'); |
240 | 1152 if (fp && fp[1] != '\0' && fp[2] == '\0') |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1153 fp[0] = 0; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1154 np->named = TRUE; |
240 | 1155 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1156 else |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1157 { |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1158 np->name = name; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1159 np->named = named; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1160 } |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
1161 np->been_warned = FALSE; |
240 | 1162 np->file = curfile; |
1163 np->is_func = is_func; | |
1164 np->lno = lno; | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1165 /* Our char numbers are 0-base, because of C language tradition? |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1166 ctags compatibility? old versions compatibility? I don't know. |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1167 Anyway, since emacs's are 1-base we espect etags.el to take care |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1168 of the difference. If we wanted to have 1-based numbers, we would |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1169 uncomment the +1 below. */ |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1170 np->cno = cno /* + 1 */ ; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1171 np->left = np->right = NULL; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1172 np->pat = savenstr (linestart, ((CTAGS && !cxref_style) ? 50 : linelen)); |
240 | 1173 |
1174 add_node (np, &head); | |
1175 } | |
1176 | |
1177 /* | |
1178 * free_tree () | |
1179 * recurse on left children, iterate on right children. | |
1180 */ | |
1181 void | |
1182 free_tree (node) | |
1183 register NODE *node; | |
1184 { | |
1185 while (node) | |
1186 { | |
1187 register NODE *node_right = node->right; | |
1188 free_tree (node->left); | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1189 if (node->named) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1190 free (node->name); |
240 | 1191 free (node->pat); |
1192 free ((char *) node); | |
1193 node = node_right; | |
1194 } | |
1195 } | |
1196 | |
1197 /* | |
1198 * add_node () | |
1199 * Adds a node to the tree of nodes. In etags mode, we don't keep | |
1200 * it sorted; we just keep a linear list. In ctags mode, maintain | |
1201 * an ordered tree, with no attempt at balancing. | |
1202 * | |
1203 * add_node is the only function allowed to add nodes, so it can | |
1204 * maintain state. | |
1205 */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1206 NODE *last_node = NULL; |
240 | 1207 void |
1208 add_node (node, cur_node_p) | |
1209 NODE *node, **cur_node_p; | |
1210 { | |
1211 register int dif; | |
1212 register NODE *cur_node = *cur_node_p; | |
1213 | |
1214 if (cur_node == NULL) | |
1215 { | |
1216 *cur_node_p = node; | |
1217 last_node = node; | |
1218 return; | |
1219 } | |
1220 | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1221 if (!CTAGS) |
240 | 1222 { |
1223 /* Etags Mode */ | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1224 if (last_node == NULL) |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1225 fatal ("internal error in add_node", 0); |
240 | 1226 last_node->right = node; |
1227 last_node = node; | |
1228 } | |
1229 else | |
1230 { | |
1231 /* Ctags Mode */ | |
1232 dif = strcmp (node->name, cur_node->name); | |
1233 | |
1234 /* | |
1235 * If this tag name matches an existing one, then | |
1236 * do not add the node, but maybe print a warning. | |
1237 */ | |
1238 if (!dif) | |
1239 { | |
1240 if (node->file == cur_node->file) | |
1241 { | |
1242 if (!no_warnings) | |
1243 { | |
1244 fprintf (stderr, "Duplicate entry in file %s, line %d: %s\n", | |
1245 node->file, lineno, node->name); | |
1246 fprintf (stderr, "Second entry ignored\n"); | |
1247 } | |
1248 return; | |
1249 } | |
1250 if (!cur_node->been_warned && !no_warnings) | |
1251 { | |
1252 fprintf (stderr, | |
1253 "Duplicate entry in files %s and %s: %s (Warning only)\n", | |
1254 node->file, cur_node->file, node->name); | |
1255 } | |
1256 cur_node->been_warned = TRUE; | |
1257 return; | |
1258 } | |
1259 | |
1260 /* Maybe refuse to add duplicate nodes. */ | |
1261 if (!permit_duplicates) | |
1262 { | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1263 if (streq (node->name, cur_node->name) |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1264 && streq (node->file, cur_node->file)) |
240 | 1265 return; |
1266 } | |
1267 | |
1268 /* Actually add the node */ | |
1269 add_node (node, dif < 0 ? &cur_node->left : &cur_node->right); | |
1270 } | |
1271 } | |
1272 | |
1273 void | |
1274 put_entries (node) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1275 register NODE *node; |
240 | 1276 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1277 register char *sp; |
240 | 1278 |
1279 if (node == NULL) | |
1280 return; | |
1281 | |
1282 /* Output subentries that precede this one */ | |
1283 put_entries (node->left); | |
1284 | |
1285 /* Output this entry */ | |
1286 | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1287 if (!CTAGS) |
240 | 1288 { |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
1289 if (node->named) |
240 | 1290 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1291 fprintf (tagf, "%s\177%s\001%d,%d\n", |
4406
ad13aac8bb60
(put_entries): For NODE->rewritten, put pattern before \177 and name after,
Roland McGrath <roland@gnu.org>
parents:
4126
diff
changeset
|
1292 node->pat, node->name, |
ad13aac8bb60
(put_entries): For NODE->rewritten, put pattern before \177 and name after,
Roland McGrath <roland@gnu.org>
parents:
4126
diff
changeset
|
1293 node->lno, node->cno); |
240 | 1294 } |
1295 else | |
1296 { | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1297 fprintf (tagf, "%s\177%d,%d\n", |
4406
ad13aac8bb60
(put_entries): For NODE->rewritten, put pattern before \177 and name after,
Roland McGrath <roland@gnu.org>
parents:
4126
diff
changeset
|
1298 node->pat, |
ad13aac8bb60
(put_entries): For NODE->rewritten, put pattern before \177 and name after,
Roland McGrath <roland@gnu.org>
parents:
4126
diff
changeset
|
1299 node->lno, node->cno); |
240 | 1300 } |
1301 } | |
1302 else if (!cxref_style) | |
1303 { | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1304 fprintf (tagf, "%s\t%s\t", |
240 | 1305 node->name, node->file); |
1306 | |
1307 if (node->is_func) | |
1308 { /* a function */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1309 putc (searchar, tagf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1310 putc ('^', tagf); |
240 | 1311 |
1312 for (sp = node->pat; *sp; sp++) | |
1313 { | |
1314 if (*sp == '\\' || *sp == searchar) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1315 putc ('\\', tagf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1316 putc (*sp, tagf); |
240 | 1317 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1318 putc (searchar, tagf); |
240 | 1319 } |
1320 else | |
1321 { /* a typedef; text pattern inadequate */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1322 fprintf (tagf, "%d", node->lno); |
240 | 1323 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1324 putc ('\n', tagf); |
240 | 1325 } |
1326 else if (vgrind_style) | |
1327 fprintf (stdout, "%s %s %d\n", | |
1328 node->name, node->file, (node->lno + 63) / 64); | |
1329 else | |
727 | 1330 fprintf (stdout, "%-16s %3d %-16s %s\n", |
240 | 1331 node->name, node->lno, node->file, node->pat); |
1332 | |
1333 /* Output subentries that follow this one */ | |
1334 put_entries (node->right); | |
1335 } | |
1336 | |
1337 /* Length of a number's decimal representation. */ | |
1338 int | |
1339 number_len (num) | |
1340 long num; | |
1341 { | |
1342 int len = 0; | |
1343 if (!num) | |
1344 return 1; | |
1345 for (; num; num /= 10) | |
1346 ++len; | |
1347 return len; | |
1348 } | |
1349 | |
1350 /* | |
1351 * Return total number of characters that put_entries will output for | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1352 * the nodes in the subtree of the specified node. Works only if |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1353 * we are not ctags, but called only in that case. This count |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1354 * is irrelevant with the new tags.el, but is still supplied for |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1355 * backward compatibility. |
240 | 1356 */ |
1357 int | |
1358 total_size_of_entries (node) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1359 register NODE *node; |
240 | 1360 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1361 register int total; |
240 | 1362 |
1363 if (node == NULL) | |
1364 return 0; | |
1365 | |
1366 total = 0; | |
1367 for (; node; node = node->right) | |
1368 { | |
1369 /* Count left subentries. */ | |
1370 total += total_size_of_entries (node->left); | |
1371 | |
1372 /* Count this entry */ | |
1373 total += strlen (node->pat) + 1; | |
1374 total += number_len ((long) node->lno) + 1 + number_len (node->cno) + 1; | |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
1375 if (node->named) |
240 | 1376 total += 1 + strlen (node->name); /* \001name */ |
1377 } | |
1378 | |
1379 return total; | |
1380 } | |
1381 | |
1382 /* | |
1383 * The C symbol tables. | |
1384 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1385 enum sym_type |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1386 { |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1387 st_none, st_C_struct, st_C_enum, st_C_define, st_C_typedef, st_C_typespec |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1388 }; |
240 | 1389 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1390 /* Feed stuff between (but not including) %[ and %] lines to: |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1391 gperf -c -k1,3 -o -p -r -t |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1392 %[ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1393 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
|
1394 %% |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1395 class, C_PLPL, st_C_struct |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1396 domain, C_STAR, st_C_struct |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1397 union, 0, st_C_struct |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1398 struct, 0, st_C_struct |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1399 enum, 0, st_C_enum |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1400 typedef, 0, st_C_typedef |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1401 define, 0, st_C_define |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1402 long, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1403 short, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1404 int, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1405 char, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1406 float, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1407 double, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1408 signed, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1409 unsigned, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1410 auto, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1411 void, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1412 extern, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1413 static, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1414 const, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1415 volatile, 0, st_C_typespec |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1416 %] |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1417 and replace lines between %< and %> with its output. */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1418 /*%<*/ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1419 /* C code produced by gperf version 1.8.1 (K&R C version) */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1420 /* Command-line: gperf -c -k1,3 -o -p -r -t */ |
240 | 1421 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1422 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1423 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
|
1424 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1425 #define MIN_WORD_LENGTH 3 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1426 #define MAX_WORD_LENGTH 8 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1427 #define MIN_HASH_VALUE 10 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1428 #define MAX_HASH_VALUE 62 |
240 | 1429 /* |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1430 21 keywords |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1431 53 is the maximum key range |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1432 */ |
240 | 1433 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1434 static int |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1435 hash (str, len) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1436 register char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1437 register int len; |
240 | 1438 { |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1439 static unsigned char hash_table[] = |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1440 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1441 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1442 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1443 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1444 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1445 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1446 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1447 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1448 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1449 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1450 62, 62, 62, 62, 62, 62, 62, 2, 62, 7, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1451 6, 9, 15, 30, 62, 24, 62, 62, 1, 24, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1452 7, 27, 13, 62, 19, 26, 18, 27, 1, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1453 62, 62, 62, 62, 62, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1454 }; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1455 return len + hash_table[str[2]] + hash_table[str[0]]; |
240 | 1456 } |
1457 | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1458 struct C_stab_entry * |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1459 in_word_set (str, len) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1460 register char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1461 register int len; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1462 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1463 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1464 static struct C_stab_entry wordlist[] = |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1465 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1466 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1467 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1468 {"volatile", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1469 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1470 {"long", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1471 {"char", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1472 {"class", C_PLPL, st_C_struct}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1473 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1474 {"const", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1475 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1476 {"auto", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1477 {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1478 {"define", 0, st_C_define}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1479 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1480 {"void", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1481 {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1482 {"extern", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1483 {"static", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1484 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1485 {"domain", C_STAR, st_C_struct}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1486 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1487 {"typedef", 0, st_C_typedef}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1488 {"double", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1489 {"enum", 0, st_C_enum}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1490 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1491 {"int", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1492 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1493 {"float", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1494 {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1495 {"struct", 0, st_C_struct}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1496 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1497 {"union", 0, st_C_struct}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1498 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1499 {"short", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1500 {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1501 {"unsigned", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1502 {"signed", 0, st_C_typespec}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1503 }; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1504 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1505 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
|
1506 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1507 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
|
1508 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1509 if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1510 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1511 register char *s = wordlist[key].name; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1512 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1513 if (*s == *str && strneq (str + 1, s + 1, len - 1)) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1514 return &wordlist[key]; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1515 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1516 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1517 return 0; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1518 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1519 /*%>*/ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1520 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1521 enum sym_type |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1522 C_symtype(str, len, c_ext) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1523 char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1524 int len; |
240 | 1525 int c_ext; |
1526 { | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1527 register struct C_stab_entry *se = in_word_set(str, len); |
240 | 1528 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1529 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
|
1530 return st_none; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1531 return se->type; |
240 | 1532 } |
1533 | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1534 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1535 * C functions are recognized using a simple finite automaton. |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1536 * funcdef is its state variable. |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1537 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1538 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1539 { |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1540 fnone, /* nothing seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1541 ftagseen, /* function-like tag seen */ |
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
|
1542 fstartlist, /* just after open parenthesis */ |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1543 finlist, /* in parameter list */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1544 flistseen, /* after parameter list */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
1545 fignore /* before open brace */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1546 } FUNCST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1547 FUNCST funcdef; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1548 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1549 |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1550 /* |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1551 * typedefs are recognized using a simple finite automaton. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1552 * typeddef is its state variable. |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1553 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1554 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1555 { |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1556 tnone, /* nothing seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1557 ttypedseen, /* typedef keyword seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1558 tinbody, /* inside typedef body */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1559 tend, /* just before typedef tag */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1560 tignore /* junk after typedef tag */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1561 } TYPEDST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1562 TYPEDST typdef; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1563 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1564 |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1565 /* |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1566 * struct-like structures (enum, struct and union) are recognized |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1567 * using another simple finite automaton. `structdef' is its state |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1568 * variable. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1569 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1570 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1571 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1572 snone, /* nothing seen yet */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1573 skeyseen, /* struct-like keyword seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1574 stagseen, /* struct-like tag seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1575 scolonseen, /* colon seen after struct-like tag */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
1576 sinbody /* in struct body: recognize member func defs*/ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1577 } STRUCTST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1578 STRUCTST structdef; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1579 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1580 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1581 * When structdef is stagseen, scolonseen, or sinbody, structtag is the |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1582 * struct tag, and structtype is the type of the preceding struct-like |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1583 * keyword. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1584 */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1585 char *structtag = "<uninited>"; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1586 enum sym_type structtype; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1587 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1588 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1589 * 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
|
1590 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1591 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1592 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1593 dnone, /* nothing seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1594 dsharpseen, /* '#' seen as first char on line */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1595 ddefineseen, /* '#' and 'define' seen */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
1596 dignorerest /* ignore rest of line */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1597 } DEFINEST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1598 DEFINEST definedef; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1599 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1600 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1601 * Set this to TRUE, and the next token considered is called a function. |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
1602 * Used only for GNU emacs's function-defining macros. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1603 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1604 logical next_token_is_func; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1605 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1606 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1607 * TRUE in the rules part of a yacc file, FALSE outside (parse as C). |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1608 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1609 logical yacc_rules; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1610 |
240 | 1611 /* |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1612 * consider_token () |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1613 * checks to see if the current token is at the start of a |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1614 * function, or corresponds to a typedef, or is a struct/union/enum |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1615 * tag. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1616 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1617 * *IS_FUNC gets TRUE iff the token is a function or macro with args. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1618 * C_EXT is which language we are looking at. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1619 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1620 * In the future we will need some way to adjust where the end of |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1621 * the token is; for instance, implementing the C++ keyword |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1622 * `operator' properly will adjust the end of the token to be after |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1623 * whatever follows `operator'. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1624 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1625 * Globals |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1626 * funcdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1627 * structdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1628 * definedef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1629 * typdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1630 * next_token_is_func IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1631 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1632 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1633 logical |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1634 consider_token (str, len, c, c_ext, cblev, is_func) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1635 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
|
1636 register int len; /* IN: token length */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1637 register char c; /* IN: first char after the token */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1638 int c_ext; /* IN: C extensions mask */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1639 int cblev; /* IN: curly brace level */ |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1640 logical *is_func; /* OUT: function found */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1641 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1642 enum sym_type toktype = C_symtype (str, len, c_ext); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1643 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1644 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1645 * Advance the definedef state machine. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1646 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1647 switch (definedef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1648 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1649 case dnone: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1650 /* We're not on a preprocessor line. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1651 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1652 case dsharpseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1653 if (toktype == st_C_define) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1654 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1655 definedef = ddefineseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1656 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1657 else |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1658 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1659 definedef = dignorerest; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1660 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1661 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1662 case ddefineseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1663 /* |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
1664 * Make a tag for any macro, unless it is a constant |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
1665 * and constantypedefs is FALSE. |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1666 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1667 definedef = dignorerest; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1668 *is_func = (c == '('); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1669 if (!*is_func && !constantypedefs) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1670 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1671 else |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1672 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1673 case dignorerest: |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1674 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1675 default: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1676 error ("internal error: definedef value.", 0); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1677 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1678 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1679 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1680 * Now typedefs |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1681 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1682 switch (typdef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1683 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1684 case tnone: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1685 if (toktype == st_C_typedef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1686 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1687 if (typedefs) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1688 typdef = ttypedseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1689 funcdef = fnone; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1690 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1691 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1692 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1693 case ttypedseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1694 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1695 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1696 case st_none: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1697 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1698 typdef = tend; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1699 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1700 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1701 case st_C_enum: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1702 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1703 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1704 /* Do not return here, so the structdef stuff has a chance. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1705 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1706 case tend: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1707 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1708 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1709 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1710 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1711 case st_C_enum: |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1712 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1713 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1714 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1715 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1716 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1717 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1718 * This structdef business is currently only invoked when cblev==0. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1719 * It should be recursively invoked whatever the curly brace level, |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1720 * and a stack of states kept, to allow for definitions of structs |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1721 * within structs. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1722 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1723 * This structdef business is NOT invoked when we are ctags and the |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1724 * file is plain C. This is because a struct tag may have the same |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1725 * name as another tag, and this loses with ctags. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1726 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1727 * This if statement deals with the typdef state machine as |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1728 * follows: if typdef==ttypedseen and token is struct/union/class/enum, |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1729 * return FALSE. All the other code here is for the structdef |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1730 * state machine. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1731 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1732 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1733 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1734 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1735 case st_C_enum: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1736 if (typdef == ttypedseen |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1737 || (typedefs_and_cplusplus && cblev == 0 && structdef == snone)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1738 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1739 structdef = skeyseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1740 structtype = toktype; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1741 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1742 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1743 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1744 if (structdef == skeyseen) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1745 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1746 /* Save the tag for struct/union/class, for functions that may be |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1747 defined inside. */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1748 if (structtype == st_C_struct) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1749 structtag = savenstr (str, len); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1750 else |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1751 structtag = "<enum>"; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1752 structdef = stagseen; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1753 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1754 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1755 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1756 /* Avoid entering funcdef stuff if typdef is going on. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1757 if (typdef != tnone) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1758 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1759 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
|
1760 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1761 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1762 |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1763 /* Detect GNU macros. */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1764 if (definedef == dnone) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1765 if (strneq (str, "DEFUN", 5) /* Used in emacs */ |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1766 #if FALSE |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1767 These are defined inside C functions, so currently they |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1768 are not met anyway. |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1769 || strneq (str, "EXFUN", 5) /* Used in glibc */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1770 || strneq (str, "DEFVAR_", 7) /* Used in emacs */ |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1771 #endif |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1772 || strneq (str, "SYSCALL", 7) /* Used in glibc (mach) */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1773 || strneq (str, "ENTRY", 5) /* Used in glibc */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1774 || strneq (str, "PSEUDO", 6)) /* Used in glibc */ |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1775 |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1776 { |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1777 next_token_is_func = TRUE; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1778 return FALSE; |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1779 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1780 if (next_token_is_func) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1781 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1782 next_token_is_func = FALSE; |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1783 funcdef = fignore; |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1784 *is_func = TRUE; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1785 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1786 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1787 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1788 /* A function? */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1789 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1790 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1791 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1792 if (funcdef != finlist && funcdef != fignore) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1793 funcdef = fnone; /* should be useless */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1794 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1795 default: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1796 if (funcdef == fnone) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1797 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1798 funcdef = ftagseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1799 *is_func = TRUE; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1800 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1801 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1802 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1803 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1804 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1805 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1806 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1807 /* |
240 | 1808 * C_entries () |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1809 * This routine finds functions, typedefs, #define's and |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1810 * struct/union/enum definitions in C syntax and adds them |
240 | 1811 * to the list. |
1812 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1813 typedef struct |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1814 { |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1815 logical valid; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1816 char *str; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1817 logical named; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1818 int linelen; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1819 int lineno; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
1820 long linepos; |
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
1821 char *buffer; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1822 } TOKEN; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1823 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1824 #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
|
1825 #define switch_line_buffers() (curndx = 1 - curndx) |
240 | 1826 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1827 #define curlb (lbs[curndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1828 #define othlb (lbs[1-curndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1829 #define newlb (lbs[newndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1830 #define curlinepos (lbs[curndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1831 #define othlinepos (lbs[1-curndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1832 #define newlinepos (lbs[newndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1833 |
240 | 1834 #define CNL_SAVE_DEFINEDEF \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1835 do { \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1836 curlinepos = charno; \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1837 lineno++; \ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1838 charno += readline (&curlb, inf); \ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1839 lp = curlb.buffer; \ |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1840 quotednl = FALSE; \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1841 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
|
1842 } while (0) |
240 | 1843 |
1844 #define CNL \ | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1845 do { \ |
240 | 1846 CNL_SAVE_DEFINEDEF; \ |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1847 if (savetok.valid) \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1848 { \ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1849 tok = savetok; \ |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1850 savetok.valid = FALSE; \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1851 } \ |
240 | 1852 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
|
1853 } while (0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1854 |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1855 #define make_tag(isfun) do \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1856 { \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1857 if (tok.valid) \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1858 pfnote (savestr (token_name.buffer), isfun, tok.named, \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1859 tok.buffer, tok.linelen, tok.lineno, tok.linepos); \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1860 else if (DEBUG) abort (); \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1861 tok.valid = FALSE; \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1862 } while (0) |
240 | 1863 |
1864 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1865 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
|
1866 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
|
1867 FILE *inf; /* input file */ |
240 | 1868 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1869 register char c; /* latest char read; '\0' for end of line */ |
240 | 1870 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
|
1871 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
|
1872 TOKEN tok; /* latest token read */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1873 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
|
1874 register int toklen; /* length of current token */ |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
1875 int cblev; /* current curly brace level */ |
4937
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
1876 int parlev; /* current parenthesis level */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1877 logical incomm, inquote, inchar, quotednl, midtoken; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1878 logical cplpl; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1879 TOKEN savetok; /* token saved during preprocessor handling */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1880 |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1881 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1882 curndx = newndx = 0; |
240 | 1883 lineno = 0; |
1884 charno = 0; | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1885 lp = curlb.buffer; |
240 | 1886 *lp = 0; |
1887 | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1888 definedef = dnone; funcdef = fnone; typdef = tnone; structdef = snone; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1889 next_token_is_func = yacc_rules = FALSE; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1890 midtoken = inquote = inchar = incomm = quotednl = FALSE; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1891 tok.valid = savetok.valid = FALSE; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
1892 cblev = 0; |
4937
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
1893 parlev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1894 cplpl = c_ext & C_PLPL; |
240 | 1895 |
1896 while (!feof (inf)) | |
1897 { | |
1898 c = *lp++; | |
1899 if (c == '\\') | |
1900 { | |
621 | 1901 /* If we're at the end of the line, the next character is a |
1902 '\0'; don't skip it, because it's the thing that tells us | |
1903 to read the next line. */ | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1904 if (*lp == '\0') |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1905 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1906 quotednl = TRUE; |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1907 continue; |
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1908 } |
401 | 1909 lp++; |
240 | 1910 c = ' '; |
1911 } | |
1912 else if (incomm) | |
1913 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1914 switch (c) |
240 | 1915 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1916 case '*': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1917 if (*lp == '/') |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1918 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1919 c = *lp++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1920 incomm = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1921 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1922 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1923 case '\0': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1924 /* 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
|
1925 traditional cpp. */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1926 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1927 break; |
240 | 1928 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1929 continue; |
240 | 1930 } |
1931 else if (inquote) | |
1932 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1933 switch (c) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1934 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1935 case '"': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1936 inquote = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1937 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1938 case '\0': |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1939 /* 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
|
1940 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
|
1941 usually accept them. */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1942 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1943 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1944 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1945 continue; |
240 | 1946 } |
1947 else if (inchar) | |
1948 { | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1949 switch (c) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1950 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1951 case '\0': |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1952 /* Hmmm, something went wrong. */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1953 CNL; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1954 /* FALLTHRU */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1955 case '\'': |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1956 inchar = FALSE; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1957 break; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1958 } |
240 | 1959 continue; |
1960 } | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1961 else |
240 | 1962 switch (c) |
1963 { | |
1964 case '"': | |
1965 inquote = TRUE; | |
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
|
1966 if (funcdef != finlist && funcdef != fignore) |
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
|
1967 funcdef = fnone; |
240 | 1968 continue; |
1969 case '\'': | |
1970 inchar = TRUE; | |
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
|
1971 if (funcdef != finlist && funcdef != fignore) |
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
|
1972 funcdef = fnone; |
240 | 1973 continue; |
1974 case '/': | |
1975 if (*lp == '*') | |
1976 { | |
1977 lp++; | |
1978 incomm = TRUE; | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1979 continue; |
240 | 1980 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1981 else if (cplpl && *lp == '/') |
240 | 1982 { |
727 | 1983 c = 0; |
1984 break; | |
240 | 1985 } |
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
|
1986 else |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
1987 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1988 case '%': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1989 if ((c_ext & YACC) && *lp == '%') |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1990 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1991 /* entering or exiting rules section in yacc file */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1992 lp++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1993 definedef = dnone; funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1994 typdef = tnone; structdef = snone; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1995 next_token_is_func = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1996 midtoken = inquote = inchar = incomm = quotednl = FALSE; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
1997 cblev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1998 yacc_rules = !yacc_rules; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1999 continue; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2000 } |
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
|
2001 else |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2002 break; |
240 | 2003 case '#': |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2004 if (definedef == dnone) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2005 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2006 char *cp; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2007 logical cpptoken = TRUE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2008 |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2009 /* Look back on this line. If all blanks, or nonblanks |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2010 followed by an end of comment, this is a preprocessor |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2011 token. */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2012 for (cp = newlb.buffer; cp < lp-1; cp++) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2013 if (!iswhite (*cp)) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2014 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2015 if (*cp == '*' && *(cp+1) == '/') |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2016 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2017 cp++; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2018 cpptoken = TRUE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2019 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2020 else |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2021 cpptoken = FALSE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2022 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2023 if (cpptoken) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2024 definedef = dsharpseen; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2025 } /* if (definedef == dnone) */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2026 |
240 | 2027 continue; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2028 } /* switch (c) */ |
240 | 2029 |
2030 | |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2031 /* Consider token only if some complicated conditions are satisfied. */ |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2032 if ((definedef != dnone |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2033 || (cblev == 0 && structdef != scolonseen) |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2034 || (cblev == 1 && cplpl && structdef == sinbody)) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2035 && typdef != tignore |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2036 && definedef != dignorerest |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2037 && funcdef != finlist) |
240 | 2038 { |
2039 if (midtoken) | |
2040 { | |
2041 if (endtoken (c)) | |
2042 { | |
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
|
2043 if (cplpl && c == ':' && *lp == ':' && begtoken(*(lp + 1))) |
240 | 2044 { |
2045 /* | |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2046 * This handles :: in the middle, but not at the |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2047 * beginning of an identifier. |
240 | 2048 */ |
2049 lp += 2; | |
2050 toklen += 3; | |
2051 } | |
2052 else | |
2053 { | |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2054 logical is_func = FALSE; |
240 | 2055 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2056 if (yacc_rules |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2057 || consider_token (newlb.buffer + tokoff, toklen, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2058 c, c_ext, cblev, &is_func)) |
240 | 2059 { |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
2060 if (structdef == sinbody |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2061 && definedef == dnone |
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2062 && is_func) |
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2063 /* function defined in C++ class body */ |
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2064 { |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2065 int strsize = strlen(structtag) + 2 + toklen + 1; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2066 while (token_name.size < strsize) |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2067 { |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2068 token_name.size *= 2; |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2069 token_name.buffer=xrealloc(token_name.buffer, |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2070 token_name.size); |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2071 } |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2072 strcpy (token_name.buffer, structtag); |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2073 strcat (token_name.buffer, "::"); |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2074 strncat (token_name.buffer, |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2075 newlb.buffer+tokoff, toklen); |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2076 tok.named = TRUE; |
240 | 2077 } |
2078 else | |
2079 { | |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2080 while (token_name.size < toklen + 1) |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2081 { |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2082 token_name.size *= 2; |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2083 token_name.buffer=xrealloc(token_name.buffer, |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2084 token_name.size); |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2085 } |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2086 strncpy (token_name.buffer, |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2087 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
|
2088 token_name.buffer[toklen] = '\0'; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2089 if (structdef == stagseen |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2090 || typdef == tend |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2091 || (is_func |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2092 && definedef == dignorerest)) /* macro */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2093 tok.named = TRUE; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2094 else |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2095 tok.named = FALSE; |
240 | 2096 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2097 tok.lineno = lineno; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2098 tok.linelen = tokoff + toklen + 1; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2099 tok.buffer = newlb.buffer; |
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2100 tok.linepos = newlinepos; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2101 tok.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
|
2102 |
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
|
2103 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
|
2104 && (funcdef == ftagseen |
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
|
2105 || structdef == stagseen |
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
|
2106 || typdef == tend)) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2107 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2108 if (current_lb_is_new) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2109 switch_line_buffers (); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2110 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2111 else |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2112 make_tag (is_func); |
240 | 2113 } |
2114 midtoken = FALSE; | |
2115 } | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2116 } /* if (endtoken (c)) */ |
240 | 2117 else if (intoken (c)) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2118 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2119 toklen++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2120 continue; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2121 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2122 } /* if (midtoken) */ |
240 | 2123 else if (begtoken (c)) |
2124 { | |
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
|
2125 switch (definedef) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2126 { |
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
|
2127 case 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
|
2128 switch (funcdef) |
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
|
2129 { |
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
|
2130 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
|
2131 funcdef = finlist; |
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
|
2132 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
|
2133 case flistseen: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2134 make_tag (TRUE); |
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
|
2135 funcdef = fignore; |
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
|
2136 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
|
2137 case ftagseen: |
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
|
2138 funcdef = fnone; |
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
|
2139 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
|
2140 } |
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
|
2141 if (structdef == stagseen) |
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
|
2142 structdef = snone; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2143 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
|
2144 case dsharpseen: |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
2145 savetok = tok; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2146 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2147 if (!yacc_rules || lp == newlb.buffer + 1) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2148 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2149 tokoff = lp - 1 - newlb.buffer; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2150 toklen = 1; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2151 midtoken = TRUE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2152 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2153 continue; |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
2154 } /* if (begtoken) */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2155 } /* if must look at token */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2156 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2157 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2158 /* 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
|
2159 after having handled a token.*/ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2160 switch (c) |
401 | 2161 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2162 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
|
2163 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
|
2164 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2165 if (structdef == stagseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2166 structdef = scolonseen; |
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
|
2167 else |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2168 switch (funcdef) |
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
|
2169 { |
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
|
2170 case ftagseen: |
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
|
2171 if (yacc_rules) |
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
|
2172 { |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2173 make_tag (FALSE); |
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
|
2174 funcdef = fignore; |
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
|
2175 } |
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
|
2176 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
|
2177 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
|
2178 funcdef = fnone; |
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
|
2179 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
|
2180 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2181 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2182 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
|
2183 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
|
2184 break; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2185 if (cblev == 0) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2186 switch (typdef) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2187 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2188 case tend: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2189 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2190 /* FALLTHRU */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2191 default: |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2192 typdef = tnone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2193 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2194 if (funcdef != fignore) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2195 funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2196 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2197 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2198 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2199 case ',': |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2200 if (definedef != dnone) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2201 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2202 if (funcdef != finlist && funcdef != fignore) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2203 funcdef = fnone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2204 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2205 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2206 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2207 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
|
2208 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
|
2209 break; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2210 if (cblev == 0 && typdef == tend) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2211 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2212 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2213 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2214 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2215 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2216 if (funcdef != finlist && funcdef != fignore) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2217 funcdef = fnone; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2218 if (structdef == stagseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2219 structdef = snone; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2220 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2221 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
|
2222 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
|
2223 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2224 switch (funcdef) |
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
|
2225 { |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2226 case fnone: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2227 switch (typdef) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2228 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2229 case ttypedseen: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2230 case tend: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2231 /* Make sure that the next char is not a '*'. |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2232 This handles constructs like: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2233 typedef void OperatorFun (int fun); */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2234 if (*lp != '*') |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2235 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2236 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2237 make_tag (FALSE); |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2238 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2239 break; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2240 } /* switch (typdef) */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2241 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2242 case ftagseen: |
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
|
2243 funcdef = fstartlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2244 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2245 case 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
|
2246 funcdef = finlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2247 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
|
2248 } |
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
|
2249 parlev++; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2250 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2251 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
|
2252 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
|
2253 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
|
2254 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
|
2255 { |
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
|
2256 switch (funcdef) |
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
|
2257 { |
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
|
2258 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
|
2259 case finlist: |
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
|
2260 funcdef = flistseen; |
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
|
2261 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
|
2262 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2263 if (cblev == 0 && typdef == tend) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2264 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2265 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2266 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2267 } |
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
|
2268 } |
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
|
2269 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
|
2270 parlev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2271 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2272 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
|
2273 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
|
2274 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2275 if (typdef == ttypedseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2276 typdef = tinbody; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2277 switch (structdef) |
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
|
2278 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2279 case skeyseen: /* unnamed struct */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2280 structtag = "_anonymous_"; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2281 structdef = sinbody; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2282 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2283 case stagseen: |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2284 case scolonseen: /* named struct */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2285 structdef = sinbody; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2286 make_tag (FALSE); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2287 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
|
2288 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2289 switch (funcdef) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2290 { |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2291 case flistseen: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2292 make_tag (TRUE); |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2293 /* FALLTHRU */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2294 case fignore: |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2295 funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2296 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2297 case fnone: |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
2298 /* Neutralize `extern "C" {' grot and look inside structs. */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2299 if (cblev == 0 && structdef == snone && typdef == tnone) |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
2300 cblev = -1; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2301 } |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2302 cblev++; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2303 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2304 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
|
2305 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
|
2306 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
|
2307 if (funcdef == 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
|
2308 funcdef = fnone; /* avoid tagging `foo' in `foo (*bar()) ()' */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2309 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2310 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
|
2311 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
|
2312 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2313 if (!noindentypedefs && lp == newlb.buffer + 1) |
4937
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2314 { |
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
|
2315 cblev = 0; /* reset curly brace level if first column */ |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2316 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
|
2317 } |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2318 else if (cblev > 0) |
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2319 cblev--; |
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2320 if (cblev == 0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2321 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2322 if (typdef == tinbody) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2323 typdef = tend; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2324 #if FALSE /* too risky */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2325 if (structdef == sinbody) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2326 free (structtag); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2327 #endif |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
2328 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2329 structdef = snone; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2330 structtag = "<error>"; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2331 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2332 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
|
2333 case '=': |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2334 case '#': case '+': case '-': case '~': case '&': case '%': case '/': |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2335 case '|': case '^': 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
|
2336 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
|
2337 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
|
2338 /* These surely cannot follow a function tag. */ |
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
|
2339 if (funcdef != finlist && funcdef != fignore) |
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
|
2340 funcdef = fnone; |
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
|
2341 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2342 case '\0': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2343 /* 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
|
2344 if (quotednl) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2345 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2346 else |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2347 CNL; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2348 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2349 } /* switch (c) */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2350 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2351 } /* while not eof */ |
240 | 2352 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2353 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2354 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2355 * 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
|
2356 * 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
|
2357 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2358 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2359 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
|
2360 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2361 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2362 C_entries (cplusplus ? C_PLPL : 0, inf); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2363 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2364 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2365 /* Always do C++. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2366 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2367 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
|
2368 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2369 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2370 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
|
2371 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2372 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2373 /* Always do C*. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2374 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2375 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
|
2376 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2377 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2378 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
|
2379 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2380 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2381 /* Always do Yacc. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2382 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2383 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
|
2384 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2385 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2386 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
|
2387 } |
240 | 2388 |
2389 /* Fortran parsing */ | |
2390 | |
2391 char *dbp; | |
2392 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2393 logical |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2394 tail (cp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2395 char *cp; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2396 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2397 register int len = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2398 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2399 while (*cp && (*cp | ' ') == (dbp[len] | ' ')) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2400 cp++, len++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2401 if (*cp == 0) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2402 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2403 dbp += len; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2404 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2405 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2406 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2407 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2408 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2409 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2410 takeprec () |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2411 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2412 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2413 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2414 if (*dbp != '*') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2415 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2416 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2417 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2418 dbp++; |
8180
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
2419 if (tail ("(*)")) |
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
2420 return; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2421 if (!isdigit (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2422 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2423 --dbp; /* force failure */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2424 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2425 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2426 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2427 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2428 while (isdigit (*dbp)); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2429 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2430 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2431 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2432 getit (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2433 FILE *inf; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2434 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2435 register char *cp; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2436 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2437 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2438 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2439 if (*dbp == '\0') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2440 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2441 lineno++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2442 linecharno = charno; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2443 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2444 dbp = lb.buffer; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2445 if (dbp[5] != '&') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2446 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2447 dbp += 6; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2448 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2449 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2450 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2451 if (!isalpha (*dbp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2452 && *dbp != '_' |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2453 && *dbp != '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2454 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2455 for (cp = dbp + 1; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2456 (*cp |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2457 && (isalpha (*cp) || isdigit (*cp) || (*cp == '_') || (*cp == '$'))); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2458 cp++) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2459 continue; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2460 pfnote (savenstr (dbp, cp-dbp), TRUE, FALSE, lb.buffer, |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2461 cp - lb.buffer + 1, lineno, linecharno); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2462 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2463 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2464 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2465 Fortran_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2466 FILE *inf; |
240 | 2467 { |
2468 lineno = 0; | |
2469 charno = 0; | |
2470 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2471 while (!feof (inf)) |
240 | 2472 { |
2473 lineno++; | |
2474 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2475 charno += readline (&lb, inf); |
240 | 2476 dbp = lb.buffer; |
2477 if (*dbp == '%') | |
2478 dbp++; /* Ratfor escape to fortran */ | |
2479 while (isspace (*dbp)) | |
2480 dbp++; | |
2481 if (*dbp == 0) | |
2482 continue; | |
2483 switch (*dbp | ' ') | |
2484 { | |
2485 case 'i': | |
2486 if (tail ("integer")) | |
2487 takeprec (); | |
2488 break; | |
2489 case 'r': | |
2490 if (tail ("real")) | |
2491 takeprec (); | |
2492 break; | |
2493 case 'l': | |
2494 if (tail ("logical")) | |
2495 takeprec (); | |
2496 break; | |
2497 case 'c': | |
2498 if (tail ("complex") || tail ("character")) | |
2499 takeprec (); | |
2500 break; | |
2501 case 'd': | |
2502 if (tail ("double")) | |
2503 { | |
2504 while (isspace (*dbp)) | |
2505 dbp++; | |
2506 if (*dbp == 0) | |
2507 continue; | |
2508 if (tail ("precision")) | |
2509 break; | |
2510 continue; | |
2511 } | |
2512 break; | |
2513 } | |
2514 while (isspace (*dbp)) | |
2515 dbp++; | |
2516 if (*dbp == 0) | |
2517 continue; | |
2518 switch (*dbp | ' ') | |
2519 { | |
2520 case 'f': | |
2521 if (tail ("function")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2522 getit (inf); |
240 | 2523 continue; |
2524 case 's': | |
2525 if (tail ("subroutine")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2526 getit (inf); |
240 | 2527 continue; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2528 case 'e': |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2529 if (tail ("entry")) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2530 getit (inf); |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2531 continue; |
240 | 2532 case 'p': |
2533 if (tail ("program")) | |
2534 { | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2535 getit (inf); |
240 | 2536 continue; |
2537 } | |
2538 if (tail ("procedure")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2539 getit (inf); |
240 | 2540 continue; |
2541 } | |
2542 } | |
2543 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2544 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2545 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2546 * Bob Weiner, Motorola Inc., 4/3/94 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2547 * Unix and microcontroller assembly tag handling |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2548 * look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]' |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2549 */ |
240 | 2550 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2551 Asm_labels (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2552 FILE *inf; |
240 | 2553 { |
2554 register char *cp; | |
2555 | |
2556 lineno = 0; | |
2557 charno = 0; | |
2558 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2559 while (!feof (inf)) |
240 | 2560 { |
2561 lineno++; | |
2562 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2563 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2564 cp = lb.buffer; |
240 | 2565 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2566 /* 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
|
2567 following identifier. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2568 if (isalpha (*cp) || *cp == '_' || *cp == '.' || *cp == '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2569 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2570 /* Read past label. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2571 cp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2572 while (isalnum (*cp) || *cp == '_' || *cp == '.' || *cp == '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2573 cp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2574 if (*cp == ':' || isspace (*cp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2575 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2576 /* Found end of label, so copy it and add it to the table. */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2577 pfnote (savenstr (lb.buffer, cp-lb.buffer), TRUE, FALSE, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2578 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
|
2579 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2580 } |
240 | 2581 } |
2582 } | |
2583 | |
2584 /* Added by Mosur Mohan, 4/22/88 */ | |
2585 /* Pascal parsing */ | |
2586 | |
2587 #define GET_NEW_LINE \ | |
2588 { \ | |
2589 linecharno = charno; lineno++; \ | |
2590 charno += 1 + readline (&lb, inf); \ | |
2591 dbp = lb.buffer; \ | |
2592 } | |
2593 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
2594 /* |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
2595 * 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
|
2596 * 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
|
2597 * "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
|
2598 * the tag is skipped. |
240 | 2599 */ |
2600 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2601 Pascal_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2602 FILE *inf; |
240 | 2603 { |
2604 struct linebuffer tline; /* mostly copied from C_entries */ | |
2605 long save_lcno; | |
2606 int save_lineno; | |
2607 char c, *cp; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2608 char *nambuf; |
240 | 2609 |
2610 logical /* each of these flags is TRUE iff: */ | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2611 incomment, /* point is inside a comment */ |
240 | 2612 inquote, /* point is inside '..' string */ |
2613 get_tagname, /* point is after PROCEDURE/FUNCTION */ | |
2614 /* keyword, so next item = potential tag */ | |
2615 found_tag, /* point is after a potential tag */ | |
2616 inparms, /* point is within parameter-list */ | |
2617 verify_tag; /* point has passed the parm-list, so the */ | |
2618 /* next token will determine whether */ | |
2619 /* this is a FORWARD/EXTERN to be */ | |
2620 /* ignored, or whether it is a real tag */ | |
2621 | |
2622 lineno = 0; | |
2623 charno = 0; | |
2624 dbp = lb.buffer; | |
2625 *dbp = 0; | |
2626 initbuffer (&tline); | |
2627 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2628 incomment = inquote = FALSE; |
240 | 2629 found_tag = FALSE; /* have a proc name; check if extern */ |
2630 get_tagname = FALSE; /* have found "procedure" keyword */ | |
2631 inparms = FALSE; /* found '(' after "proc" */ | |
2632 verify_tag = FALSE; /* check if "extern" is ahead */ | |
2633 | |
2634 /* long main loop to get next char */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2635 while (!feof (inf)) |
240 | 2636 { |
2637 c = *dbp++; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2638 if (c == '\0') /* if end of line */ |
240 | 2639 { |
2640 GET_NEW_LINE; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2641 if (*dbp == '\0') |
240 | 2642 continue; |
2643 if (!((found_tag && verify_tag) || | |
2644 get_tagname)) | |
2645 c = *dbp++; /* only if don't need *dbp pointing */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2646 /* to the beginning of the name of */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2647 /* the procedure or function */ |
240 | 2648 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2649 if (incomment) |
240 | 2650 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2651 if (c == '}') /* within { - } comments */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2652 incomment = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2653 else if (c == '*' && dbp[1] == ')') /* within (* - *) comments */ |
240 | 2654 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2655 dbp++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2656 incomment = FALSE; |
240 | 2657 } |
2658 continue; | |
2659 } | |
2660 else if (inquote) | |
2661 { | |
2662 if (c == '\'') | |
2663 inquote = FALSE; | |
2664 continue; | |
2665 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2666 else |
240 | 2667 switch (c) |
2668 { | |
2669 case '\'': | |
2670 inquote = TRUE; /* found first quote */ | |
2671 continue; | |
2672 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
|
2673 incomment = TRUE; |
240 | 2674 continue; |
2675 case '(': | |
2676 if (*dbp == '*') /* found open-(*-comment */ | |
2677 { | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2678 incomment = TRUE; |
240 | 2679 dbp++; |
2680 } | |
2681 else if (found_tag) /* found '(' after tag, i.e., parm-list */ | |
2682 inparms = TRUE; | |
2683 continue; | |
2684 case ')': /* end of parms list */ | |
2685 if (inparms) | |
2686 inparms = FALSE; | |
2687 continue; | |
2688 case ';': | |
2689 if ((found_tag) && (!inparms)) /* end of proc or fn stmt */ | |
2690 { | |
2691 verify_tag = TRUE; | |
2692 break; | |
2693 } | |
2694 continue; | |
2695 } | |
2696 if ((found_tag) && (verify_tag) && (*dbp != ' ')) | |
2697 { | |
2698 /* check if this is an "extern" declaration */ | |
2699 if (*dbp == 0) | |
2700 continue; | |
2701 if ((*dbp == 'e') || (*dbp == 'E')) | |
2702 { | |
2703 if (tail ("extern")) /* superfluous, really! */ | |
2704 { | |
2705 found_tag = FALSE; | |
2706 verify_tag = FALSE; | |
2707 } | |
2708 } | |
2709 else if ((*dbp == 'f') || (*dbp == 'F')) | |
2710 { | |
2711 if (tail ("forward")) /* check for forward reference */ | |
2712 { | |
2713 found_tag = FALSE; | |
2714 verify_tag = FALSE; | |
2715 } | |
2716 } | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2717 if ((found_tag) && (verify_tag)) /* not external proc, so make tag */ |
240 | 2718 { |
2719 found_tag = FALSE; | |
2720 verify_tag = FALSE; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2721 pfnote (nambuf, TRUE, FALSE, tline.buffer, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2722 cp - tline.buffer + 1, save_lineno, save_lcno); |
240 | 2723 continue; |
2724 } | |
2725 } | |
2726 if (get_tagname) /* grab name of proc or fn */ | |
2727 { | |
2728 if (*dbp == 0) | |
2729 continue; | |
2730 | |
2731 /* save all values for later tagging */ | |
2732 tline.size = lb.size; | |
2733 strcpy (tline.buffer, lb.buffer); | |
2734 save_lineno = lineno; | |
2735 save_lcno = linecharno; | |
2736 | |
2737 /* grab block name */ | |
2738 for (cp = dbp + 1; *cp && (!endtoken (*cp)); cp++) | |
2739 continue; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2740 nambuf = savenstr (dbp, cp-dbp); |
240 | 2741 dbp = cp; /* restore dbp to e-o-token */ |
2742 get_tagname = FALSE; | |
2743 found_tag = TRUE; | |
2744 continue; | |
2745 | |
2746 /* and proceed to check for "extern" */ | |
2747 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2748 else if (!incomment && !inquote && !found_tag) |
240 | 2749 { |
2750 /* check for proc/fn keywords */ | |
2751 switch (c | ' ') | |
2752 { | |
2753 case 'p': | |
2754 if (tail ("rocedure")) /* c = 'p', dbp has advanced */ | |
2755 get_tagname = TRUE; | |
2756 continue; | |
2757 case 'f': | |
2758 if (tail ("unction")) | |
2759 get_tagname = TRUE; | |
2760 continue; | |
2761 } | |
2762 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2763 } /* while not eof */ |
240 | 2764 } |
2765 | |
2766 /* | |
2767 * lisp tag functions | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2768 * look for (def or (DEF, quote or QUOTE |
240 | 2769 */ |
2770 int | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2771 L_isdef (strp) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2772 register char *strp; |
240 | 2773 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2774 return ((strp[1] == 'd' || strp[1] == 'D') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2775 && (strp[2] == 'e' || strp[2] == 'E') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2776 && (strp[3] == 'f' || strp[3] == 'F')); |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2777 } |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2778 |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2779 int |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2780 L_isquote (strp) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2781 register char *strp; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2782 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2783 return ((*(++strp) == 'q' || *strp == 'Q') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2784 && (*(++strp) == 'u' || *strp == 'U') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2785 && (*(++strp) == 'o' || *strp == 'O') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2786 && (*(++strp) == 't' || *strp == 'T') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2787 && (*(++strp) == 'e' || *strp == 'E') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2788 && isspace(*(++strp))); |
240 | 2789 } |
2790 | |
2791 void | |
2792 L_getit () | |
2793 { | |
2794 register char *cp; | |
2795 | |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2796 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
|
2797 dbp++; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2798 else if (*dbp == '(' && L_isquote (dbp)) /* Skip "(quote " */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2799 { |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2800 dbp += 7; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2801 while (isspace(*dbp)) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2802 dbp++; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2803 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2804 for (cp = dbp /*+1*/; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2805 *cp && *cp != '(' && *cp != ' ' && *cp != ')'; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2806 cp++) |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2807 continue; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2808 if (cp == dbp) |
240 | 2809 return; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2810 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2811 pfnote (savenstr (dbp, cp-dbp), TRUE, FALSE, lb.buffer, |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2812 cp - lb.buffer + 1, lineno, linecharno); |
240 | 2813 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2814 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2815 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2816 Lisp_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2817 FILE *inf; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2818 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2819 lineno = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2820 charno = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2821 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2822 while (!feof (inf)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2823 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2824 lineno++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2825 linecharno = charno; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2826 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2827 dbp = lb.buffer; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2828 if (dbp[0] == '(') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2829 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2830 if (L_isdef (dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2831 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2832 while (!isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2833 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2834 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2835 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2836 L_getit (); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2837 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2838 else |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2839 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2840 /* Check for (foo::defmumble name-defined ... */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2841 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2842 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2843 while (*dbp && !isspace (*dbp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2844 && *dbp != ':' && *dbp != '(' && *dbp != ')'); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2845 if (*dbp == ':') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2846 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2847 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2848 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2849 while (*dbp == ':'); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2850 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2851 if (L_isdef (dbp - 1)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2852 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2853 while (!isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2854 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2855 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2856 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2857 L_getit (); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2858 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2859 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2860 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2861 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2862 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2863 } |
240 | 2864 |
2865 /* | |
2866 * Scheme tag functions | |
2867 * look for (def... xyzzy | |
2868 * look for (def... (xyzzy | |
2869 * look for (def ... ((...(xyzzy .... | |
2870 * look for (set! xyzzy | |
2871 */ | |
2872 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2873 void get_scheme (); |
240 | 2874 |
2875 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2876 Scheme_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2877 FILE *inf; |
240 | 2878 { |
2879 lineno = 0; | |
2880 charno = 0; | |
2881 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2882 while (!feof (inf)) |
240 | 2883 { |
2884 lineno++; | |
2885 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2886 charno += readline (&lb, inf); |
240 | 2887 dbp = lb.buffer; |
2888 if (dbp[0] == '(' && | |
2889 (dbp[1] == 'D' || dbp[1] == 'd') && | |
2890 (dbp[2] == 'E' || dbp[2] == 'e') && | |
2891 (dbp[3] == 'F' || dbp[3] == 'f')) | |
2892 { | |
2893 while (!isspace (*dbp)) | |
2894 dbp++; | |
2895 /* Skip over open parens and white space */ | |
2896 while (*dbp && (isspace (*dbp) || *dbp == '(')) | |
2897 dbp++; | |
2898 get_scheme (); | |
2899 } | |
2900 if (dbp[0] == '(' && | |
2901 (dbp[1] == 'S' || dbp[1] == 's') && | |
2902 (dbp[2] == 'E' || dbp[2] == 'e') && | |
2903 (dbp[3] == 'T' || dbp[3] == 't') && | |
2904 (dbp[4] == '!' || dbp[4] == '!') && | |
2905 (isspace (dbp[5]))) | |
2906 { | |
2907 while (!isspace (*dbp)) | |
2908 dbp++; | |
2909 /* Skip over white space */ | |
2910 while (isspace (*dbp)) | |
2911 dbp++; | |
2912 get_scheme (); | |
2913 } | |
2914 } | |
2915 } | |
2916 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2917 void |
240 | 2918 get_scheme () |
2919 { | |
2920 register char *cp; | |
2921 | |
2922 if (*dbp == 0) | |
2923 return; | |
2924 /* Go till you get to white space or a syntactic break */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2925 for (cp = dbp + 1; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2926 *cp && *cp != '(' && *cp != ')' && !isspace (*cp); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2927 cp++) |
240 | 2928 continue; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2929 pfnote (savenstr (dbp, cp-dbp), TRUE, FALSE, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2930 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
240 | 2931 } |
2932 | |
2933 /* Find tags in TeX and LaTeX input files. */ | |
2934 | |
2935 /* TEX_toktab is a table of TeX control sequences that define tags. | |
2936 Each TEX_tabent records one such control sequence. | |
2937 CONVERT THIS TO USE THE Stab TYPE!! */ | |
2938 struct TEX_tabent | |
2939 { | |
2940 char *name; | |
2941 int len; | |
2942 }; | |
2943 | |
2944 struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */ | |
2945 | |
2946 /* Default set of control sequences to put into TEX_toktab. | |
2947 The value of environment var TEXTAGS is prepended to this. */ | |
2948 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2949 char *TEX_defenv = "\ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2950 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem:typeout"; |
240 | 2951 |
2952 void TEX_mode (); | |
2953 struct TEX_tabent *TEX_decode_env (); | |
2954 void TEX_getit (); | |
2955 int TEX_Token (); | |
2956 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2957 char TEX_esc = '\\'; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2958 char TEX_opgrp = '{'; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2959 char TEX_clgrp = '}'; |
240 | 2960 |
2961 /* | |
2962 * TeX/LaTeX scanning loop. | |
2963 */ | |
2964 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2965 TeX_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2966 FILE *inf; |
240 | 2967 { |
2968 char *lasthit; | |
2969 | |
2970 lineno = 0; | |
2971 charno = 0; | |
2972 | |
2973 /* 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
|
2974 TEX_mode (inf); |
240 | 2975 |
2976 /* Initialize token table once from environment. */ | |
2977 if (!TEX_toktab) | |
2978 TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv); | |
2979 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2980 while (!feof (inf)) |
1040 | 2981 { /* Scan each line in file */ |
240 | 2982 lineno++; |
2983 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2984 charno += readline (&lb, inf); |
240 | 2985 dbp = lb.buffer; |
2986 lasthit = dbp; | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
2987 while (dbp = etags_strchr (dbp, TEX_esc)) /* Look at each esc in line */ |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2988 { |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2989 register int i; |
240 | 2990 |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2991 if (!*(++dbp)) |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2992 break; |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2993 linecharno += dbp - lasthit; |
240 | 2994 lasthit = dbp; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2995 i = TEX_Token (lasthit); |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2996 if (0 <= i) |
240 | 2997 { |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2998 TEX_getit (lasthit, TEX_toktab[i].len); |
1040 | 2999 break; /* We only save a line once */ |
240 | 3000 } |
3001 } | |
3002 } | |
3003 } | |
3004 | |
3005 #define TEX_LESC '\\' | |
3006 #define TEX_SESC '!' | |
3007 #define TEX_cmt '%' | |
3008 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3009 /* 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
|
3010 chars accordingly. */ |
240 | 3011 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3012 TEX_mode (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3013 FILE *inf; |
240 | 3014 { |
3015 int c; | |
3016 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3017 while ((c = getc (inf)) != EOF) |
240 | 3018 { |
3019 /* Skip to next line if we hit the TeX comment char. */ | |
3020 if (c == TEX_cmt) | |
3021 while (c != '\n') | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3022 c = getc (inf); |
240 | 3023 else if (c == TEX_LESC || c == TEX_SESC ) |
3024 break; | |
3025 } | |
3026 | |
3027 if (c == TEX_LESC) | |
3028 { | |
3029 TEX_esc = TEX_LESC; | |
3030 TEX_opgrp = '{'; | |
3031 TEX_clgrp = '}'; | |
3032 } | |
3033 else | |
3034 { | |
3035 TEX_esc = TEX_SESC; | |
3036 TEX_opgrp = '<'; | |
3037 TEX_clgrp = '>'; | |
3038 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3039 rewind (inf); |
240 | 3040 } |
3041 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3042 /* 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
|
3043 Build token table. */ |
240 | 3044 struct TEX_tabent * |
3045 TEX_decode_env (evarname, defenv) | |
3046 char *evarname; | |
3047 char *defenv; | |
3048 { | |
3049 register char *env, *p; | |
3050 | |
3051 struct TEX_tabent *tab; | |
3052 int size, i; | |
3053 | |
3054 /* Append default string to environment. */ | |
3055 env = getenv (evarname); | |
3056 if (!env) | |
3057 env = defenv; | |
3058 else | |
3059 env = concat (env, defenv, ""); | |
3060 | |
3061 /* Allocate a token table */ | |
3062 for (size = 1, p = env; p;) | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3063 if ((p = etags_strchr (p, ':')) && *(++p)) |
240 | 3064 size++; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3065 /* Add 1 to leave room for null terminator. */ |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3066 tab = xnew (size + 1, struct TEX_tabent); |
240 | 3067 |
3068 /* Unpack environment string into token table. Be careful about */ | |
3069 /* zero-length strings (leading ':', "::" and trailing ':') */ | |
3070 for (i = 0; *env;) | |
3071 { | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3072 p = etags_strchr (env, ':'); |
240 | 3073 if (!p) /* End of environment string. */ |
3074 p = env + strlen (env); | |
3075 if (p - env > 0) | |
3076 { /* Only non-zero strings. */ | |
3077 tab[i].name = savenstr (env, p - env); | |
3078 tab[i].len = strlen (tab[i].name); | |
3079 i++; | |
3080 } | |
3081 if (*p) | |
3082 env = p + 1; | |
3083 else | |
3084 { | |
3085 tab[i].name = NULL; /* Mark end of table. */ | |
3086 tab[i].len = 0; | |
3087 break; | |
3088 } | |
3089 } | |
3090 return tab; | |
3091 } | |
3092 | |
3093 /* Record a tag defined by a TeX command of length LEN and starting at NAME. | |
3094 The name being defined actually starts at (NAME + LEN + 1). | |
3095 But we seem to include the TeX command in the tag name. */ | |
3096 void | |
3097 TEX_getit (name, len) | |
3098 char *name; | |
3099 int len; | |
3100 { | |
3101 char *p = name + len; | |
3102 | |
3103 if (*name == 0) | |
3104 return; | |
3105 | |
3106 /* Let tag name extend to next group close (or end of line) */ | |
3107 while (*p && *p != TEX_clgrp) | |
3108 p++; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3109 pfnote (savenstr (name, p-name), TRUE, FALSE, lb.buffer, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3110 strlen (lb.buffer), lineno, linecharno); |
240 | 3111 } |
3112 | |
3113 /* If the text at CP matches one of the tag-defining TeX command names, | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3114 return the pointer to the first occurrence of that command in TEX_toktab. |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3115 Otherwise return -1. |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3116 Keep the capital `T' in `Token' for dumb truncating compilers |
240 | 3117 (this distinguishes it from `TEX_toktab' */ |
3118 int | |
3119 TEX_Token (cp) | |
3120 char *cp; | |
3121 { | |
3122 int i; | |
3123 | |
3124 for (i = 0; TEX_toktab[i].len > 0; i++) | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3125 if (strneq (TEX_toktab[i].name, cp, TEX_toktab[i].len)) |
240 | 3126 return i; |
3127 return -1; | |
3128 } | |
3129 | |
3130 /* Support for Prolog. */ | |
3131 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3132 /* Whole head (not only functor, but also arguments) |
240 | 3133 is gotten in compound term. */ |
3134 void | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3135 prolog_getit (s) |
240 | 3136 char *s; |
3137 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3138 char *save_s; |
240 | 3139 int insquote, npar; |
3140 | |
3141 save_s = s; | |
3142 insquote = FALSE; | |
3143 npar = 0; | |
3144 while (1) | |
3145 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3146 if (s[0] == '\0') /* syntax error. */ |
240 | 3147 return; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3148 else if (insquote && s[0] == '\'' && s[1] == '\'') |
240 | 3149 s += 2; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3150 else if (s[0] == '\'') |
240 | 3151 { |
3152 insquote = !insquote; | |
3153 s++; | |
3154 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3155 else if (!insquote && s[0] == '(') |
240 | 3156 { |
3157 npar++; | |
3158 s++; | |
3159 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3160 else if (!insquote && s[0] == ')') |
240 | 3161 { |
3162 npar--; | |
3163 s++; | |
3164 if (npar == 0) | |
3165 break; | |
3166 else if (npar < 0) /* syntax error. */ | |
3167 return; | |
3168 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3169 else if (!insquote && s[0] == '.' |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3170 && (isspace (s[1]) || s[1] == '\0')) |
240 | 3171 { /* fullstop. */ |
3172 if (npar != 0) /* syntax error. */ | |
3173 return; | |
3174 s++; | |
3175 break; | |
3176 } | |
3177 else | |
3178 s++; | |
3179 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3180 pfnote (savenstr (save_s, s-save_s), TRUE, FALSE, |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3181 save_s, s-save_s, lineno, linecharno); |
240 | 3182 } |
3183 | |
3184 /* It is assumed that prolog predicate starts from column 0. */ | |
3185 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3186 Prolog_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3187 FILE *inf; |
240 | 3188 { |
3189 void skip_comment (), prolog_getit (); | |
3190 | |
3191 lineno = linecharno = charno = 0; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3192 while (!feof (inf)) |
240 | 3193 { |
3194 lineno++; | |
3195 linecharno += charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3196 charno = readline (&lb, inf) + 1; /* 1 for newline. */ |
240 | 3197 dbp = lb.buffer; |
3198 if (isspace (dbp[0])) /* not predicate header. */ | |
3199 continue; | |
3200 else if (dbp[0] == '%') /* comment. */ | |
3201 continue; | |
3202 else if (dbp[0] == '/' && dbp[1] == '*') /* comment. */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3203 skip_comment (&lb, inf, &lineno, &linecharno); |
240 | 3204 else /* found. */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3205 prolog_getit (dbp); |
240 | 3206 } |
3207 } | |
3208 | |
3209 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3210 skip_comment (plb, inf, plineno, plinecharno) |
240 | 3211 struct linebuffer *plb; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3212 FILE *inf; |
240 | 3213 int *plineno; /* result */ |
3214 long *plinecharno; /* result */ | |
3215 { | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3216 char *cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3217 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3218 do |
240 | 3219 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3220 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
|
3221 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
|
3222 return; |
240 | 3223 (*plineno)++; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3224 *plinecharno += readline (plb, inf) + 1; /* 1 for newline. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3225 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3226 while (!feof(inf)); |
240 | 3227 } |
3228 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3229 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3230 /* Take a string like "/blah/" and turn it into "blah", making sure |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3231 that the first and last characters are the same, and handling |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3232 quoted separator characters. Actually, stops on the occurence of |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3233 an unquoted separator. Also turns "\t" into a Tab character. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3234 Returns pointer to terminating separator. Works in place. Null |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3235 terminates name string. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3236 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3237 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
|
3238 char *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3239 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3240 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
|
3241 char *copyto = name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3242 logical quoted = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3243 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3244 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
|
3245 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3246 if (quoted) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3247 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3248 if (*name == 't') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3249 *copyto++ = '\t'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3250 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
|
3251 *copyto++ = sep; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3252 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3253 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3254 /* Something else is quoted, so preserve the quote. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3255 *copyto++ = '\\'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3256 *copyto++ = *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3257 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3258 quoted = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3259 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3260 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
|
3261 quoted = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3262 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
|
3263 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3264 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3265 *copyto++ = *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3266 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3267 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3268 /* 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
|
3269 *copyto = '\0'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3270 return name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3271 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3272 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3273 /* Turn a name, which is an ed-style (but Emacs syntax) regular |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3274 expression, into a real regular expression by compiling it. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3275 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3276 add_regex (regexp_pattern) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3277 char *regexp_pattern; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3278 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3279 char *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3280 const char *err; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3281 struct re_pattern_buffer *patbuf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3282 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3283 if (regexp_pattern == NULL) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3284 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3285 /* Remove existing regexps. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3286 num_patterns = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3287 patterns = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3288 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3289 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3290 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3291 if (regexp_pattern[0] == '\0') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3292 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3293 error ("missing regexp", 0); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3294 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3295 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3296 if (regexp_pattern[strlen(regexp_pattern)-1] != regexp_pattern[0]) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3297 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3298 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
|
3299 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3300 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3301 name = scan_separators (regexp_pattern); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3302 if (regexp_pattern[0] == '\0') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3303 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3304 error ("null regexp", 0); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3305 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3306 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3307 (void) scan_separators (name); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3308 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3309 patbuf = xnew (1, struct re_pattern_buffer); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3310 patbuf->translate = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3311 patbuf->fastmap = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3312 patbuf->buffer = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3313 patbuf->allocated = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3314 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3315 err = re_compile_pattern (regexp_pattern, strlen (regexp_pattern), patbuf); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3316 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
|
3317 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3318 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
|
3319 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3320 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3321 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3322 num_patterns += 1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3323 if (num_patterns == 1) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3324 patterns = xnew (1, struct pattern); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3325 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3326 patterns = ((struct pattern *) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3327 xrealloc (patterns, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3328 (num_patterns * sizeof (struct pattern)))); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3329 patterns[num_patterns - 1].pattern = patbuf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3330 patterns[num_patterns - 1].name_pattern = savestr (name); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3331 patterns[num_patterns - 1].error_signaled = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3332 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3333 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3334 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3335 * Do the subtitutions indicated by the regular expression and |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3336 * arguments. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3337 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3338 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3339 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
|
3340 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
|
3341 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
|
3342 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3343 char *result = NULL, *t; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3344 int size = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3345 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3346 /* Pass 1: figure out how much size to allocate. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3347 for (t = out; *t; ++t) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3348 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3349 if (*t == '\\') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3350 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3351 ++t; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3352 if (!*t) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3353 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3354 fprintf (stderr, "%s: pattern subtitution ends prematurely\n", |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3355 progname); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3356 return NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3357 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3358 if (isdigit (*t)) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3359 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3360 int dig = *t - '0'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3361 size += regs->end[dig] - regs->start[dig]; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3362 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3363 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3364 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3365 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3366 /* Allocate space and do the substitutions. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3367 result = xnew (size + 1, char); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3368 size = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3369 for (; *out; ++out) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3370 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3371 if (*out == '\\') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3372 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3373 ++out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3374 if (isdigit (*out)) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3375 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3376 /* Using "dig2" satisfies my debugger. Bleah. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3377 int dig2 = *out - '0'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3378 strncpy (result + size, in + regs->start[dig2], |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3379 regs->end[dig2] - regs->start[dig2]); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3380 size += regs->end[dig2] - regs->start[dig2]; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3381 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3382 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3383 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3384 switch (*out) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3385 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3386 case '\t': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3387 result[size++] = '\t'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3388 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3389 case '\\': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3390 *out = '\\'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3391 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3392 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3393 result[size++] = *out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3394 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3395 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3396 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3397 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3398 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3399 result[size++] = *out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3400 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3401 result[size] = '\0'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3402 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3403 return result; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3404 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3405 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3406 #endif /* ETAGS_REGEXPS */ |
240 | 3407 /* Initialize a linebuffer for use */ |
3408 void | |
3409 initbuffer (linebuffer) | |
3410 struct linebuffer *linebuffer; | |
3411 { | |
3412 linebuffer->size = 200; | |
3413 linebuffer->buffer = xnew (200, char); | |
3414 } | |
3415 | |
3416 /* | |
3417 * Read a line of text from `stream' into `linebuffer'. | |
3418 * Return the number of characters read from `stream', | |
3419 * which is the length of the line including the newline, if any. | |
3420 */ | |
3421 long | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3422 readline_internal (linebuffer, stream) |
240 | 3423 struct linebuffer *linebuffer; |
3424 register FILE *stream; | |
3425 { | |
3426 char *buffer = linebuffer->buffer; | |
3427 register char *p = linebuffer->buffer; | |
3428 register char *pend; | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3429 int chars_deleted; |
240 | 3430 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3569
diff
changeset
|
3431 pend = p + linebuffer->size; /* Separate to avoid 386/IX compiler bug. */ |
240 | 3432 |
3433 while (1) | |
3434 { | |
3435 register int c = getc (stream); | |
3436 if (p == pend) | |
3437 { | |
3438 linebuffer->size *= 2; | |
3439 buffer = (char *) xrealloc (buffer, linebuffer->size); | |
3440 p += buffer - linebuffer->buffer; | |
3441 pend = buffer + linebuffer->size; | |
3442 linebuffer->buffer = buffer; | |
3443 } | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3444 if (c == EOF) |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3445 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3446 chars_deleted = 0; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3447 break; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3448 } |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3449 if (c == '\n') |
240 | 3450 { |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3451 if (p[-1] == '\r' && p > buffer) |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3452 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3453 *--p = '\0'; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3454 chars_deleted = 2; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3455 } |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3456 else |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3457 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3458 *p = '\0'; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3459 chars_deleted = 1; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3460 } |
240 | 3461 break; |
3462 } | |
3463 *p++ = c; | |
3464 } | |
3465 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3466 return p - buffer + chars_deleted; |
240 | 3467 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3468 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3469 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3470 * Like readline_internal, above, but try to match the input |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3471 * line against any existing regular expressions. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3472 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3473 long |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3474 readline (linebuffer, stream) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3475 struct linebuffer *linebuffer; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3476 FILE *stream; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3477 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3478 /* Read new line. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3479 int i; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3480 long result = readline_internal (linebuffer, stream); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3481 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3482 #ifdef ETAGS_REGEXPS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3483 /* Match against all listed patterns. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3484 for (i = 0; i < num_patterns; ++i) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3485 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3486 int match = re_match (patterns[i].pattern, linebuffer->buffer, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3487 (int)result, 0, &patterns[i].regs); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3488 switch (match) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3489 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3490 case -2: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3491 /* Some error. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3492 if (!patterns[i].error_signaled) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3493 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3494 error ("error while matching pattern %d", i); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3495 patterns[i].error_signaled = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3496 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3497 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3498 case -1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3499 /* No match. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3500 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3501 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3502 /* Match occurred. Construct a tag. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3503 if (patterns[i].name_pattern[0] != '\0') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3504 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3505 /* Make a named tag. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3506 char *name = substitute (linebuffer->buffer, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3507 patterns[i].name_pattern, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3508 &patterns[i].regs); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3509 if (name != NULL) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3510 pfnote (name, TRUE, TRUE, linebuffer->buffer, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3511 match, lineno, linecharno); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3512 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3513 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3514 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3515 /* Make an unnamed tag. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3516 pfnote (NULL, TRUE, FALSE, linebuffer->buffer, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3517 match, lineno, linecharno); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3518 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3519 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3520 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3521 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3522 #endif /* ETAGS_REGEXPS */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3523 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3524 return result; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3525 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3526 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3527 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3528 * Read a file, but do no processing. This is used to do regexp |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3529 * matching on files that have no language defined. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3530 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3531 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3532 just_read_file (inf) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3533 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3534 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3535 while (!feof (inf)) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3536 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3537 ++lineno; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3538 linecharno = charno; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3539 charno += readline (&lb, inf) + 1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3540 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3541 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3542 |
240 | 3543 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3544 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3545 * 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
|
3546 * 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
|
3547 */ |
240 | 3548 char * |
3549 savestr (cp) | |
3550 char *cp; | |
3551 { | |
3552 return savenstr (cp, strlen (cp)); | |
3553 } | |
3554 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3555 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3556 * 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
|
3557 * 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
|
3558 */ |
240 | 3559 char * |
3560 savenstr (cp, len) | |
3561 char *cp; | |
3562 int len; | |
3563 { | |
3564 register char *dp; | |
3565 | |
3566 dp = xnew (len + 1, char); | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3567 strncpy (dp, cp, len); |
240 | 3568 dp[len] = '\0'; |
3569 return dp; | |
3570 } | |
3571 | |
3572 /* | |
3573 * Return the ptr in sp at which the character c last | |
3574 * appears; NULL if not found | |
3575 * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3576 * Identical to System V strrchr, included for portability. |
240 | 3577 */ |
3578 char * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3579 etags_strrchr (sp, c) |
240 | 3580 register char *sp, c; |
3581 { | |
3582 register char *r; | |
3583 | |
3584 r = NULL; | |
3585 do | |
3586 { | |
3587 if (*sp == c) | |
3588 r = sp; | |
3589 } while (*sp++); | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3590 return r; |
240 | 3591 } |
3592 | |
774 | 3593 |
240 | 3594 /* |
3595 * Return the ptr in sp at which the character c first | |
3596 * appears; NULL if not found | |
3597 * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3598 * Identical to System V strchr, included for portability. |
240 | 3599 */ |
3600 char * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3601 etags_strchr (sp, c) |
240 | 3602 register char *sp, c; |
3603 { | |
3604 do | |
3605 { | |
3606 if (*sp == c) | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3607 return sp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3608 } while (*sp++); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3609 return NULL; |
240 | 3610 } |
3611 | |
3612 /* Print error message and exit. */ | |
3613 void | |
3614 fatal (s1, s2) | |
3615 char *s1, *s2; | |
3616 { | |
3617 error (s1, s2); | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3618 exit (BAD); |
240 | 3619 } |
3620 | |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3621 void |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3622 pfatal (s1) |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3623 char *s1; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3624 { |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3625 perror (s1); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3626 exit (BAD); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3627 } |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3628 |
240 | 3629 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
3630 void | |
3631 error (s1, s2) | |
3632 char *s1, *s2; | |
3633 { | |
3634 fprintf (stderr, "%s: ", progname); | |
3635 fprintf (stderr, s1, s2); | |
3636 fprintf (stderr, "\n"); | |
3637 } | |
3638 | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3639 /* Return a newly-allocated string whose contents |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3640 concatenate those of s1, s2, s3. */ |
240 | 3641 char * |
3642 concat (s1, s2, s3) | |
3643 char *s1, *s2, *s3; | |
3644 { | |
3645 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | |
3646 char *result = xnew (len1 + len2 + len3 + 1, char); | |
3647 | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3648 strcpy (result, s1); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3649 strcpy (result + len1, s2); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3650 strcpy (result + len1 + len2, s3); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3651 result[len1 + len2 + len3] = '\0'; |
240 | 3652 |
3653 return result; | |
3654 } | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3655 |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3656 /* Does the same work as the system V getcwd, but does not need to |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3657 guess buffer size in advance. */ |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3658 char * |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3659 etags_getcwd () |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3660 #ifdef DOS_NT |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3661 { |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3662 char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3663 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3664 getwd (path); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3665 p = path; |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3666 while (*p) |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3667 if (*p == '\\') |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3668 *p++ = '/'; |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3669 else |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3670 *p++ = tolower (*p); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3671 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3672 return strdup (path); |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3673 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3674 #elif HAVE_GETCWD /* not DOS_NT */ |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3675 { |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3676 int bufsize = 200; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3677 char *path = xnew (bufsize, char); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3678 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3679 while (getcwd (path, bufsize) == NULL) |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3680 { |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
3681 if (errno != ERANGE) |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3682 pfatal ("pwd"); |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
3683 bufsize *= 2; |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3684 path = xnew (bufsize, char); |
8789
81a2817b99b2
(etags_getcwd): Use getcwd if available.
Karl Heuer <kwzh@gnu.org>
parents:
8180
diff
changeset
|
3685 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3686 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3687 return path; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3688 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3689 #else /* not DOS_NT and not HAVE_GETCWD */ |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3690 { |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3691 struct linebuffer path; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3692 FILE *pipe; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3693 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3694 initbuffer (&path); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3695 pipe = (FILE *) popen ("pwd 2>/dev/null", "r"); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3696 if (pipe == NULL || readline_internal (&path, pipe) == 0) |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3697 pfatal ("pwd"); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3698 pclose (pipe); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3699 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3700 return path.buffer; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3701 } |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3702 #endif /* not DOS_NT and not HAVE_GETCWD */ |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3703 |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3704 /* Return a newly allocated string containing the filename |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3705 of FILE relative to the absolute directory DIR (which |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3706 should end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3707 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3708 relative_filename (file, dir) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3709 char *file, *dir; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3710 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3711 char *fp, *dp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3712 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3713 /* Find the common root of file and dir. */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3714 fp = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3715 dp = dir; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3716 while (*fp++ == *dp++) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3717 continue; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3718 do |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3719 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3720 fp--; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3721 dp--; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3722 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3723 while (*fp != '/'); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3724 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3725 /* Build a sequence of "../" strings for the resulting relative filename. */ |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3726 for (dp = etags_strchr (dp + 1, '/'), res = ""; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3727 dp != NULL; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3728 dp = etags_strchr (dp + 1, '/')) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3729 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3730 res = concat (res, "../", ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3731 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3732 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3733 /* Add the filename relative to the common root of file and dir. */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3734 res = concat (res, fp + 1, ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3735 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3736 return res; /* temporary stub */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3737 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3738 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3739 /* Return a newly allocated string containing the |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3740 absolute filename of FILE given CWD (which should |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3741 end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3742 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3743 absolute_filename (file, cwd) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3744 char *file, *cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3745 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3746 char *slashp, *cp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3747 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3748 if (file[0] == '/') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3749 res = concat (file, "", ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3750 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3751 res = concat (cwd, file, ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3752 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3753 /* Delete the "/dirname/.." and "/." substrings. */ |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3754 slashp = etags_strchr (res, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3755 while (slashp != NULL && slashp[0] != '\0') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3756 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3757 if (slashp[1] == '.') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3758 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3759 if (slashp[2] == '.' |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3760 && (slashp[3] == '/' || slashp[3] == '\0')) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3761 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3762 cp = slashp; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3763 do |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3764 cp--; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3765 while (cp >= res && *cp != '/'); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3766 if (*cp == '/') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3767 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3768 strcpy (cp, slashp + 3); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3769 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3770 else /* else (cp == res) */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3771 { |
6944
daa29eabfc65
* etags.c (absolute_filename): compare against '\0' instead of NULL.
Francesco Potortì <pot@gnu.org>
parents:
6831
diff
changeset
|
3772 if (slashp[3] != '\0') |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3773 strcpy (cp, slashp + 4); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3774 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3775 return "."; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3776 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3777 slashp = cp; |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3778 continue; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3779 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3780 else if (slashp[2] == '/' || slashp[2] == '\0') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3781 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3782 strcpy (slashp, slashp + 2); |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3783 continue; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3784 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3785 } |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3786 |
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3787 slashp = etags_strchr (slashp + 1, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3788 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3789 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3790 return res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3791 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3792 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3793 /* Return a newly allocated string containing the absolute |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3794 filename of dir where FILE resides given CWD (which should |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3795 end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3796 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3797 absolute_dirname (file, cwd) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3798 char *file, *cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3799 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3800 char *slashp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3801 char save; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3802 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3803 slashp = etags_strrchr (file, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3804 if (slashp == NULL) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3805 return cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3806 save = slashp[1]; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3807 slashp[1] = '\0'; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3808 res = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3809 slashp[1] = save; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3810 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3811 return res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3812 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3813 |
240 | 3814 /* Like malloc but get fatal error if memory is exhausted. */ |
3815 char * | |
3816 xmalloc (size) | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3817 unsigned int size; |
240 | 3818 { |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3819 char *result = (char *) malloc (size); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3820 if (result == NULL) |
240 | 3821 fatal ("virtual memory exhausted", 0); |
3822 return result; | |
3823 } | |
3824 | |
3825 char * | |
3826 xrealloc (ptr, size) | |
3827 char *ptr; | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3828 unsigned int size; |
240 | 3829 { |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3830 char *result = (char *) realloc (ptr, size); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3831 if (result == NULL) |
240 | 3832 fatal ("virtual memory exhausted"); |
3833 return result; | |
3834 } |