Mercurial > emacs
annotate lib-src/etags.c @ 11524:cafa503e806c
(print-help-return-message): Check same-window-buffer-names
and same-window-regexps.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 24 Apr 1995 15:13:20 +0000 |
parents | 3cf67df24e7f |
children | 46d2178719ad |
rev | line source |
---|---|
240 | 1 /* Tags file maker to go with GNU Emacs |
11231 | 2 Copyright (C) 1984, 87, 88, 89, 93, 94, 95 |
3 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
|
4 This file is not considered part of GNU Emacs. |
240 | 5 |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
6 This program is free software; you can redistribute it and/or modify |
240 | 7 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
|
8 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
|
9 (at your option) any later version. |
240 | 10 |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
11 This program is distributed in the hope that it will be useful, |
240 | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 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
|
17 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
|
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
240 | 19 |
20 /* | |
21 * Authors: | |
22 * Ctags originally by Ken Arnold. | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
23 * Fortran added by Jim Kleckner. |
240 | 24 * Ed Pelegri-Llopart added C typedefs. |
25 * Gnu Emacs TAGS format and modifications by RMS? | |
26 * 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
|
27 * 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
|
28 #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
|
29 * 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
|
30 #endif |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
31 * |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
32 * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer. |
240 | 33 */ |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
34 |
10990
c0ceaa45ded7
* etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents:
10801
diff
changeset
|
35 char pot_etags_version[] = "@(#) pot revision number is 11.26"; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
36 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
37 #define TRUE 1 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
38 #define FALSE 0 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
39 #ifndef DEBUG |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
40 # define DEBUG FALSE |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
41 #endif |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
42 |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
43 #ifdef MSDOS |
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
44 #include <fcntl.h> |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
45 #include <sys/param.h> |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
46 #endif /* MSDOS */ |
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
47 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
48 #ifdef WINDOWSNT |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
49 #include <stdlib.h> |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
50 #include <fcntl.h> |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
51 #include <string.h> |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
52 #define MAXPATHLEN _MAX_PATH |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
53 #endif |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
54 |
4052
9535e8ffb209
* etags.c (alloca): removed all references to it.
Jim Blandy <jimb@redhat.com>
parents:
4051
diff
changeset
|
55 #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
|
56 #include <config.h> |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
57 /* 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
|
58 of unexec. We don't want that here since we don't use unexec. */ |
6831 | 59 #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
|
60 #endif |
401 | 61 |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
62 #include <stdio.h> |
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
63 #include <ctype.h> |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
64 #include <errno.h> |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
65 #ifndef errno |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
66 extern int errno; |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
67 #endif |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
68 #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
|
69 #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
|
70 |
4804
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
71 #if !defined (S_ISREG) && defined (S_IFREG) |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
72 # 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
|
73 #endif |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
74 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
75 #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
|
76 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
77 #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
|
78 #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
|
79 #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
|
80 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
81 /* 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
|
82 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
|
83 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
|
84 #ifdef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
85 # undef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
86 # define CTAGS TRUE |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
87 #else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
88 # define CTAGS FALSE |
240 | 89 #endif |
90 | |
91 /* Exit codes for success and failure. */ | |
92 #ifdef VMS | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
93 #define GOOD 1 |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
94 #define BAD 0 |
240 | 95 #else |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
96 #define GOOD 0 |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
97 #define BAD 1 |
240 | 98 #endif |
99 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
100 /* C extensions. */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
101 #define C_PLPL 0x00001 /* C++ */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
102 #define C_STAR 0x00003 /* C* */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
103 #define YACC 0x10000 /* yacc file */ |
240 | 104 |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
105 #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
|
106 #define strneq(s,t,n) (strncmp (s, t, n) == 0) |
240 | 107 |
108 #define iswhite(arg) (_wht[arg]) /* T if char is white */ | |
109 #define begtoken(arg) (_btk[arg]) /* T if char can start token */ | |
110 #define intoken(arg) (_itk[arg]) /* T if char can be in token */ | |
111 #define endtoken(arg) (_etk[arg]) /* T if char ends tokens */ | |
112 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
113 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
114 * xnew -- allocate storage |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
115 * |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
116 * 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
|
117 */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
118 #define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type))) |
240 | 119 |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
120 typedef int logical; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
121 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
122 typedef struct nd_st |
240 | 123 { /* sorting structure */ |
124 char *name; /* function or type name */ | |
125 char *file; /* file name */ | |
126 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
|
127 logical named; /* list name separately */ |
240 | 128 logical been_warned; /* set if noticed dup */ |
129 int lno; /* line number tag is on */ | |
130 long cno; /* character number line starts on */ | |
131 char *pat; /* search pattern */ | |
132 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
|
133 } NODE; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
134 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
135 extern char *getenv (); |
240 | 136 |
137 char *concat (); | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
138 char *savenstr (), *savestr (); |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
139 char *etags_strchr (), *etags_strrchr (); |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
140 char *etags_getcwd (); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
141 char *relative_filename (), *absolute_filename (), *absolute_dirname (); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
142 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
|
143 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
144 typedef void Lang_function (); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
145 #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
|
146 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
|
147 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
|
148 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 #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
|
160 void Asm_labels (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
161 void default_C_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
162 void C_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
163 void Cplusplus_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
164 void Cstar_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
165 void Fortran_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
166 void Yacc_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
167 void Lisp_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
168 void Pascal_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
169 void Prolog_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
170 void Scheme_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
171 void TeX_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
172 void just_read_file (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
173 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
174 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
175 logical get_language (); |
240 | 176 int total_size_of_entries (); |
177 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
|
178 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
|
179 #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
|
180 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
|
181 #endif |
240 | 182 void add_node (); |
183 void error (); | |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
184 void fatal (), pfatal (); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
185 void find_entries (); |
240 | 186 void free_tree (); |
187 void getit (); | |
188 void init (); | |
189 void initbuffer (); | |
190 void pfnote (); | |
191 void process_file (); | |
192 void put_entries (); | |
193 void takeprec (); | |
194 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
195 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
196 char searchar = '/'; /* use /.../ searches */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
197 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
198 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
|
199 long charno; /* current character number */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
200 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
201 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
|
202 but by every other language. */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
203 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
204 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
|
205 char *tagfile; /* output file */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
206 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
|
207 char *cwd; /* current working directory */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
208 char *tagfiledir; /* directory of tagfile */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
209 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
210 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
|
211 NODE *head; /* the head of the binary tree of tags */ |
240 | 212 |
213 /* | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
214 * 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
|
215 * `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
|
216 * regardless of the length of the line. |
240 | 217 */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
218 struct linebuffer |
240 | 219 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
220 long size; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
221 char *buffer; |
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 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
224 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
|
225 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
|
226 struct |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
227 { |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
228 long linepos; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
229 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
|
230 } lbs[2]; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
231 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
232 /* boolean "functions" (see init) */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
233 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
|
234 char |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
235 *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
|
236 *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
|
237 /* 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
|
238 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~", |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
239 /* valid in-token chars */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
240 *intk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; |
240 | 241 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
242 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
|
243 /* 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
|
244 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
|
245 logical typedefs_and_cplusplus; /* -T: create tags for typedefs, level */ |
240 | 246 /* 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
|
247 /* member functions. */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
248 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
|
249 /* constants. Enum consts not implemented. */ |
240 | 250 /* -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
|
251 logical update; /* -u: update tags */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
252 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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 #define permit_duplicates TRUE /* allow duplicate tags */ |
240 | 258 |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
259 struct option longopts[] = |
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
260 { |
621 | 261 { "append", no_argument, NULL, 'a' }, |
262 { "backward-search", no_argument, NULL, 'B' }, | |
263 { "c++", no_argument, NULL, 'C' }, | |
264 { "cxref", no_argument, NULL, 'x' }, | |
265 { "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
|
266 { "help", no_argument, NULL, 'h' }, |
621 | 267 { "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
|
268 { "ignore-indentation", no_argument, NULL, 'I' }, |
621 | 269 { "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
|
270 { "language", required_argument, NULL, 'l' }, |
621 | 271 { "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
|
272 { "no-regex", no_argument, NULL, 'R' }, |
621 | 273 { "no-warn", no_argument, NULL, 'w' }, |
274 { "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
|
275 { "regex", required_argument, NULL, 'r' }, |
621 | 276 { "typedefs", no_argument, NULL, 't' }, |
277 { "typedefs-and-c++", no_argument, NULL, 'T' }, | |
278 { "update", no_argument, NULL, 'u' }, | |
279 { "version", no_argument, NULL, 'V' }, | |
280 { "vgrind", no_argument, NULL, 'v' }, | |
281 { 0 } | |
282 }; | |
283 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
284 #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
|
285 /* 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
|
286 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
|
287 struct pattern |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
288 { |
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_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
|
290 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
|
291 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
|
292 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
|
293 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
294 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
295 /* 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
|
296 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
|
297 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
298 /* 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
|
299 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
|
300 #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
|
301 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
302 /* Language stuff. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
303 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
|
304 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
305 char *extension; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
306 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
|
307 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
308 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
309 /* 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
|
310 /* 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
|
311 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
|
312 /* "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
|
313 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
|
314 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
315 { "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
|
316 { "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
|
317 { "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
|
318 { "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
|
319 { "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
|
320 { "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
|
321 { "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
|
322 { "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
|
323 { "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
|
324 { "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
|
325 { "auto", NULL }, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
326 { NULL, NULL } |
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
329 /* 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
|
330 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
|
331 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
332 /* 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
|
333 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
|
334 { "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
|
335 { "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
|
336 { "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
|
337 { "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
|
338 { "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
|
339 { "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
|
340 { "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
|
341 { "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
|
342 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
343 /* .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
|
344 { "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
|
345 { "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
|
346 { "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
|
347 { "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
|
348 { "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
|
349 { "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
|
350 { "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
|
351 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
352 /* .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
|
353 { "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
|
354 { "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
|
355 { "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
|
356 { "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
|
357 { "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
|
358 { "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
|
359 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
360 /* .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
|
361 { "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
|
362 { "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
|
363 { "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
|
364 { "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
|
365 { "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
|
366 { "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
|
367 { "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
|
368 { "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
|
369 /* 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
|
370 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
371 /* 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
|
372 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
|
373 { "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
|
374 { "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
|
375 |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
376 /* .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
|
377 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
|
378 { "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
|
379 { "H", Cplusplus_entries }, |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
380 { "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
|
381 { "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
|
382 { "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
|
383 { "cxx", Cplusplus_entries }, |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
384 { "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
|
385 { "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
|
386 { "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
|
387 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
388 /* .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
|
389 { "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
|
390 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
391 /* .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
|
392 { "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
|
393 { "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
|
394 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
395 /* .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
|
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 { "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
|
398 { "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
|
399 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
400 /* .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
|
401 { "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
|
402 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
403 /* .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
|
404 { "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
|
405 { "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
|
406 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
407 { NULL, NULL } |
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
410 /* 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
|
411 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
|
412 |
240 | 413 |
414 void | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
415 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
|
416 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
417 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
|
418 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
419 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
|
420 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
|
421 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
|
422 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 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
|
427 puts (""); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
428 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
429 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
|
430 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
|
431 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
|
432 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
|
433 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
434 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
435 void |
621 | 436 print_version () |
437 { | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
438 #ifdef VERSION |
7049
47965b6c2195
(print_version): Print VERSION as a string.
Richard M. Stallman <rms@gnu.org>
parents:
6945
diff
changeset
|
439 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
|
440 #else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
441 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
|
442 #endif |
621 | 443 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
444 exit (GOOD); |
621 | 445 } |
446 | |
447 void | |
448 print_help () | |
449 { | |
450 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
|
451 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
|
452 names from stdin.\n\n", progname); |
621 | 453 |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
454 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
|
455 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
|
456 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
457 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
458 puts ("-B, --backward-search\n\ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
459 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
|
460 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
|
461 |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
462 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
|
463 Treat files whose extension defaults to C language as C++ files."); |
621 | 464 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
465 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
466 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
|
467 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
|
468 else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
469 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
|
470 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
|
471 the tags file smaller."); |
621 | 472 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
473 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
|
474 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
475 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
|
476 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
|
477 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
|
478 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
|
479 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
|
480 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
|
481 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
|
482 } |
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
483 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
484 #ifdef ETAGS_REGEXPS |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
485 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
|
486 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
|
487 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
|
488 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
|
489 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
|
490 --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
|
491 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
|
492 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
|
493 #endif /* ETAGS_REGEXPS */ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
494 puts ("-o FILE, --output=FILE\n\ |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
495 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
|
496 puts ("-I, --ignore-indentation\n\ |
621 | 497 Don't rely on indentation quite as much as normal. Currently,\n\ |
498 this means not to assume that a closing brace in the first\n\ | |
499 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
|
500 definition in C and C++."); |
621 | 501 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
502 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
503 { |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
504 puts ("-t, --typedefs\n\ |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
505 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
|
506 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
|
507 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
|
508 and C++ member functions."); |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
509 puts ("-u, --update\n\ |
621 | 510 Update the tag entries for the given files, leaving tag\n\ |
511 entries for other files in place. Currently, this is\n\ | |
512 implemented by deleting the existing entries for the given\n\ | |
513 files and then rewriting the new entries at the end of the\n\ | |
514 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
|
515 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
|
516 puts ("-v, --vgrind\n\ |
621 | 517 Generates an index of items intended for human consumption,\n\ |
518 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
|
519 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
|
520 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
|
521 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
|
522 files."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
523 puts ("-x, --cxref\n\ |
621 | 524 Like --vgrind, but in the style of cxref, rather than vgrind.\n\ |
525 The output uses line numbers instead of page numbers, but\n\ | |
526 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
|
527 which you like."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
528 } |
621 | 529 |
530 puts ("-V, --version\n\ | |
531 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
|
532 -h, --help\n\ |
621 | 533 Print this help message."); |
534 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
535 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
|
536 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
537 exit (GOOD); |
621 | 538 } |
539 | |
540 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
541 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
|
542 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
543 at_language, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
544 at_regexp, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
545 at_filename |
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
548 /* 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
|
549 typedef struct |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
550 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
551 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
|
552 char *what; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
553 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
|
554 } ARGUMENT; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
555 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
556 #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
|
557 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
558 #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
|
559 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
560 /* 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
|
561 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
|
562 #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
|
563 typedef struct { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
564 short curlen; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
565 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
|
566 } vspec; |
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 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 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
|
577 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
|
578 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
579 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
|
580 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
|
581 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
|
582 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
|
583 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
584 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
585 #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
|
586 #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
|
587 #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
|
588 short |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
589 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
|
590 vspec *out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
591 char *in; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
592 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
593 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
|
594 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
|
595 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
|
596 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
|
597 long status; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
598 short retval; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
599 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
600 if (pass1) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
601 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
602 pass1 = FALSE; |
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$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
|
604 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
|
605 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
|
606 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
|
607 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
|
608 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
|
609 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
|
610 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
|
611 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
612 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
|
613 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
614 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
|
615 return 1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
616 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
617 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
|
618 retval = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
619 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
620 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
621 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
|
622 retval = -1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
623 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
624 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
|
625 pass1 = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
626 return retval; |
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 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
630 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
|
631 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
|
632 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
633 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
634 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
|
635 char *arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
636 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
|
637 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
638 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
|
639 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
640 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
|
641 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
642 case 1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
643 *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
|
644 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
|
645 case 0: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
646 *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
|
647 return NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
648 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
649 *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
|
650 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
|
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
654 #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
|
655 system (cmd) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
656 char *cmd; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
657 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
658 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
|
659 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
660 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
661 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
662 #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
|
663 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
|
664 char *s; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
665 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
666 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
|
667 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
668 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
|
669 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
|
670 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
671 *s = EOS; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
672 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
673 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
674 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
675 *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
|
676 return start; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
677 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
678 #endif /* VMS */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
679 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
680 |
621 | 681 void |
240 | 682 main (argc, argv) |
683 int argc; | |
684 char *argv[]; | |
685 { | |
686 int i; | |
401 | 687 unsigned int nincluded_files = 0; |
4052
9535e8ffb209
* etags.c (alloca): removed all references to it.
Jim Blandy <jimb@redhat.com>
parents:
4051
diff
changeset
|
688 char **included_files = xnew (argc, char *); |
240 | 689 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
|
690 ARGUMENT *argbuffer; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
691 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
|
692 struct linebuffer filename_lb; |
240 | 693 #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
|
694 logical got_err; |
240 | 695 #endif |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
696 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
697 #ifdef DOS_NT |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
698 _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
|
699 #endif /* DOS_NT */ |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
700 |
240 | 701 progname = argv[0]; |
702 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
703 /* 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
|
704 is small. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
705 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
|
706 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
707 #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
|
708 /* 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
|
709 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
|
710 #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
|
711 |
240 | 712 /* |
713 * If etags, always find typedefs and structure tags. Why not? | |
714 * Also default is to find macro constants. | |
715 */ | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
716 if (!CTAGS) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
717 typedefs = typedefs_and_cplusplus = constantypedefs = TRUE; |
240 | 718 |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
719 while (1) |
240 | 720 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
721 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
|
722 "-aCdDf:Il:o:r:RStTi:BuvxwVhH", longopts, 0); |
621 | 723 |
724 if (opt == EOF) | |
725 break; | |
726 | |
727 switch (opt) | |
240 | 728 { |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
729 case 0: |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
730 /* If getopt returns 0, then it has already processed a |
621 | 731 long-named option. We should do nothing. */ |
732 break; | |
240 | 733 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
734 case 1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
735 /* 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
|
736 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
|
737 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
|
738 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
739 ++file_count; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
740 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
741 |
621 | 742 /* Common options. */ |
743 case 'a': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
744 append_to_tagfile = TRUE; |
621 | 745 break; |
746 case 'C': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
747 cplusplus = TRUE; |
621 | 748 break; |
749 case 'd': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
750 constantypedefs = TRUE; |
621 | 751 break; |
752 case 'D': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
753 constantypedefs = FALSE; |
621 | 754 break; |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
755 case 'f': /* for compatibility with old makefiles */ |
621 | 756 case 'o': |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
757 if (tagfile) |
621 | 758 { |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
759 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
|
760 progname, opt); |
240 | 761 goto usage; |
762 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
763 tagfile = optarg; |
621 | 764 break; |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
765 case 'I': |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
766 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
|
767 noindentypedefs = TRUE; |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
768 break; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
769 case 'l': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
770 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
|
771 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
772 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
|
773 progname, optarg); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
774 goto usage; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
775 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
776 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
|
777 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
778 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
779 #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
|
780 case 'r': |
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].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
|
782 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
|
783 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
784 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
785 case 'R': |
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].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
|
787 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
|
788 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
789 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
790 #endif /* ETAGS_REGEXPS */ |
621 | 791 case 'V': |
792 print_version (); | |
793 break; | |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
794 case 'h': |
621 | 795 case 'H': |
796 print_help (); | |
797 break; | |
8180
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
798 case 't': |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
799 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
|
800 break; |
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
801 case 'T': |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
802 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
|
803 break; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
804 #if (!CTAGS) |
621 | 805 /* Etags options */ |
806 case 'i': | |
807 included_files[nincluded_files++] = optarg; | |
808 break; | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
809 #else /* CTAGS */ |
621 | 810 /* Ctags options. */ |
811 case 'B': | |
812 searchar = '?'; | |
813 break; | |
814 case 'u': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
815 update = TRUE; |
621 | 816 break; |
817 case 'v': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
818 vgrind_style = TRUE; |
621 | 819 /*FALLTHRU*/ |
820 case 'x': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
821 cxref_style = TRUE; |
621 | 822 break; |
823 case 'w': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
824 no_warnings = TRUE; |
621 | 825 break; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
826 #endif /* CTAGS */ |
621 | 827 default: |
828 goto usage; | |
240 | 829 } |
830 } | |
831 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
832 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
|
833 { |
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].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
|
835 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
|
836 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
837 ++file_count; |
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
840 if (nincluded_files == 0 && file_count == 0) |
240 | 841 { |
621 | 842 fprintf (stderr, "%s: No input files specified.\n", progname); |
843 | |
240 | 844 usage: |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
845 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
|
846 progname); |
240 | 847 exit (BAD); |
848 } | |
849 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
850 if (tagfile == NULL) |
240 | 851 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
852 tagfile = CTAGS ? "tags" : "TAGS"; |
240 | 853 } |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
854 cwd = etags_getcwd (); /* the current working directory */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
855 strcat (cwd, "/"); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
856 if (streq (tagfile, "-")) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
857 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
858 tagfiledir = cwd; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
859 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
860 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
861 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
862 tagfiledir = absolute_dirname (tagfile, cwd); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
863 } |
240 | 864 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
865 init (); /* set up boolean "functions" */ |
240 | 866 |
867 initbuffer (&lb); | |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
868 initbuffer (&token_name); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
869 initbuffer (&lbs[0].lb); |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
870 initbuffer (&lbs[1].lb); |
240 | 871 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
|
872 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
873 if (!CTAGS) |
240 | 874 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
875 if (streq (tagfile, "-")) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
876 tagf = stdout; |
240 | 877 else |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
878 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
|
879 if (tagf == NULL) |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
880 pfatal (tagfile); |
240 | 881 } |
882 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
883 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
884 * 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
|
885 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
886 for (i = 0; i < current_arg; ++i) |
240 | 887 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
888 switch (argbuffer[i].arg_type) |
240 | 889 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
890 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
|
891 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
|
892 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
893 #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
|
894 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
|
895 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
|
896 break; |
240 | 897 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
898 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
|
899 #ifdef VMS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
900 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
|
901 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
902 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
|
903 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
904 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
|
905 argc--, argv++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
906 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
907 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
908 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
909 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
|
910 } |
240 | 911 #else |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
912 this_file = argbuffer[i].what; |
240 | 913 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
914 /* 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
|
915 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
|
916 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
|
917 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
|
918 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
|
919 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
920 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
|
921 #ifdef VMS |
240 | 922 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
923 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
924 break; |
240 | 925 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
926 } |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
927 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
928 if (!CTAGS) |
240 | 929 { |
401 | 930 while (nincluded_files-- > 0) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
931 fprintf (tagf, "\f\n%s,include\n", *included_files++); |
401 | 932 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
933 fclose (tagf); |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
934 exit (GOOD); |
240 | 935 } |
936 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
937 /* 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
|
938 because we want them ordered. Let's do it now. */ |
240 | 939 if (cxref_style) |
940 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
941 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
|
942 if (tagf == NULL) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
943 pfatal (tagfile); |
240 | 944 put_entries (head); |
945 exit (GOOD); | |
946 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
947 |
621 | 948 if (update) |
240 | 949 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
950 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
|
951 for (i = 0; i < current_arg; ++i) |
240 | 952 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
953 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
|
954 continue; |
240 | 955 sprintf (cmd, |
956 "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
|
957 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
|
958 if (system (cmd) != GOOD) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
959 fatal ("failed to execute shell command"); |
240 | 960 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
961 append_to_tagfile = TRUE; |
240 | 962 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
963 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
964 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
|
965 if (tagf == NULL) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
966 pfatal (tagfile); |
240 | 967 put_entries (head); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
968 fclose (tagf); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
969 |
240 | 970 if (update) |
971 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
972 char cmd[BUFSIZ]; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
973 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
|
974 exit (system (cmd)); |
240 | 975 } |
976 exit (GOOD); | |
977 } | |
978 | |
979 | |
980 /* | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
981 * 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
|
982 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
983 logical |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
984 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
|
985 char *language; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
986 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
|
987 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
988 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
|
989 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
990 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
|
991 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
992 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
|
993 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
994 *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
|
995 return TRUE; |
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
999 return FALSE; |
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1003 /* |
240 | 1004 * This routine is called on each file argument. |
1005 */ | |
1006 void | |
1007 process_file (file) | |
1008 char *file; | |
1009 { | |
1010 struct stat stat_buf; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1011 FILE *inf; |
240 | 1012 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1013 if (stat (file, &stat_buf) == 0 && !S_ISREG (stat_buf.st_mode)) |
240 | 1014 { |
1015 fprintf (stderr, "Skipping %s: it is not a regular file.\n", file); | |
1016 return; | |
1017 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1018 if (streq (file, tagfile) && !streq (tagfile, "-")) |
240 | 1019 { |
1020 fprintf (stderr, "Skipping inclusion of %s in self.\n", file); | |
1021 return; | |
1022 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1023 inf = fopen (file, "r"); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1024 if (inf == NULL) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1025 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1026 perror (file); |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1027 return; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1028 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1029 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1030 find_entries (file, inf); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1031 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1032 if (!CTAGS) |
240 | 1033 { |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1034 char *filename; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1035 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1036 if (file[0] == '/') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1037 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1038 /* file is an absolute filename. Canonicalise it. */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1039 filename = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1040 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1041 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1042 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1043 /* 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
|
1044 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
|
1045 filename = relative_filename (file, tagfiledir); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1046 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1047 fprintf (tagf, "\f\n%s,%d\n", filename, total_size_of_entries (head)); |
10990
c0ceaa45ded7
* etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents:
10801
diff
changeset
|
1048 free (filename); |
240 | 1049 put_entries (head); |
1050 free_tree (head); | |
1051 head = NULL; | |
1052 } | |
1053 } | |
1054 | |
1055 /* | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3569
diff
changeset
|
1056 * 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
|
1057 * by setting boolean flags dependent upon the corresponding character |
240 | 1058 * Every char which is NOT in that string is not a white char. Therefore, |
1059 * all of the array "_wht" is set to FALSE, and then the elements | |
1060 * subscripted by the chars in "white" are set to TRUE. Thus "_wht" | |
1061 * of a char is TRUE if it is the string "white", else FALSE. | |
1062 */ | |
1063 void | |
1064 init () | |
1065 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1066 register char *sp; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1067 register int i; |
240 | 1068 |
1069 for (i = 0; i < 0177; i++) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1070 _wht[i] = _etk[i] = _itk[i] = _btk[i] = FALSE; |
240 | 1071 for (sp = white; *sp; sp++) |
1072 _wht[*sp] = TRUE; | |
1073 for (sp = endtk; *sp; sp++) | |
1074 _etk[*sp] = TRUE; | |
1075 for (sp = intk; *sp; sp++) | |
1076 _itk[*sp] = TRUE; | |
1077 for (sp = begtk; *sp; sp++) | |
1078 _btk[*sp] = TRUE; | |
1079 _wht[0] = _wht['\n']; | |
1080 _etk[0] = _etk['\n']; | |
1081 _btk[0] = _btk['\n']; | |
1082 _itk[0] = _itk['\n']; | |
1083 } | |
1084 | |
1085 /* | |
1086 * This routine opens the specified file and calls the function | |
1087 * which finds the function and type definitions. | |
1088 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1089 void |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1090 find_entries (file, inf) |
240 | 1091 char *file; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1092 FILE *inf; |
240 | 1093 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1094 char *cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1095 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
|
1096 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
|
1097 extern NODE *last_node; |
240 | 1098 |
1099 curfile = savestr (file); | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
1100 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
|
1101 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1102 /* 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
|
1103 if (lang_func != NULL) |
240 | 1104 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1105 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
|
1106 fclose (inf); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1107 return; |
240 | 1108 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1109 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1110 if (cp) |
240 | 1111 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1112 ++cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1113 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
|
1114 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1115 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
|
1116 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1117 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
|
1118 fclose (inf); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1119 return; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1120 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1121 } |
240 | 1122 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1123 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1124 /* Try Fortran. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1125 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
|
1126 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
|
1127 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1128 /* 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
|
1129 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
|
1130 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
|
1131 fclose (inf); |
240 | 1132 } |
1133 | |
1134 /* Record a tag. */ | |
1135 void | |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
1136 pfnote (name, is_func, named, linestart, linelen, lno, cno) |
240 | 1137 char *name; /* tag name */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1138 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
|
1139 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
|
1140 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
|
1141 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
|
1142 int lno; /* line number */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1143 long cno; /* character number */ |
240 | 1144 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1145 register NODE *np = xnew (1, NODE); |
240 | 1146 register char *fp; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1147 |
240 | 1148 /* 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
|
1149 if (CTAGS && !cxref_style && streq (name, "main")) |
240 | 1150 { |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
1151 fp = etags_strrchr (curfile, '/'); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1152 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
|
1153 fp = etags_strrchr (np->name, '.'); |
240 | 1154 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
|
1155 fp[0] = 0; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1156 np->named = TRUE; |
240 | 1157 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1158 else |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1159 { |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1160 np->name = name; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1161 np->named = named; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1162 } |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
1163 np->been_warned = FALSE; |
240 | 1164 np->file = curfile; |
1165 np->is_func = is_func; | |
1166 np->lno = lno; | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1167 /* 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
|
1168 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
|
1169 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
|
1170 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
|
1171 uncomment the +1 below. */ |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1172 np->cno = cno /* + 1 */ ; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1173 np->left = np->right = NULL; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1174 np->pat = savenstr (linestart, ((CTAGS && !cxref_style) ? 50 : linelen)); |
240 | 1175 |
1176 add_node (np, &head); | |
1177 } | |
1178 | |
1179 /* | |
1180 * free_tree () | |
1181 * recurse on left children, iterate on right children. | |
1182 */ | |
1183 void | |
1184 free_tree (node) | |
1185 register NODE *node; | |
1186 { | |
1187 while (node) | |
1188 { | |
1189 register NODE *node_right = node->right; | |
1190 free_tree (node->left); | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1191 if (node->named) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1192 free (node->name); |
240 | 1193 free (node->pat); |
1194 free ((char *) node); | |
1195 node = node_right; | |
1196 } | |
1197 } | |
1198 | |
1199 /* | |
1200 * add_node () | |
1201 * Adds a node to the tree of nodes. In etags mode, we don't keep | |
1202 * it sorted; we just keep a linear list. In ctags mode, maintain | |
1203 * an ordered tree, with no attempt at balancing. | |
1204 * | |
1205 * add_node is the only function allowed to add nodes, so it can | |
1206 * maintain state. | |
1207 */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1208 NODE *last_node = NULL; |
240 | 1209 void |
1210 add_node (node, cur_node_p) | |
1211 NODE *node, **cur_node_p; | |
1212 { | |
1213 register int dif; | |
1214 register NODE *cur_node = *cur_node_p; | |
1215 | |
1216 if (cur_node == NULL) | |
1217 { | |
1218 *cur_node_p = node; | |
1219 last_node = node; | |
1220 return; | |
1221 } | |
1222 | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1223 if (!CTAGS) |
240 | 1224 { |
1225 /* Etags Mode */ | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1226 if (last_node == NULL) |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1227 fatal ("internal error in add_node", 0); |
240 | 1228 last_node->right = node; |
1229 last_node = node; | |
1230 } | |
1231 else | |
1232 { | |
1233 /* Ctags Mode */ | |
1234 dif = strcmp (node->name, cur_node->name); | |
1235 | |
1236 /* | |
1237 * If this tag name matches an existing one, then | |
1238 * do not add the node, but maybe print a warning. | |
1239 */ | |
1240 if (!dif) | |
1241 { | |
1242 if (node->file == cur_node->file) | |
1243 { | |
1244 if (!no_warnings) | |
1245 { | |
1246 fprintf (stderr, "Duplicate entry in file %s, line %d: %s\n", | |
1247 node->file, lineno, node->name); | |
1248 fprintf (stderr, "Second entry ignored\n"); | |
1249 } | |
1250 return; | |
1251 } | |
1252 if (!cur_node->been_warned && !no_warnings) | |
1253 { | |
1254 fprintf (stderr, | |
1255 "Duplicate entry in files %s and %s: %s (Warning only)\n", | |
1256 node->file, cur_node->file, node->name); | |
1257 } | |
1258 cur_node->been_warned = TRUE; | |
1259 return; | |
1260 } | |
1261 | |
1262 /* Maybe refuse to add duplicate nodes. */ | |
1263 if (!permit_duplicates) | |
1264 { | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1265 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
|
1266 && streq (node->file, cur_node->file)) |
240 | 1267 return; |
1268 } | |
1269 | |
1270 /* Actually add the node */ | |
1271 add_node (node, dif < 0 ? &cur_node->left : &cur_node->right); | |
1272 } | |
1273 } | |
1274 | |
1275 void | |
1276 put_entries (node) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1277 register NODE *node; |
240 | 1278 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1279 register char *sp; |
240 | 1280 |
1281 if (node == NULL) | |
1282 return; | |
1283 | |
1284 /* Output subentries that precede this one */ | |
1285 put_entries (node->left); | |
1286 | |
1287 /* Output this entry */ | |
1288 | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1289 if (!CTAGS) |
240 | 1290 { |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
1291 if (node->named) |
240 | 1292 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1293 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
|
1294 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
|
1295 node->lno, node->cno); |
240 | 1296 } |
1297 else | |
1298 { | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1299 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
|
1300 node->pat, |
ad13aac8bb60
(put_entries): For NODE->rewritten, put pattern before \177 and name after,
Roland McGrath <roland@gnu.org>
parents:
4126
diff
changeset
|
1301 node->lno, node->cno); |
240 | 1302 } |
1303 } | |
1304 else if (!cxref_style) | |
1305 { | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1306 fprintf (tagf, "%s\t%s\t", |
240 | 1307 node->name, node->file); |
1308 | |
1309 if (node->is_func) | |
1310 { /* a function */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1311 putc (searchar, tagf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1312 putc ('^', tagf); |
240 | 1313 |
1314 for (sp = node->pat; *sp; sp++) | |
1315 { | |
1316 if (*sp == '\\' || *sp == searchar) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1317 putc ('\\', tagf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1318 putc (*sp, tagf); |
240 | 1319 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1320 putc (searchar, tagf); |
240 | 1321 } |
1322 else | |
1323 { /* a typedef; text pattern inadequate */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1324 fprintf (tagf, "%d", node->lno); |
240 | 1325 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1326 putc ('\n', tagf); |
240 | 1327 } |
1328 else if (vgrind_style) | |
1329 fprintf (stdout, "%s %s %d\n", | |
1330 node->name, node->file, (node->lno + 63) / 64); | |
1331 else | |
727 | 1332 fprintf (stdout, "%-16s %3d %-16s %s\n", |
240 | 1333 node->name, node->lno, node->file, node->pat); |
1334 | |
1335 /* Output subentries that follow this one */ | |
1336 put_entries (node->right); | |
1337 } | |
1338 | |
1339 /* Length of a number's decimal representation. */ | |
1340 int | |
1341 number_len (num) | |
1342 long num; | |
1343 { | |
1344 int len = 0; | |
1345 if (!num) | |
1346 return 1; | |
1347 for (; num; num /= 10) | |
1348 ++len; | |
1349 return len; | |
1350 } | |
1351 | |
1352 /* | |
1353 * 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
|
1354 * 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
|
1355 * 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
|
1356 * 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
|
1357 * backward compatibility. |
240 | 1358 */ |
1359 int | |
1360 total_size_of_entries (node) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1361 register NODE *node; |
240 | 1362 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1363 register int total; |
240 | 1364 |
1365 if (node == NULL) | |
1366 return 0; | |
1367 | |
1368 total = 0; | |
1369 for (; node; node = node->right) | |
1370 { | |
1371 /* Count left subentries. */ | |
1372 total += total_size_of_entries (node->left); | |
1373 | |
1374 /* Count this entry */ | |
1375 total += strlen (node->pat) + 1; | |
1376 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
|
1377 if (node->named) |
240 | 1378 total += 1 + strlen (node->name); /* \001name */ |
1379 } | |
1380 | |
1381 return total; | |
1382 } | |
1383 | |
1384 /* | |
1385 * The C symbol tables. | |
1386 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1387 enum sym_type |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1388 { |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1389 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
|
1390 }; |
240 | 1391 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1392 /* 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
|
1393 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
|
1394 %[ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1395 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
|
1396 %% |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1397 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
|
1398 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
|
1399 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
|
1400 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
|
1401 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
|
1402 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
|
1403 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
|
1404 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
|
1405 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
|
1406 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
|
1407 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
|
1408 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
|
1409 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
|
1410 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
|
1411 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
|
1412 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
|
1413 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
|
1414 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
|
1415 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
|
1416 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
|
1417 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
|
1418 %] |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1419 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
|
1420 /*%<*/ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1421 /* 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
|
1422 /* Command-line: gperf -c -k1,3 -o -p -r -t */ |
240 | 1423 |
5580
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 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
|
1426 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1427 #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
|
1428 #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
|
1429 #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
|
1430 #define MAX_HASH_VALUE 62 |
240 | 1431 /* |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1432 21 keywords |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1433 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
|
1434 */ |
240 | 1435 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1436 static int |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1437 hash (str, len) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1438 register char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1439 register int len; |
240 | 1440 { |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1441 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
|
1442 { |
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, 62, 62, 62, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1451 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
|
1452 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
|
1453 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
|
1454 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
|
1455 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
|
1456 }; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1457 return len + hash_table[str[2]] + hash_table[str[0]]; |
240 | 1458 } |
1459 | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1460 struct C_stab_entry * |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1461 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
|
1462 register char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1463 register int len; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1464 { |
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 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
|
1467 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1468 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, |
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 {"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
|
1471 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1472 {"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
|
1473 {"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
|
1474 {"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
|
1475 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1476 {"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
|
1477 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1478 {"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
|
1479 {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1480 {"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
|
1481 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1482 {"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
|
1483 {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1484 {"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
|
1485 {"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
|
1486 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1487 {"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
|
1488 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1489 {"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
|
1490 {"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
|
1491 {"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
|
1492 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1493 {"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
|
1494 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1495 {"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
|
1496 {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1497 {"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
|
1498 {"",}, {"",}, {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1499 {"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
|
1500 {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1501 {"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
|
1502 {"",}, {"",}, |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1503 {"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
|
1504 {"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
|
1505 }; |
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 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
|
1508 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1509 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
|
1510 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1511 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
|
1512 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1513 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
|
1514 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1515 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
|
1516 return &wordlist[key]; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1517 } |
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 return 0; |
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 /*%>*/ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1522 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1523 enum sym_type |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1524 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
|
1525 char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1526 int len; |
240 | 1527 int c_ext; |
1528 { | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1529 register struct C_stab_entry *se = in_word_set(str, len); |
240 | 1530 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1531 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
|
1532 return st_none; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1533 return se->type; |
240 | 1534 } |
1535 | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1536 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1537 * 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
|
1538 * funcdef is its state variable. |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1539 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1540 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1541 { |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1542 fnone, /* nothing seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1543 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
|
1544 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
|
1545 finlist, /* in parameter list */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1546 flistseen, /* after parameter list */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
1547 fignore /* before open brace */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1548 } FUNCST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1549 FUNCST funcdef; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1550 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1551 |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1552 /* |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1553 * 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
|
1554 * typeddef is its state variable. |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1555 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1556 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1557 { |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1558 tnone, /* nothing seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1559 ttypedseen, /* typedef keyword seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1560 tinbody, /* inside typedef body */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1561 tend, /* just before typedef tag */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1562 tignore /* junk after typedef tag */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1563 } TYPEDST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1564 TYPEDST typdef; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1565 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1566 |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1567 /* |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1568 * 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
|
1569 * 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
|
1570 * variable. |
2323
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 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1573 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1574 snone, /* nothing seen yet */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1575 skeyseen, /* struct-like keyword seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1576 stagseen, /* struct-like tag seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1577 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
|
1578 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
|
1579 } STRUCTST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1580 STRUCTST structdef; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1581 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1582 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1583 * 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
|
1584 * 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
|
1585 * keyword. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1586 */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1587 char *structtag = "<uninited>"; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1588 enum sym_type structtype; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1589 |
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 * 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
|
1592 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1593 typedef enum |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1594 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1595 dnone, /* nothing seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1596 dsharpseen, /* '#' seen as first char on line */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1597 ddefineseen, /* '#' and 'define' seen */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
1598 dignorerest /* ignore rest of line */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1599 } DEFINEST; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1600 DEFINEST definedef; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1601 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1602 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1603 * 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
|
1604 * 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
|
1605 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1606 logical next_token_is_func; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1607 |
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 * 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
|
1610 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1611 logical yacc_rules; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1612 |
240 | 1613 /* |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1614 * consider_token () |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1615 * 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
|
1616 * 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
|
1617 * tag. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1618 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1619 * *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
|
1620 * 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
|
1621 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1622 * 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
|
1623 * 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
|
1624 * `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
|
1625 * whatever follows `operator'. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1626 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1627 * Globals |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1628 * funcdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1629 * structdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1630 * definedef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1631 * typdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1632 * next_token_is_func IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1633 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1634 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1635 logical |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1636 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
|
1637 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
|
1638 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
|
1639 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
|
1640 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
|
1641 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
|
1642 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
|
1643 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1644 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
|
1645 |
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 * Advance the definedef state machine. |
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 switch (definedef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1650 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1651 case dnone: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1652 /* 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
|
1653 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1654 case dsharpseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1655 if (toktype == st_C_define) |
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 definedef = ddefineseen; |
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 else |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1660 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1661 definedef = dignorerest; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1662 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1663 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1664 case ddefineseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1665 /* |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
1666 * 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
|
1667 * and constantypedefs is FALSE. |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1668 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1669 definedef = dignorerest; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1670 *is_func = (c == '('); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1671 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
|
1672 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1673 else |
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 TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1675 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
|
1676 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1677 default: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1678 error ("internal error: definedef value.", 0); |
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 |
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 * Now typedefs |
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 switch (typdef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1685 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1686 case tnone: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1687 if (toktype == st_C_typedef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1688 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1689 if (typedefs) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1690 typdef = ttypedseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1691 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
|
1692 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1693 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1694 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1695 case ttypedseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1696 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1697 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1698 case st_none: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1699 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1700 typdef = tend; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1701 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1702 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1703 case st_C_enum: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1704 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1705 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1706 /* 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
|
1707 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1708 case tend: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1709 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1710 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1711 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1712 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1713 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
|
1714 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1715 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1716 return TRUE; |
6756
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 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1719 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1720 * 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
|
1721 * 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
|
1722 * 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
|
1723 * within structs. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1724 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1725 * 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
|
1726 * 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
|
1727 * 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
|
1728 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1729 * 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
|
1730 * 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
|
1731 * 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
|
1732 * state machine. |
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 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1735 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1736 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1737 case st_C_enum: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1738 if (typdef == ttypedseen |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1739 || (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
|
1740 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1741 structdef = skeyseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1742 structtype = toktype; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1743 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1744 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1745 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1746 if (structdef == skeyseen) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1747 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1748 /* 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
|
1749 defined inside. */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1750 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
|
1751 structtag = savenstr (str, len); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1752 else |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1753 structtag = "<enum>"; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1754 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
|
1755 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1756 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1757 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1758 /* 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
|
1759 if (typdef != tnone) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1760 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1761 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
|
1762 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1763 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1764 |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1765 /* Detect GNU macros. */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1766 if (definedef == dnone) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1767 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
|
1768 #if FALSE |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1769 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
|
1770 are not met anyway. |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1771 || 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
|
1772 || 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
|
1773 #endif |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1774 || 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
|
1775 || 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
|
1776 || 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
|
1777 |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1778 { |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1779 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
|
1780 return FALSE; |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1781 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1782 if (next_token_is_func) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1783 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1784 next_token_is_func = FALSE; |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1785 funcdef = fignore; |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1786 *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
|
1787 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1788 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1789 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1790 /* A function? */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1791 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1792 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1793 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1794 if (funcdef != finlist && funcdef != fignore) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1795 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
|
1796 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1797 default: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1798 if (funcdef == fnone) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1799 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1800 funcdef = ftagseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1801 *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
|
1802 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1803 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1804 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1805 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1806 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1807 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1808 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1809 /* |
240 | 1810 * C_entries () |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1811 * 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
|
1812 * struct/union/enum definitions in C syntax and adds them |
240 | 1813 * to the list. |
1814 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1815 typedef struct |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1816 { |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1817 logical valid; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1818 char *str; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1819 logical named; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1820 int linelen; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1821 int lineno; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
1822 long linepos; |
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
1823 char *buffer; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1824 } TOKEN; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1825 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1826 #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
|
1827 #define switch_line_buffers() (curndx = 1 - curndx) |
240 | 1828 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1829 #define curlb (lbs[curndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1830 #define othlb (lbs[1-curndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1831 #define newlb (lbs[newndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1832 #define curlinepos (lbs[curndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1833 #define othlinepos (lbs[1-curndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1834 #define newlinepos (lbs[newndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1835 |
240 | 1836 #define CNL_SAVE_DEFINEDEF \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1837 do { \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1838 curlinepos = charno; \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1839 lineno++; \ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1840 charno += readline (&curlb, inf); \ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1841 lp = curlb.buffer; \ |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1842 quotednl = FALSE; \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1843 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
|
1844 } while (0) |
240 | 1845 |
1846 #define CNL \ | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1847 do { \ |
240 | 1848 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
|
1849 if (savetok.valid) \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1850 { \ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1851 tok = savetok; \ |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1852 savetok.valid = FALSE; \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1853 } \ |
240 | 1854 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
|
1855 } while (0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1856 |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1857 #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
|
1858 { \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1859 if (tok.valid) \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1860 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
|
1861 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
|
1862 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
|
1863 tok.valid = FALSE; \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1864 } while (0) |
240 | 1865 |
1866 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1867 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
|
1868 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
|
1869 FILE *inf; /* input file */ |
240 | 1870 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1871 register char c; /* latest char read; '\0' for end of line */ |
240 | 1872 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
|
1873 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
|
1874 TOKEN tok; /* latest token read */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1875 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
|
1876 register int toklen; /* length of current token */ |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
1877 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
|
1878 int parlev; /* current parenthesis level */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1879 logical incomm, inquote, inchar, quotednl, midtoken; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1880 logical cplpl; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1881 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
|
1882 |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
1883 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1884 curndx = newndx = 0; |
240 | 1885 lineno = 0; |
1886 charno = 0; | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1887 lp = curlb.buffer; |
240 | 1888 *lp = 0; |
1889 | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1890 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
|
1891 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
|
1892 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
|
1893 tok.valid = savetok.valid = FALSE; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
1894 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
|
1895 parlev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1896 cplpl = c_ext & C_PLPL; |
240 | 1897 |
1898 while (!feof (inf)) | |
1899 { | |
1900 c = *lp++; | |
1901 if (c == '\\') | |
1902 { | |
621 | 1903 /* If we're at the end of the line, the next character is a |
1904 '\0'; don't skip it, because it's the thing that tells us | |
1905 to read the next line. */ | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1906 if (*lp == '\0') |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1907 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1908 quotednl = TRUE; |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1909 continue; |
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
1910 } |
401 | 1911 lp++; |
240 | 1912 c = ' '; |
1913 } | |
1914 else if (incomm) | |
1915 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1916 switch (c) |
240 | 1917 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1918 case '*': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1919 if (*lp == '/') |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1920 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1921 c = *lp++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1922 incomm = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1923 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1924 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1925 case '\0': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1926 /* 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
|
1927 traditional cpp. */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1928 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1929 break; |
240 | 1930 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1931 continue; |
240 | 1932 } |
1933 else if (inquote) | |
1934 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1935 switch (c) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1936 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1937 case '"': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1938 inquote = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1939 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1940 case '\0': |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1941 /* 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
|
1942 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
|
1943 usually accept them. */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1944 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1945 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1946 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1947 continue; |
240 | 1948 } |
1949 else if (inchar) | |
1950 { | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1951 switch (c) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1952 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1953 case '\0': |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1954 /* Hmmm, something went wrong. */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1955 CNL; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1956 /* FALLTHRU */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1957 case '\'': |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1958 inchar = FALSE; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1959 break; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1960 } |
240 | 1961 continue; |
1962 } | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1963 else |
240 | 1964 switch (c) |
1965 { | |
1966 case '"': | |
1967 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
|
1968 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
|
1969 funcdef = fnone; |
240 | 1970 continue; |
1971 case '\'': | |
1972 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
|
1973 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
|
1974 funcdef = fnone; |
240 | 1975 continue; |
1976 case '/': | |
1977 if (*lp == '*') | |
1978 { | |
1979 lp++; | |
1980 incomm = TRUE; | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1981 continue; |
240 | 1982 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1983 else if (cplpl && *lp == '/') |
240 | 1984 { |
727 | 1985 c = 0; |
1986 break; | |
240 | 1987 } |
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
|
1988 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
|
1989 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1990 case '%': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1991 if ((c_ext & YACC) && *lp == '%') |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1992 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1993 /* 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
|
1994 lp++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1995 definedef = dnone; funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1996 typdef = tnone; structdef = snone; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1997 next_token_is_func = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1998 midtoken = inquote = inchar = incomm = quotednl = FALSE; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
1999 cblev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2000 yacc_rules = !yacc_rules; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2001 continue; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2002 } |
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
|
2003 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
|
2004 break; |
240 | 2005 case '#': |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2006 if (definedef == dnone) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2007 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2008 char *cp; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2009 logical cpptoken = TRUE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2010 |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2011 /* 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
|
2012 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
|
2013 token. */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2014 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
|
2015 if (!iswhite (*cp)) |
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 if (*cp == '*' && *(cp+1) == '/') |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2018 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2019 cp++; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2020 cpptoken = TRUE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2021 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2022 else |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2023 cpptoken = FALSE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2024 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2025 if (cpptoken) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2026 definedef = dsharpseen; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2027 } /* if (definedef == dnone) */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2028 |
240 | 2029 continue; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2030 } /* switch (c) */ |
240 | 2031 |
2032 | |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2033 /* 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
|
2034 if ((definedef != dnone |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2035 || (cblev == 0 && structdef != scolonseen) |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2036 || (cblev == 1 && cplpl && structdef == sinbody)) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2037 && typdef != tignore |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2038 && definedef != dignorerest |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2039 && funcdef != finlist) |
240 | 2040 { |
2041 if (midtoken) | |
2042 { | |
2043 if (endtoken (c)) | |
2044 { | |
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
|
2045 if (cplpl && c == ':' && *lp == ':' && begtoken(*(lp + 1))) |
240 | 2046 { |
2047 /* | |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2048 * 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
|
2049 * beginning of an identifier. |
240 | 2050 */ |
2051 lp += 2; | |
2052 toklen += 3; | |
2053 } | |
2054 else | |
2055 { | |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2056 logical is_func = FALSE; |
240 | 2057 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2058 if (yacc_rules |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2059 || 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
|
2060 c, c_ext, cblev, &is_func)) |
240 | 2061 { |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
2062 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
|
2063 && definedef == dnone |
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2064 && is_func) |
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2065 /* 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
|
2066 { |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2067 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
|
2068 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
|
2069 { |
10801
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 *= 2; |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2071 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
|
2072 token_name.size); |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2073 } |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2074 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
|
2075 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
|
2076 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
|
2077 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
|
2078 tok.named = TRUE; |
240 | 2079 } |
2080 else | |
2081 { | |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2082 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
|
2083 { |
10801
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 *= 2; |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2085 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
|
2086 token_name.size); |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2087 } |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2088 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
|
2089 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
|
2090 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
|
2091 if (structdef == stagseen |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2092 || typdef == tend |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2093 || (is_func |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2094 && definedef == dignorerest)) /* macro */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2095 tok.named = TRUE; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2096 else |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2097 tok.named = FALSE; |
240 | 2098 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2099 tok.lineno = lineno; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2100 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
|
2101 tok.buffer = newlb.buffer; |
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2102 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
|
2103 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
|
2104 |
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
|
2105 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
|
2106 && (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
|
2107 || 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
|
2108 || typdef == tend)) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2109 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2110 if (current_lb_is_new) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2111 switch_line_buffers (); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2112 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2113 else |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2114 make_tag (is_func); |
240 | 2115 } |
2116 midtoken = FALSE; | |
2117 } | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2118 } /* if (endtoken (c)) */ |
240 | 2119 else if (intoken (c)) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2120 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2121 toklen++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2122 continue; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2123 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2124 } /* if (midtoken) */ |
240 | 2125 else if (begtoken (c)) |
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 switch (definedef) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2128 { |
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
|
2129 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
|
2130 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
|
2131 { |
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 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
|
2133 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
|
2134 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
|
2135 case flistseen: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2136 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
|
2137 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
|
2138 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
|
2139 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
|
2140 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
|
2141 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
|
2142 } |
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
|
2143 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
|
2144 structdef = snone; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2145 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
|
2146 case dsharpseen: |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
2147 savetok = tok; |
2323
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 if (!yacc_rules || lp == newlb.buffer + 1) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2150 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2151 tokoff = lp - 1 - newlb.buffer; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2152 toklen = 1; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2153 midtoken = TRUE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2154 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2155 continue; |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
2156 } /* if (begtoken) */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2157 } /* if must look at token */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2158 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2159 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2160 /* 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
|
2161 after having handled a token.*/ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2162 switch (c) |
401 | 2163 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2164 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
|
2165 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
|
2166 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2167 if (structdef == stagseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2168 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
|
2169 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
|
2170 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
|
2171 { |
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 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
|
2173 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
|
2174 { |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2175 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
|
2176 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
|
2177 } |
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 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
|
2179 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
|
2180 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
|
2181 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
|
2182 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2183 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2184 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
|
2185 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
|
2186 break; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2187 if (cblev == 0) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2188 switch (typdef) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2189 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2190 case tend: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2191 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2192 /* FALLTHRU */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2193 default: |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2194 typdef = tnone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2195 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2196 if (funcdef != fignore) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2197 funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2198 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2199 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2200 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2201 case ',': |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2202 if (definedef != dnone) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2203 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2204 if (funcdef != finlist && funcdef != fignore) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2205 funcdef = fnone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2206 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2207 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2208 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2209 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
|
2210 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
|
2211 break; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2212 if (cblev == 0 && typdef == tend) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2213 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2214 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2215 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2216 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2217 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2218 if (funcdef != finlist && funcdef != fignore) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2219 funcdef = fnone; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2220 if (structdef == stagseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2221 structdef = snone; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2222 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2223 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
|
2224 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
|
2225 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2226 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
|
2227 { |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2228 case fnone: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2229 switch (typdef) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2230 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2231 case ttypedseen: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2232 case tend: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2233 /* 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
|
2234 This handles constructs like: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2235 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
|
2236 if (*lp != '*') |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2237 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2238 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2239 make_tag (FALSE); |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2240 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2241 break; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2242 } /* switch (typdef) */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2243 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2244 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
|
2245 funcdef = fstartlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2246 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2247 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
|
2248 funcdef = finlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2249 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
|
2250 } |
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
|
2251 parlev++; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2252 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2253 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
|
2254 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
|
2255 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
|
2256 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
|
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 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
|
2259 { |
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 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
|
2261 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
|
2262 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
|
2263 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
|
2264 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2265 if (cblev == 0 && typdef == tend) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2266 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2267 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2268 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2269 } |
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
|
2270 } |
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
|
2271 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
|
2272 parlev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2273 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2274 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
|
2275 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
|
2276 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2277 if (typdef == ttypedseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2278 typdef = tinbody; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2279 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
|
2280 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2281 case skeyseen: /* unnamed struct */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2282 structtag = "_anonymous_"; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2283 structdef = sinbody; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2284 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2285 case stagseen: |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2286 case scolonseen: /* named struct */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2287 structdef = sinbody; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2288 make_tag (FALSE); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2289 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
|
2290 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2291 switch (funcdef) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2292 { |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2293 case flistseen: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2294 make_tag (TRUE); |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2295 /* FALLTHRU */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2296 case fignore: |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2297 funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2298 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2299 case fnone: |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
2300 /* 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
|
2301 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
|
2302 cblev = -1; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2303 } |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2304 cblev++; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2305 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2306 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
|
2307 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
|
2308 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
|
2309 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
|
2310 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
|
2311 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2312 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
|
2313 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
|
2314 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2315 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
|
2316 { |
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 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
|
2318 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
|
2319 } |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2320 else if (cblev > 0) |
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2321 cblev--; |
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2322 if (cblev == 0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2323 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2324 if (typdef == tinbody) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2325 typdef = tend; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2326 #if FALSE /* too risky */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2327 if (structdef == sinbody) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2328 free (structtag); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2329 #endif |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
2330 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2331 structdef = snone; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2332 structtag = "<error>"; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2333 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2334 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
|
2335 case '=': |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2336 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
|
2337 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
|
2338 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
|
2339 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
|
2340 /* 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
|
2341 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
|
2342 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
|
2343 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2344 case '\0': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2345 /* 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
|
2346 if (quotednl) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2347 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2348 else |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2349 CNL; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2350 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2351 } /* switch (c) */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2352 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2353 } /* while not eof */ |
240 | 2354 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2355 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2356 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2357 * 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
|
2358 * 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
|
2359 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2360 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2361 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
|
2362 FILE *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 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
|
2365 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2366 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2367 /* 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
|
2368 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2369 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
|
2370 FILE *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 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
|
2373 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2374 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2375 /* 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
|
2376 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2377 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
|
2378 FILE *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 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
|
2381 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2382 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2383 /* 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
|
2384 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2385 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
|
2386 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2387 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2388 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
|
2389 } |
240 | 2390 |
2391 /* Fortran parsing */ | |
2392 | |
2393 char *dbp; | |
2394 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2395 logical |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2396 tail (cp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2397 char *cp; |
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 register int len = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2400 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2401 while (*cp && (*cp | ' ') == (dbp[len] | ' ')) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2402 cp++, len++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2403 if (*cp == 0) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2404 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2405 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
|
2406 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2407 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2408 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2409 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2410 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2411 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2412 takeprec () |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2413 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2414 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2415 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2416 if (*dbp != '*') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2417 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2418 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2419 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2420 dbp++; |
8180
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
2421 if (tail ("(*)")) |
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
2422 return; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2423 if (!isdigit (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2424 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2425 --dbp; /* force failure */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2426 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2427 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2428 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2429 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2430 while (isdigit (*dbp)); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2431 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2432 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2433 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2434 getit (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2435 FILE *inf; |
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 register char *cp; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2438 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2439 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2440 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2441 if (*dbp == '\0') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2442 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2443 lineno++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2444 linecharno = charno; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2445 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2446 dbp = lb.buffer; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2447 if (dbp[5] != '&') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2448 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2449 dbp += 6; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2450 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2451 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2452 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2453 if (!isalpha (*dbp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2454 && *dbp != '_' |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2455 && *dbp != '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2456 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2457 for (cp = dbp + 1; |
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 && (isalpha (*cp) || isdigit (*cp) || (*cp == '_') || (*cp == '$'))); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2460 cp++) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2461 continue; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2462 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
|
2463 cp - lb.buffer + 1, lineno, linecharno); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2464 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2465 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2466 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2467 Fortran_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2468 FILE *inf; |
240 | 2469 { |
2470 lineno = 0; | |
2471 charno = 0; | |
2472 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2473 while (!feof (inf)) |
240 | 2474 { |
2475 lineno++; | |
2476 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2477 charno += readline (&lb, inf); |
240 | 2478 dbp = lb.buffer; |
2479 if (*dbp == '%') | |
2480 dbp++; /* Ratfor escape to fortran */ | |
2481 while (isspace (*dbp)) | |
2482 dbp++; | |
2483 if (*dbp == 0) | |
2484 continue; | |
2485 switch (*dbp | ' ') | |
2486 { | |
2487 case 'i': | |
2488 if (tail ("integer")) | |
2489 takeprec (); | |
2490 break; | |
2491 case 'r': | |
2492 if (tail ("real")) | |
2493 takeprec (); | |
2494 break; | |
2495 case 'l': | |
2496 if (tail ("logical")) | |
2497 takeprec (); | |
2498 break; | |
2499 case 'c': | |
2500 if (tail ("complex") || tail ("character")) | |
2501 takeprec (); | |
2502 break; | |
2503 case 'd': | |
2504 if (tail ("double")) | |
2505 { | |
2506 while (isspace (*dbp)) | |
2507 dbp++; | |
2508 if (*dbp == 0) | |
2509 continue; | |
2510 if (tail ("precision")) | |
2511 break; | |
2512 continue; | |
2513 } | |
2514 break; | |
2515 } | |
2516 while (isspace (*dbp)) | |
2517 dbp++; | |
2518 if (*dbp == 0) | |
2519 continue; | |
2520 switch (*dbp | ' ') | |
2521 { | |
2522 case 'f': | |
2523 if (tail ("function")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2524 getit (inf); |
240 | 2525 continue; |
2526 case 's': | |
2527 if (tail ("subroutine")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2528 getit (inf); |
240 | 2529 continue; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2530 case 'e': |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2531 if (tail ("entry")) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2532 getit (inf); |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2533 continue; |
240 | 2534 case 'p': |
2535 if (tail ("program")) | |
2536 { | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2537 getit (inf); |
240 | 2538 continue; |
2539 } | |
2540 if (tail ("procedure")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2541 getit (inf); |
240 | 2542 continue; |
2543 } | |
2544 } | |
2545 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2546 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2547 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2548 * 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
|
2549 * Unix and microcontroller assembly tag handling |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2550 * 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
|
2551 */ |
240 | 2552 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2553 Asm_labels (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2554 FILE *inf; |
240 | 2555 { |
2556 register char *cp; | |
2557 | |
2558 lineno = 0; | |
2559 charno = 0; | |
2560 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2561 while (!feof (inf)) |
240 | 2562 { |
2563 lineno++; | |
2564 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2565 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2566 cp = lb.buffer; |
240 | 2567 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2568 /* 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
|
2569 following identifier. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2570 if (isalpha (*cp) || *cp == '_' || *cp == '.' || *cp == '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2571 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2572 /* Read past label. */ |
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 while (isalnum (*cp) || *cp == '_' || *cp == '.' || *cp == '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2575 cp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2576 if (*cp == ':' || isspace (*cp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2577 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2578 /* 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
|
2579 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
|
2580 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
|
2581 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2582 } |
240 | 2583 } |
2584 } | |
2585 | |
2586 /* Added by Mosur Mohan, 4/22/88 */ | |
2587 /* Pascal parsing */ | |
2588 | |
2589 #define GET_NEW_LINE \ | |
2590 { \ | |
2591 linecharno = charno; lineno++; \ | |
2592 charno += 1 + readline (&lb, inf); \ | |
2593 dbp = lb.buffer; \ | |
2594 } | |
2595 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
2596 /* |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
2597 * 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
|
2598 * 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
|
2599 * "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
|
2600 * the tag is skipped. |
240 | 2601 */ |
2602 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2603 Pascal_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2604 FILE *inf; |
240 | 2605 { |
2606 struct linebuffer tline; /* mostly copied from C_entries */ | |
2607 long save_lcno; | |
2608 int save_lineno; | |
2609 char c, *cp; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2610 char *nambuf; |
240 | 2611 |
2612 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
|
2613 incomment, /* point is inside a comment */ |
240 | 2614 inquote, /* point is inside '..' string */ |
2615 get_tagname, /* point is after PROCEDURE/FUNCTION */ | |
2616 /* keyword, so next item = potential tag */ | |
2617 found_tag, /* point is after a potential tag */ | |
2618 inparms, /* point is within parameter-list */ | |
2619 verify_tag; /* point has passed the parm-list, so the */ | |
2620 /* next token will determine whether */ | |
2621 /* this is a FORWARD/EXTERN to be */ | |
2622 /* ignored, or whether it is a real tag */ | |
2623 | |
2624 lineno = 0; | |
2625 charno = 0; | |
2626 dbp = lb.buffer; | |
2627 *dbp = 0; | |
2628 initbuffer (&tline); | |
2629 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2630 incomment = inquote = FALSE; |
240 | 2631 found_tag = FALSE; /* have a proc name; check if extern */ |
2632 get_tagname = FALSE; /* have found "procedure" keyword */ | |
2633 inparms = FALSE; /* found '(' after "proc" */ | |
2634 verify_tag = FALSE; /* check if "extern" is ahead */ | |
2635 | |
2636 /* 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
|
2637 while (!feof (inf)) |
240 | 2638 { |
2639 c = *dbp++; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2640 if (c == '\0') /* if end of line */ |
240 | 2641 { |
2642 GET_NEW_LINE; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2643 if (*dbp == '\0') |
240 | 2644 continue; |
2645 if (!((found_tag && verify_tag) || | |
2646 get_tagname)) | |
2647 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
|
2648 /* 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
|
2649 /* the procedure or function */ |
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 (incomment) |
240 | 2652 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2653 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
|
2654 incomment = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2655 else if (c == '*' && dbp[1] == ')') /* within (* - *) comments */ |
240 | 2656 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2657 dbp++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2658 incomment = FALSE; |
240 | 2659 } |
2660 continue; | |
2661 } | |
2662 else if (inquote) | |
2663 { | |
2664 if (c == '\'') | |
2665 inquote = FALSE; | |
2666 continue; | |
2667 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2668 else |
240 | 2669 switch (c) |
2670 { | |
2671 case '\'': | |
2672 inquote = TRUE; /* found first quote */ | |
2673 continue; | |
2674 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
|
2675 incomment = TRUE; |
240 | 2676 continue; |
2677 case '(': | |
2678 if (*dbp == '*') /* found open-(*-comment */ | |
2679 { | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2680 incomment = TRUE; |
240 | 2681 dbp++; |
2682 } | |
2683 else if (found_tag) /* found '(' after tag, i.e., parm-list */ | |
2684 inparms = TRUE; | |
2685 continue; | |
2686 case ')': /* end of parms list */ | |
2687 if (inparms) | |
2688 inparms = FALSE; | |
2689 continue; | |
2690 case ';': | |
2691 if ((found_tag) && (!inparms)) /* end of proc or fn stmt */ | |
2692 { | |
2693 verify_tag = TRUE; | |
2694 break; | |
2695 } | |
2696 continue; | |
2697 } | |
2698 if ((found_tag) && (verify_tag) && (*dbp != ' ')) | |
2699 { | |
2700 /* check if this is an "extern" declaration */ | |
2701 if (*dbp == 0) | |
2702 continue; | |
2703 if ((*dbp == 'e') || (*dbp == 'E')) | |
2704 { | |
2705 if (tail ("extern")) /* superfluous, really! */ | |
2706 { | |
2707 found_tag = FALSE; | |
2708 verify_tag = FALSE; | |
2709 } | |
2710 } | |
2711 else if ((*dbp == 'f') || (*dbp == 'F')) | |
2712 { | |
2713 if (tail ("forward")) /* check for forward reference */ | |
2714 { | |
2715 found_tag = FALSE; | |
2716 verify_tag = FALSE; | |
2717 } | |
2718 } | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2719 if ((found_tag) && (verify_tag)) /* not external proc, so make tag */ |
240 | 2720 { |
2721 found_tag = FALSE; | |
2722 verify_tag = FALSE; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2723 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
|
2724 cp - tline.buffer + 1, save_lineno, save_lcno); |
240 | 2725 continue; |
2726 } | |
2727 } | |
2728 if (get_tagname) /* grab name of proc or fn */ | |
2729 { | |
2730 if (*dbp == 0) | |
2731 continue; | |
2732 | |
2733 /* save all values for later tagging */ | |
2734 tline.size = lb.size; | |
2735 strcpy (tline.buffer, lb.buffer); | |
2736 save_lineno = lineno; | |
2737 save_lcno = linecharno; | |
2738 | |
2739 /* grab block name */ | |
2740 for (cp = dbp + 1; *cp && (!endtoken (*cp)); cp++) | |
2741 continue; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2742 nambuf = savenstr (dbp, cp-dbp); |
240 | 2743 dbp = cp; /* restore dbp to e-o-token */ |
2744 get_tagname = FALSE; | |
2745 found_tag = TRUE; | |
2746 continue; | |
2747 | |
2748 /* and proceed to check for "extern" */ | |
2749 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2750 else if (!incomment && !inquote && !found_tag) |
240 | 2751 { |
2752 /* check for proc/fn keywords */ | |
2753 switch (c | ' ') | |
2754 { | |
2755 case 'p': | |
2756 if (tail ("rocedure")) /* c = 'p', dbp has advanced */ | |
2757 get_tagname = TRUE; | |
2758 continue; | |
2759 case 'f': | |
2760 if (tail ("unction")) | |
2761 get_tagname = TRUE; | |
2762 continue; | |
2763 } | |
2764 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2765 } /* while not eof */ |
240 | 2766 } |
2767 | |
2768 /* | |
2769 * lisp tag functions | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2770 * look for (def or (DEF, quote or QUOTE |
240 | 2771 */ |
2772 int | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2773 L_isdef (strp) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2774 register char *strp; |
240 | 2775 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2776 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
|
2777 && (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
|
2778 && (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
|
2779 } |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2780 |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2781 int |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2782 L_isquote (strp) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2783 register char *strp; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2784 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2785 return ((*(++strp) == 'q' || *strp == 'Q') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2786 && (*(++strp) == 'u' || *strp == 'U') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2787 && (*(++strp) == 'o' || *strp == 'O') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2788 && (*(++strp) == 't' || *strp == 'T') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2789 && (*(++strp) == 'e' || *strp == 'E') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2790 && isspace(*(++strp))); |
240 | 2791 } |
2792 | |
2793 void | |
2794 L_getit () | |
2795 { | |
2796 register char *cp; | |
2797 | |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2798 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
|
2799 dbp++; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2800 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
|
2801 { |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2802 dbp += 7; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2803 while (isspace(*dbp)) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2804 dbp++; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2805 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2806 for (cp = dbp /*+1*/; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2807 *cp && *cp != '(' && *cp != ' ' && *cp != ')'; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2808 cp++) |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2809 continue; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2810 if (cp == dbp) |
240 | 2811 return; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2812 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2813 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
|
2814 cp - lb.buffer + 1, lineno, linecharno); |
240 | 2815 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2816 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2817 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2818 Lisp_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2819 FILE *inf; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2820 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2821 lineno = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2822 charno = 0; |
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 while (!feof (inf)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2825 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2826 lineno++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2827 linecharno = charno; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2828 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2829 dbp = lb.buffer; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2830 if (dbp[0] == '(') |
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 if (L_isdef (dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2833 { |
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 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2837 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2838 L_getit (); |
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 else |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2841 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2842 /* Check for (foo::defmumble name-defined ... */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2843 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2844 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2845 while (*dbp && !isspace (*dbp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2846 && *dbp != ':' && *dbp != '(' && *dbp != ')'); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2847 if (*dbp == ':') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2848 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2849 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2850 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2851 while (*dbp == ':'); |
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 if (L_isdef (dbp - 1)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2854 { |
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 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2858 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2859 L_getit (); |
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 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2864 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2865 } |
240 | 2866 |
2867 /* | |
2868 * Scheme tag functions | |
2869 * look for (def... xyzzy | |
2870 * look for (def... (xyzzy | |
2871 * look for (def ... ((...(xyzzy .... | |
2872 * look for (set! xyzzy | |
2873 */ | |
2874 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2875 void get_scheme (); |
240 | 2876 |
2877 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2878 Scheme_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2879 FILE *inf; |
240 | 2880 { |
2881 lineno = 0; | |
2882 charno = 0; | |
2883 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2884 while (!feof (inf)) |
240 | 2885 { |
2886 lineno++; | |
2887 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2888 charno += readline (&lb, inf); |
240 | 2889 dbp = lb.buffer; |
2890 if (dbp[0] == '(' && | |
2891 (dbp[1] == 'D' || dbp[1] == 'd') && | |
2892 (dbp[2] == 'E' || dbp[2] == 'e') && | |
2893 (dbp[3] == 'F' || dbp[3] == 'f')) | |
2894 { | |
2895 while (!isspace (*dbp)) | |
2896 dbp++; | |
2897 /* Skip over open parens and white space */ | |
2898 while (*dbp && (isspace (*dbp) || *dbp == '(')) | |
2899 dbp++; | |
2900 get_scheme (); | |
2901 } | |
2902 if (dbp[0] == '(' && | |
2903 (dbp[1] == 'S' || dbp[1] == 's') && | |
2904 (dbp[2] == 'E' || dbp[2] == 'e') && | |
2905 (dbp[3] == 'T' || dbp[3] == 't') && | |
2906 (dbp[4] == '!' || dbp[4] == '!') && | |
2907 (isspace (dbp[5]))) | |
2908 { | |
2909 while (!isspace (*dbp)) | |
2910 dbp++; | |
2911 /* Skip over white space */ | |
2912 while (isspace (*dbp)) | |
2913 dbp++; | |
2914 get_scheme (); | |
2915 } | |
2916 } | |
2917 } | |
2918 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2919 void |
240 | 2920 get_scheme () |
2921 { | |
2922 register char *cp; | |
2923 | |
2924 if (*dbp == 0) | |
2925 return; | |
2926 /* 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
|
2927 for (cp = dbp + 1; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2928 *cp && *cp != '(' && *cp != ')' && !isspace (*cp); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2929 cp++) |
240 | 2930 continue; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2931 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
|
2932 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
240 | 2933 } |
2934 | |
2935 /* Find tags in TeX and LaTeX input files. */ | |
2936 | |
2937 /* TEX_toktab is a table of TeX control sequences that define tags. | |
2938 Each TEX_tabent records one such control sequence. | |
2939 CONVERT THIS TO USE THE Stab TYPE!! */ | |
2940 struct TEX_tabent | |
2941 { | |
2942 char *name; | |
2943 int len; | |
2944 }; | |
2945 | |
2946 struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */ | |
2947 | |
2948 /* Default set of control sequences to put into TEX_toktab. | |
2949 The value of environment var TEXTAGS is prepended to this. */ | |
2950 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2951 char *TEX_defenv = "\ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2952 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem:typeout"; |
240 | 2953 |
2954 void TEX_mode (); | |
2955 struct TEX_tabent *TEX_decode_env (); | |
2956 void TEX_getit (); | |
2957 int TEX_Token (); | |
2958 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2959 char TEX_esc = '\\'; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2960 char TEX_opgrp = '{'; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2961 char TEX_clgrp = '}'; |
240 | 2962 |
2963 /* | |
2964 * TeX/LaTeX scanning loop. | |
2965 */ | |
2966 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2967 TeX_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2968 FILE *inf; |
240 | 2969 { |
2970 char *lasthit; | |
2971 | |
2972 lineno = 0; | |
2973 charno = 0; | |
2974 | |
2975 /* 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
|
2976 TEX_mode (inf); |
240 | 2977 |
2978 /* Initialize token table once from environment. */ | |
2979 if (!TEX_toktab) | |
2980 TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv); | |
2981 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2982 while (!feof (inf)) |
1040 | 2983 { /* Scan each line in file */ |
240 | 2984 lineno++; |
2985 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2986 charno += readline (&lb, inf); |
240 | 2987 dbp = lb.buffer; |
2988 lasthit = dbp; | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
2989 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
|
2990 { |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2991 register int i; |
240 | 2992 |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2993 if (!*(++dbp)) |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2994 break; |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2995 linecharno += dbp - lasthit; |
240 | 2996 lasthit = dbp; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2997 i = TEX_Token (lasthit); |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2998 if (0 <= i) |
240 | 2999 { |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3000 TEX_getit (lasthit, TEX_toktab[i].len); |
1040 | 3001 break; /* We only save a line once */ |
240 | 3002 } |
3003 } | |
3004 } | |
3005 } | |
3006 | |
3007 #define TEX_LESC '\\' | |
3008 #define TEX_SESC '!' | |
3009 #define TEX_cmt '%' | |
3010 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3011 /* 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
|
3012 chars accordingly. */ |
240 | 3013 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3014 TEX_mode (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3015 FILE *inf; |
240 | 3016 { |
3017 int c; | |
3018 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3019 while ((c = getc (inf)) != EOF) |
240 | 3020 { |
3021 /* Skip to next line if we hit the TeX comment char. */ | |
3022 if (c == TEX_cmt) | |
3023 while (c != '\n') | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3024 c = getc (inf); |
240 | 3025 else if (c == TEX_LESC || c == TEX_SESC ) |
3026 break; | |
3027 } | |
3028 | |
3029 if (c == TEX_LESC) | |
3030 { | |
3031 TEX_esc = TEX_LESC; | |
3032 TEX_opgrp = '{'; | |
3033 TEX_clgrp = '}'; | |
3034 } | |
3035 else | |
3036 { | |
3037 TEX_esc = TEX_SESC; | |
3038 TEX_opgrp = '<'; | |
3039 TEX_clgrp = '>'; | |
3040 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3041 rewind (inf); |
240 | 3042 } |
3043 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3044 /* 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
|
3045 Build token table. */ |
240 | 3046 struct TEX_tabent * |
3047 TEX_decode_env (evarname, defenv) | |
3048 char *evarname; | |
3049 char *defenv; | |
3050 { | |
3051 register char *env, *p; | |
3052 | |
3053 struct TEX_tabent *tab; | |
3054 int size, i; | |
3055 | |
3056 /* Append default string to environment. */ | |
3057 env = getenv (evarname); | |
3058 if (!env) | |
3059 env = defenv; | |
3060 else | |
3061 env = concat (env, defenv, ""); | |
3062 | |
3063 /* Allocate a token table */ | |
3064 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
|
3065 if ((p = etags_strchr (p, ':')) && *(++p)) |
240 | 3066 size++; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3067 /* Add 1 to leave room for null terminator. */ |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3068 tab = xnew (size + 1, struct TEX_tabent); |
240 | 3069 |
3070 /* Unpack environment string into token table. Be careful about */ | |
3071 /* zero-length strings (leading ':', "::" and trailing ':') */ | |
3072 for (i = 0; *env;) | |
3073 { | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3074 p = etags_strchr (env, ':'); |
240 | 3075 if (!p) /* End of environment string. */ |
3076 p = env + strlen (env); | |
3077 if (p - env > 0) | |
3078 { /* Only non-zero strings. */ | |
3079 tab[i].name = savenstr (env, p - env); | |
3080 tab[i].len = strlen (tab[i].name); | |
3081 i++; | |
3082 } | |
3083 if (*p) | |
3084 env = p + 1; | |
3085 else | |
3086 { | |
3087 tab[i].name = NULL; /* Mark end of table. */ | |
3088 tab[i].len = 0; | |
3089 break; | |
3090 } | |
3091 } | |
3092 return tab; | |
3093 } | |
3094 | |
3095 /* Record a tag defined by a TeX command of length LEN and starting at NAME. | |
3096 The name being defined actually starts at (NAME + LEN + 1). | |
3097 But we seem to include the TeX command in the tag name. */ | |
3098 void | |
3099 TEX_getit (name, len) | |
3100 char *name; | |
3101 int len; | |
3102 { | |
3103 char *p = name + len; | |
3104 | |
3105 if (*name == 0) | |
3106 return; | |
3107 | |
3108 /* Let tag name extend to next group close (or end of line) */ | |
3109 while (*p && *p != TEX_clgrp) | |
3110 p++; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3111 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
|
3112 strlen (lb.buffer), lineno, linecharno); |
240 | 3113 } |
3114 | |
3115 /* 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
|
3116 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
|
3117 Otherwise return -1. |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3118 Keep the capital `T' in `Token' for dumb truncating compilers |
240 | 3119 (this distinguishes it from `TEX_toktab' */ |
3120 int | |
3121 TEX_Token (cp) | |
3122 char *cp; | |
3123 { | |
3124 int i; | |
3125 | |
3126 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
|
3127 if (strneq (TEX_toktab[i].name, cp, TEX_toktab[i].len)) |
240 | 3128 return i; |
3129 return -1; | |
3130 } | |
3131 | |
3132 /* Support for Prolog. */ | |
3133 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3134 /* Whole head (not only functor, but also arguments) |
240 | 3135 is gotten in compound term. */ |
3136 void | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3137 prolog_getit (s) |
240 | 3138 char *s; |
3139 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3140 char *save_s; |
240 | 3141 int insquote, npar; |
3142 | |
3143 save_s = s; | |
3144 insquote = FALSE; | |
3145 npar = 0; | |
3146 while (1) | |
3147 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3148 if (s[0] == '\0') /* syntax error. */ |
240 | 3149 return; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3150 else if (insquote && s[0] == '\'' && s[1] == '\'') |
240 | 3151 s += 2; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3152 else if (s[0] == '\'') |
240 | 3153 { |
3154 insquote = !insquote; | |
3155 s++; | |
3156 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3157 else if (!insquote && s[0] == '(') |
240 | 3158 { |
3159 npar++; | |
3160 s++; | |
3161 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3162 else if (!insquote && s[0] == ')') |
240 | 3163 { |
3164 npar--; | |
3165 s++; | |
3166 if (npar == 0) | |
3167 break; | |
3168 else if (npar < 0) /* syntax error. */ | |
3169 return; | |
3170 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3171 else if (!insquote && s[0] == '.' |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3172 && (isspace (s[1]) || s[1] == '\0')) |
240 | 3173 { /* fullstop. */ |
3174 if (npar != 0) /* syntax error. */ | |
3175 return; | |
3176 s++; | |
3177 break; | |
3178 } | |
3179 else | |
3180 s++; | |
3181 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3182 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
|
3183 save_s, s-save_s, lineno, linecharno); |
240 | 3184 } |
3185 | |
3186 /* It is assumed that prolog predicate starts from column 0. */ | |
3187 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3188 Prolog_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3189 FILE *inf; |
240 | 3190 { |
3191 void skip_comment (), prolog_getit (); | |
3192 | |
3193 lineno = linecharno = charno = 0; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3194 while (!feof (inf)) |
240 | 3195 { |
3196 lineno++; | |
3197 linecharno += charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3198 charno = readline (&lb, inf) + 1; /* 1 for newline. */ |
240 | 3199 dbp = lb.buffer; |
3200 if (isspace (dbp[0])) /* not predicate header. */ | |
3201 continue; | |
3202 else if (dbp[0] == '%') /* comment. */ | |
3203 continue; | |
3204 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
|
3205 skip_comment (&lb, inf, &lineno, &linecharno); |
240 | 3206 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
|
3207 prolog_getit (dbp); |
240 | 3208 } |
3209 } | |
3210 | |
3211 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3212 skip_comment (plb, inf, plineno, plinecharno) |
240 | 3213 struct linebuffer *plb; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3214 FILE *inf; |
240 | 3215 int *plineno; /* result */ |
3216 long *plinecharno; /* result */ | |
3217 { | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3218 char *cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3219 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3220 do |
240 | 3221 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3222 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
|
3223 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
|
3224 return; |
240 | 3225 (*plineno)++; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3226 *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
|
3227 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3228 while (!feof(inf)); |
240 | 3229 } |
3230 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3231 #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
|
3232 /* 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
|
3233 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
|
3234 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
|
3235 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
|
3236 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
|
3237 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
|
3238 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3239 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
|
3240 char *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3241 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3242 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
|
3243 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
|
3244 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
|
3245 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3246 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
|
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 (quoted) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3249 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3250 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
|
3251 *copyto++ = '\t'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3252 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
|
3253 *copyto++ = sep; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3254 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3255 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3256 /* 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
|
3257 *copyto++ = '\\'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3258 *copyto++ = *name; |
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 quoted = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3261 } |
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 == '\\') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3263 quoted = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3264 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
|
3265 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3266 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3267 *copyto++ = *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3268 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3269 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3270 /* 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
|
3271 *copyto = '\0'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3272 return name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3273 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3274 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3275 /* 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
|
3276 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
|
3277 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3278 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
|
3279 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
|
3280 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3281 char *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3282 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
|
3283 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
|
3284 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3285 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
|
3286 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3287 /* 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
|
3288 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
|
3289 patterns = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3290 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3291 } |
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 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
|
3294 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3295 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
|
3296 return; |
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 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
|
3299 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3300 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
|
3301 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3302 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3303 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
|
3304 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
|
3305 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3306 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
|
3307 return; |
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 (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
|
3310 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3311 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
|
3312 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
|
3313 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
|
3314 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
|
3315 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
|
3316 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3317 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
|
3318 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
|
3319 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3320 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
|
3321 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3322 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3323 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3324 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
|
3325 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
|
3326 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
|
3327 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3328 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
|
3329 xrealloc (patterns, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3330 (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
|
3331 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
|
3332 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
|
3333 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
|
3334 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3335 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3336 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3337 * 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
|
3338 * arguments. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3339 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3340 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3341 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
|
3342 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
|
3343 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
|
3344 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3345 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
|
3346 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
|
3347 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3348 /* 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
|
3349 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
|
3350 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3351 if (*t == '\\') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3352 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3353 ++t; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3354 if (!*t) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3355 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3356 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
|
3357 progname); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3358 return NULL; |
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 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
|
3361 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3362 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
|
3363 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
|
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 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3367 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3368 /* 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
|
3369 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
|
3370 size = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3371 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
|
3372 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3373 if (*out == '\\') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3374 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3375 ++out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3376 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
|
3377 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3378 /* 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
|
3379 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
|
3380 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
|
3381 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
|
3382 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
|
3383 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3384 else |
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 switch (*out) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3387 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3388 case '\t': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3389 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
|
3390 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3391 case '\\': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3392 *out = '\\'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3393 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3394 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3395 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
|
3396 break; |
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 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3399 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3400 else |
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++] = *out; |
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 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
|
3404 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3405 return result; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3406 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3407 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3408 #endif /* ETAGS_REGEXPS */ |
240 | 3409 /* Initialize a linebuffer for use */ |
3410 void | |
3411 initbuffer (linebuffer) | |
3412 struct linebuffer *linebuffer; | |
3413 { | |
3414 linebuffer->size = 200; | |
3415 linebuffer->buffer = xnew (200, char); | |
3416 } | |
3417 | |
3418 /* | |
3419 * Read a line of text from `stream' into `linebuffer'. | |
3420 * Return the number of characters read from `stream', | |
3421 * which is the length of the line including the newline, if any. | |
3422 */ | |
3423 long | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3424 readline_internal (linebuffer, stream) |
240 | 3425 struct linebuffer *linebuffer; |
3426 register FILE *stream; | |
3427 { | |
3428 char *buffer = linebuffer->buffer; | |
3429 register char *p = linebuffer->buffer; | |
3430 register char *pend; | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3431 int chars_deleted; |
240 | 3432 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3569
diff
changeset
|
3433 pend = p + linebuffer->size; /* Separate to avoid 386/IX compiler bug. */ |
240 | 3434 |
3435 while (1) | |
3436 { | |
3437 register int c = getc (stream); | |
3438 if (p == pend) | |
3439 { | |
3440 linebuffer->size *= 2; | |
3441 buffer = (char *) xrealloc (buffer, linebuffer->size); | |
3442 p += buffer - linebuffer->buffer; | |
3443 pend = buffer + linebuffer->size; | |
3444 linebuffer->buffer = buffer; | |
3445 } | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3446 if (c == EOF) |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3447 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3448 chars_deleted = 0; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3449 break; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3450 } |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3451 if (c == '\n') |
240 | 3452 { |
10990
c0ceaa45ded7
* etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents:
10801
diff
changeset
|
3453 if (p > buffer && p[-1] == '\r') |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3454 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3455 *--p = '\0'; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3456 chars_deleted = 2; |
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 else |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3459 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3460 *p = '\0'; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3461 chars_deleted = 1; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3462 } |
240 | 3463 break; |
3464 } | |
3465 *p++ = c; | |
3466 } | |
3467 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3468 return p - buffer + chars_deleted; |
240 | 3469 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3470 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3471 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3472 * 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
|
3473 * 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
|
3474 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3475 long |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3476 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
|
3477 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
|
3478 FILE *stream; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3479 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3480 /* 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
|
3481 int i; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3482 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
|
3483 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3484 #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
|
3485 /* 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
|
3486 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
|
3487 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3488 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
|
3489 (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
|
3490 switch (match) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3491 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3492 case -2: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3493 /* Some error. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3494 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
|
3495 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3496 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
|
3497 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
|
3498 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3499 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3500 case -1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3501 /* No match. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3502 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3503 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3504 /* 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
|
3505 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
|
3506 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3507 /* 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
|
3508 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
|
3509 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
|
3510 &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
|
3511 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
|
3512 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
|
3513 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
|
3514 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3515 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3516 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3517 /* 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
|
3518 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
|
3519 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
|
3520 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3521 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3522 } |
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 #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
|
3525 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3526 return result; |
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 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3529 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3530 * 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
|
3531 * 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
|
3532 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3533 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3534 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
|
3535 FILE *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 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
|
3538 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3539 ++lineno; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3540 linecharno = charno; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3541 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
|
3542 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3543 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3544 |
240 | 3545 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3546 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3547 * 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
|
3548 * 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
|
3549 */ |
240 | 3550 char * |
3551 savestr (cp) | |
3552 char *cp; | |
3553 { | |
3554 return savenstr (cp, strlen (cp)); | |
3555 } | |
3556 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3557 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3558 * 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
|
3559 * 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
|
3560 */ |
240 | 3561 char * |
3562 savenstr (cp, len) | |
3563 char *cp; | |
3564 int len; | |
3565 { | |
3566 register char *dp; | |
3567 | |
3568 dp = xnew (len + 1, char); | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3569 strncpy (dp, cp, len); |
240 | 3570 dp[len] = '\0'; |
3571 return dp; | |
3572 } | |
3573 | |
3574 /* | |
3575 * Return the ptr in sp at which the character c last | |
3576 * appears; NULL if not found | |
3577 * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3578 * Identical to System V strrchr, included for portability. |
240 | 3579 */ |
3580 char * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3581 etags_strrchr (sp, c) |
240 | 3582 register char *sp, c; |
3583 { | |
3584 register char *r; | |
3585 | |
3586 r = NULL; | |
3587 do | |
3588 { | |
3589 if (*sp == c) | |
3590 r = sp; | |
3591 } 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
|
3592 return r; |
240 | 3593 } |
3594 | |
774 | 3595 |
240 | 3596 /* |
3597 * Return the ptr in sp at which the character c first | |
3598 * appears; NULL if not found | |
3599 * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3600 * Identical to System V strchr, included for portability. |
240 | 3601 */ |
3602 char * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3603 etags_strchr (sp, c) |
240 | 3604 register char *sp, c; |
3605 { | |
3606 do | |
3607 { | |
3608 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
|
3609 return sp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3610 } while (*sp++); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3611 return NULL; |
240 | 3612 } |
3613 | |
3614 /* Print error message and exit. */ | |
3615 void | |
3616 fatal (s1, s2) | |
3617 char *s1, *s2; | |
3618 { | |
3619 error (s1, s2); | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3620 exit (BAD); |
240 | 3621 } |
3622 | |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3623 void |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3624 pfatal (s1) |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3625 char *s1; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3626 { |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3627 perror (s1); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3628 exit (BAD); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3629 } |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3630 |
240 | 3631 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
3632 void | |
3633 error (s1, s2) | |
3634 char *s1, *s2; | |
3635 { | |
3636 fprintf (stderr, "%s: ", progname); | |
3637 fprintf (stderr, s1, s2); | |
3638 fprintf (stderr, "\n"); | |
3639 } | |
3640 | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3641 /* Return a newly-allocated string whose contents |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3642 concatenate those of s1, s2, s3. */ |
240 | 3643 char * |
3644 concat (s1, s2, s3) | |
3645 char *s1, *s2, *s3; | |
3646 { | |
3647 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | |
3648 char *result = xnew (len1 + len2 + len3 + 1, char); | |
3649 | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3650 strcpy (result, s1); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3651 strcpy (result + len1, s2); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3652 strcpy (result + len1 + len2, s3); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3653 result[len1 + len2 + len3] = '\0'; |
240 | 3654 |
3655 return result; | |
3656 } | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3657 |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3658 /* 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
|
3659 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
|
3660 char * |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3661 etags_getcwd () |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3662 #ifdef DOS_NT |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3663 { |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3664 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
|
3665 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3666 getwd (path); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3667 p = path; |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3668 while (*p) |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3669 if (*p == '\\') |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3670 *p++ = '/'; |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3671 else |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3672 *p++ = tolower (*p); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3673 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3674 return strdup (path); |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
3675 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3676 #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
|
3677 { |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3678 int bufsize = 200; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3679 char *path = xnew (bufsize, char); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3680 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3681 while (getcwd (path, bufsize) == NULL) |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3682 { |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
3683 if (errno != ERANGE) |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3684 pfatal ("pwd"); |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
3685 bufsize *= 2; |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3686 path = xnew (bufsize, char); |
8789
81a2817b99b2
(etags_getcwd): Use getcwd if available.
Karl Heuer <kwzh@gnu.org>
parents:
8180
diff
changeset
|
3687 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3688 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3689 return path; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3690 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3691 #else /* not DOS_NT and not HAVE_GETCWD */ |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3692 { |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3693 struct linebuffer path; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3694 FILE *pipe; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3695 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3696 initbuffer (&path); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3697 pipe = (FILE *) popen ("pwd 2>/dev/null", "r"); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3698 if (pipe == NULL || readline_internal (&path, pipe) == 0) |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3699 pfatal ("pwd"); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3700 pclose (pipe); |
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 return path.buffer; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3703 } |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
3704 #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
|
3705 |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3706 /* 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
|
3707 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
|
3708 should end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3709 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3710 relative_filename (file, dir) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3711 char *file, *dir; |
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 char *fp, *dp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3714 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3715 /* Find the common root of file and dir. */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3716 fp = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3717 dp = dir; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3718 while (*fp++ == *dp++) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3719 continue; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3720 do |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3721 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3722 fp--; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3723 dp--; |
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 while (*fp != '/'); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3726 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3727 /* 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
|
3728 for (dp = etags_strchr (dp + 1, '/'), res = ""; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3729 dp != NULL; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3730 dp = etags_strchr (dp + 1, '/')) |
6482
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 res = concat (res, "../", ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3733 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3734 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3735 /* 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
|
3736 res = concat (res, fp + 1, ""); |
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 return res; /* temporary stub */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3739 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3740 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3741 /* 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
|
3742 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
|
3743 end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3744 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3745 absolute_filename (file, cwd) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3746 char *file, *cwd; |
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 char *slashp, *cp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3749 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3750 if (file[0] == '/') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3751 res = concat (file, "", ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3752 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3753 res = concat (cwd, file, ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3754 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3755 /* Delete the "/dirname/.." and "/." substrings. */ |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3756 slashp = etags_strchr (res, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3757 while (slashp != NULL && slashp[0] != '\0') |
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[1] == '.') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3760 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3761 if (slashp[2] == '.' |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3762 && (slashp[3] == '/' || slashp[3] == '\0')) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3763 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3764 cp = slashp; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3765 do |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3766 cp--; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3767 while (cp >= res && *cp != '/'); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3768 if (*cp == '/') |
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 strcpy (cp, slashp + 3); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3771 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3772 else /* else (cp == res) */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3773 { |
6944
daa29eabfc65
* etags.c (absolute_filename): compare against '\0' instead of NULL.
Francesco Potortì <pot@gnu.org>
parents:
6831
diff
changeset
|
3774 if (slashp[3] != '\0') |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3775 strcpy (cp, slashp + 4); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3776 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3777 return "."; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3778 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3779 slashp = cp; |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3780 continue; |
6482
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 else if (slashp[2] == '/' || slashp[2] == '\0') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3783 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3784 strcpy (slashp, slashp + 2); |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3785 continue; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3786 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3787 } |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3788 |
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
3789 slashp = etags_strchr (slashp + 1, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3790 } |
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 return res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3793 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3794 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3795 /* 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
|
3796 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
|
3797 end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3798 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3799 absolute_dirname (file, cwd) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3800 char *file, *cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3801 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3802 char *slashp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3803 char save; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3804 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3805 slashp = etags_strrchr (file, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3806 if (slashp == NULL) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3807 return cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3808 save = slashp[1]; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3809 slashp[1] = '\0'; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3810 res = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3811 slashp[1] = save; |
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 return res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3814 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
3815 |
240 | 3816 /* Like malloc but get fatal error if memory is exhausted. */ |
3817 char * | |
3818 xmalloc (size) | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3819 unsigned int size; |
240 | 3820 { |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3821 char *result = (char *) malloc (size); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3822 if (result == NULL) |
240 | 3823 fatal ("virtual memory exhausted", 0); |
3824 return result; | |
3825 } | |
3826 | |
3827 char * | |
3828 xrealloc (ptr, size) | |
3829 char *ptr; | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
3830 unsigned int size; |
240 | 3831 { |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3832 char *result = (char *) realloc (ptr, size); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
3833 if (result == NULL) |
240 | 3834 fatal ("virtual memory exhausted"); |
3835 return result; | |
3836 } |