Mercurial > emacs
annotate lib-src/etags.c @ 15159:b22de331ee43
(apropos-print): If command has no key bindings, say how to run it with M-x.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 04 May 1996 00:50:49 +0000 |
parents | b470e33ce4a9 |
children | c024dca549c5 |
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 | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14144
diff
changeset
|
4 |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
5 This file is not considered part of GNU Emacs. |
240 | 6 |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
7 This program is free software; you can redistribute it and/or modify |
240 | 8 it under the terms of the GNU General Public License as published by |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
9 the Free Software Foundation; either version 2 of the License, or |
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
10 (at your option) any later version. |
240 | 11 |
2932
b68f975d505a
Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents:
2911
diff
changeset
|
12 This program is distributed in the hope that it will be useful, |
240 | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14144
diff
changeset
|
18 along with this program; if not, write to the Free Software Foundation, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14144
diff
changeset
|
19 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
240 | 20 |
21 /* | |
22 * Authors: | |
23 * Ctags originally by Ken Arnold. | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
24 * Fortran added by Jim Kleckner. |
240 | 25 * Ed Pelegri-Llopart added C typedefs. |
26 * Gnu Emacs TAGS format and modifications by RMS? | |
27 * 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
|
28 * 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
|
29 * Regexp tags by Tom Tromey. |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
30 * |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
31 * Francesco Potorti` (F.Potorti@cnuce.cnr.it) is the current maintainer. |
240 | 32 */ |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
33 |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
34 char pot_etags_version[] = "@(#) pot revision number is 11.59"; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
35 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
36 #define TRUE 1 |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
37 #define FALSE 0 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
38 |
10801
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 |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
44 # include <string.h> |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
45 # include <fcntl.h> |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
46 # include <sys/param.h> |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
47 #endif /* MSDOS */ |
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
48 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
49 #ifdef WINDOWSNT |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
50 # include <stdlib.h> |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
51 # include <fcntl.h> |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
52 # include <string.h> |
14982
b470e33ce4a9
[WINDOWSNT]: Include io.h.
Richard M. Stallman <rms@gnu.org>
parents:
14924
diff
changeset
|
53 # include <io.h> |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
54 # define MAXPATHLEN _MAX_PATH |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
55 #endif |
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
56 |
4052
9535e8ffb209
* etags.c (alloca): removed all references to it.
Jim Blandy <jimb@redhat.com>
parents:
4051
diff
changeset
|
57 #ifdef HAVE_CONFIG_H |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
58 # include <config.h> |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
59 /* On some systems, Emacs defines static as nothing for the sake |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
60 of unexec. We don't want that here since we don't use unexec. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
61 # 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
|
62 #endif |
401 | 63 |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
64 #include <stdio.h> |
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
65 #include <ctype.h> |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
66 #include <errno.h> |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
67 #ifndef errno |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
68 extern int errno; |
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
69 #endif |
3921
e5e5b3634dd0
* etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents:
3838
diff
changeset
|
70 #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
|
71 #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
|
72 |
4804
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
73 #if !defined (S_ISREG) && defined (S_IFREG) |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
74 # 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
|
75 #endif |
810826b6e19a
* etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents:
4750
diff
changeset
|
76 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
77 #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
|
78 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
79 #ifdef ETAGS_REGEXPS |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
80 # include <regex.h> |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
81 #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
|
82 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
83 /* 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
|
84 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
|
85 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
|
86 #ifdef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
87 # undef CTAGS |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
88 # define CTAGS TRUE |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
89 #else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
90 # define CTAGS FALSE |
240 | 91 #endif |
92 | |
93 /* Exit codes for success and failure. */ | |
94 #ifdef VMS | |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
95 # define GOOD 1 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
96 # define BAD 0 |
240 | 97 #else |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
98 # define GOOD 0 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
99 # define BAD 1 |
240 | 100 #endif |
101 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
102 /* C extensions. */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
103 #define C_PLPL 0x00001 /* C++ */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
104 #define C_STAR 0x00003 /* C* */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
105 #define YACC 0x10000 /* yacc file */ |
240 | 106 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
107 #define streq(s,t) ((DEBUG &&!(s)&&!(t)&&(abort(),1)) || !strcmp(s,t)) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
108 #define strneq(s,t,n) ((DEBUG &&!(s)&&!(t)&&(abort(),1)) || !strncmp(s,t,n)) |
240 | 109 |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
110 #define lowcase(c) tolower ((unsigned char)c) |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
111 |
240 | 112 #define iswhite(arg) (_wht[arg]) /* T if char is white */ |
113 #define begtoken(arg) (_btk[arg]) /* T if char can start token */ | |
114 #define intoken(arg) (_itk[arg]) /* T if char can be in token */ | |
115 #define endtoken(arg) (_etk[arg]) /* T if char ends tokens */ | |
116 | |
12344
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
117 #ifdef DOS_NT |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
118 # define absolutefn(fn) (fn[0] == '/' \ |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
119 || (fn[1] == ':' && fn[2] == '/')) |
12344
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
120 #else |
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
121 # define absolutefn(fn) (fn[0] == '/') |
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
122 #endif |
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
123 |
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
124 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
125 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
126 * xnew -- allocate storage |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
127 * |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
128 * 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
|
129 */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
130 #define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type))) |
240 | 131 |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
132 typedef int logical; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
133 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
134 typedef struct nd_st |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
135 { /* sorting structure */ |
240 | 136 char *name; /* function or type name */ |
137 char *file; /* file name */ | |
138 logical is_func; /* use pattern or line no */ | |
139 logical been_warned; /* set if noticed dup */ | |
140 int lno; /* line number tag is on */ | |
141 long cno; /* character number line starts on */ | |
142 char *pat; /* search pattern */ | |
143 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
|
144 } NODE; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
145 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
146 extern char *getenv (); |
240 | 147 |
148 char *concat (); | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
149 char *savenstr (), *savestr (); |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
150 char *etags_strchr (), *etags_strrchr (); |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
151 char *etags_getcwd (); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
152 char *relative_filename (), *absolute_filename (), *absolute_dirname (); |
11673
46d2178719ad
(C_entries): Cast result of xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
11231
diff
changeset
|
153 long *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
|
154 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
155 typedef void Lang_function (); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
156 #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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 Lang_function Cstar_entries; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
162 Lang_function Erlang_functions; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
163 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
|
164 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
|
165 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
|
166 Lang_function Pascal_functions; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
167 Lang_function Perl_functions; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
168 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
|
169 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
|
170 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
|
171 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
|
172 #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
|
173 void Asm_labels (); |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
174 void C_entries (); |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
175 void default_C_entries (); |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
176 void plain_C_entries (); |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
177 void Cplusplus_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
178 void Cstar_entries (); |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
179 void Erlang_functions (); |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
180 void Fortran_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
181 void Yacc_entries (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
182 void Lisp_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
183 void Pascal_functions (); |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
184 void Perl_functions (); |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
185 void Prolog_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
186 void Scheme_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
187 void TeX_functions (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
188 void just_read_file (); |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
189 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
190 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
191 Lang_function *get_language_from_name (); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
192 Lang_function *get_language_from_interpreter (); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
193 Lang_function *get_language_from_suffix (); |
240 | 194 int total_size_of_entries (); |
195 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
|
196 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
|
197 #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
|
198 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
|
199 #endif |
240 | 200 void add_node (); |
201 void error (); | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
202 void suggest_asking_for_help (); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
203 void fatal (), pfatal (); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
204 void find_entries (); |
240 | 205 void free_tree (); |
206 void getit (); | |
207 void init (); | |
208 void initbuffer (); | |
209 void pfnote (); | |
210 void process_file (); | |
211 void put_entries (); | |
212 void takeprec (); | |
213 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
214 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
215 char searchar = '/'; /* use /.../ searches */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
216 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
217 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
|
218 long charno; /* current character number */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
219 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
220 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
|
221 but by every other language. */ |
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 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
|
224 char *tagfile; /* output file */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
225 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
|
226 char *cwd; /* current working directory */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
227 char *tagfiledir; /* directory of tagfile */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
228 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
229 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
|
230 NODE *head; /* the head of the binary tree of tags */ |
240 | 231 |
232 /* | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
233 * 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
|
234 * `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
|
235 * regardless of the length of the line. |
240 | 236 */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
237 #define GROW_LINEBUFFER(buf,toksize) \ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
238 while (buf.size < toksize) \ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
239 buf.buffer = (char *) xrealloc (buf.buffer, buf.size *= 2) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
240 struct linebuffer |
240 | 241 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
242 long size; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
243 char *buffer; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
244 }; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
245 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
246 struct linebuffer lb; /* the current line */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
247 struct linebuffer token_name; /* used by C_entries as a temporary area */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
248 struct |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
249 { |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
250 long linepos; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
251 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
|
252 } lbs[2]; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
253 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
254 /* boolean "functions" (see init) */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
255 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
|
256 char |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
257 /* white chars */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
258 *white = " \f\t\n\013", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
259 /* token ending chars */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
260 *endtk = " \t\n\013\"'#()[]{}=-+%*/&|^~!<>;,.:?", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
261 /* token starting chars */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
262 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~@", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
263 /* valid in-token chars */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
264 *intk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; |
240 | 265 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
266 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
|
267 /* 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
|
268 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
|
269 logical typedefs_and_cplusplus; /* -T: create tags for typedefs, level */ |
240 | 270 /* 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
|
271 /* member functions. */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
272 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
|
273 /* constants. Enum consts not implemented. */ |
240 | 274 /* -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
|
275 logical update; /* -u: update tags */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
276 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
|
277 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
|
278 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
|
279 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
|
280 logical noindentypedefs; /* -I: ignore indentation in C */ |
240 | 281 |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
282 struct option longopts[] = |
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
283 { |
621 | 284 { "append", no_argument, NULL, 'a' }, |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
285 { "backward-search", no_argument, NULL, 'B' }, |
621 | 286 { "c++", no_argument, NULL, 'C' }, |
287 { "cxref", no_argument, NULL, 'x' }, | |
288 { "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
|
289 { "help", no_argument, NULL, 'h' }, |
621 | 290 { "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
|
291 { "ignore-indentation", no_argument, NULL, 'I' }, |
621 | 292 { "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
|
293 { "language", required_argument, NULL, 'l' }, |
621 | 294 { "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
|
295 { "no-regex", no_argument, NULL, 'R' }, |
621 | 296 { "no-warn", no_argument, NULL, 'w' }, |
297 { "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
|
298 { "regex", required_argument, NULL, 'r' }, |
621 | 299 { "typedefs", no_argument, NULL, 't' }, |
300 { "typedefs-and-c++", no_argument, NULL, 'T' }, | |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
301 { "update", no_argument, NULL, 'u' }, |
621 | 302 { "version", no_argument, NULL, 'V' }, |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
303 { "vgrind", no_argument, NULL, 'v' }, |
621 | 304 { 0 } |
305 }; | |
306 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
307 #ifdef ETAGS_REGEXPS |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
308 /* Structure defining a regular expression. Elements are |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
309 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
|
310 struct pattern |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
311 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
312 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
|
313 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
|
314 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
|
315 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
|
316 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
317 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
318 /* 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
|
319 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
|
320 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
321 /* 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
|
322 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
|
323 #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
|
324 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
325 /* |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
326 * Language stuff. |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
327 */ |
9976
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 /* 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
|
330 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
|
331 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
332 /* Assembly code */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
333 char *Asm_suffixes [] = { "a", /* Unix assembler */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
334 "asm", /* Microcontroller assembly */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
335 "def", /* BSO/Tasking definition includes */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
336 "inc", /* Microcontroller include files */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
337 "ins", /* Microcontroller include files */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
338 "s", "sa", /* Unix assembler */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
339 "src", /* BSO/Tasking C compiler output */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
340 NULL |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
341 }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
342 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
343 /* Note that .c and .h can be considered C++, if the --c++ flag was |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
344 given. That is why default_C_entries is called here. */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
345 char *default_C_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
346 { "c", "h", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
347 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
348 /* .M is for Objective C++ files. */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
349 char *Cplusplus_suffixes [] = |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
350 { "C", "H", "c++", "cc", "cpp", "cxx", "h++", "hh", "hpp", "hxx", "M", NULL}; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
351 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
352 char *Cstar_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
353 { "cs", "hs", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
354 |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
355 char *Erlang_suffixes [] = |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
356 { "erl", "hrl", NULL }; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
357 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
358 char *Fortran_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
359 { "F", "f", "f90", "for", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
360 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
361 char *Lisp_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
362 { "cl", "clisp", "el", "l", "lisp", "lsp", "ml", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
363 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
364 char *Pascal_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
365 { "p", "pas", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
366 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
367 char *Perl_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
368 { "pl", "pm", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
369 char *Perl_interpreters [] = |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
370 { "perl", "@PERL@", NULL }; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
371 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
372 char *plain_C_suffixes [] = |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
373 { "pc", /* Pro*C file */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
374 "m", /* Objective C file */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
375 "lm", /* Objective lex file */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
376 NULL }; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
377 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
378 char *Prolog_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
379 { "prolog", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
380 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
381 /* Can't do the `SCM' or `scm' prefix with a version number. */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
382 char *Scheme_suffixes [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
383 { "SCM", "SM", "oak", "sch", "scheme", "scm", "sm", "t", NULL }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
384 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
385 char *TeX_suffixes [] = |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
386 { "TeX", "bib", "clo", "cls", "ltx", "sty", "tex", NULL }; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
387 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
388 char *Yacc_suffixes [] = |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
389 { "y", "ym", NULL }; /* .ym is Objective yacc file */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
390 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
391 /* Table of language names and corresponding functions, file suffixes |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
392 and interpreter names. |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
393 It is ok for a given function to be listed under more than one |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
394 name. I just didn't. */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
395 struct lang_entry |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
396 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
397 char *name; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
398 Lang_function *function; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
399 char **suffixes; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
400 char **interpreters; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
401 }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
402 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
403 struct lang_entry lang_names [] = |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
404 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
405 { "asm", Asm_labels, Asm_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
406 { "c", default_C_entries, default_C_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
407 { "c++", Cplusplus_entries, Cplusplus_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
408 { "c*", Cstar_entries, Cstar_suffixes, NULL }, |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
409 { "erlang", Erlang_functions, Erlang_suffixes, NULL }, |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
410 { "fortran", Fortran_functions, Fortran_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
411 { "lisp", Lisp_functions, Lisp_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
412 { "pascal", Pascal_functions, Pascal_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
413 { "perl", Perl_functions, Perl_suffixes, Perl_interpreters }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
414 { "proc", plain_C_entries, plain_C_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
415 { "prolog", Prolog_functions, Prolog_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
416 { "scheme", Scheme_functions, Scheme_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
417 { "tex", TeX_functions, TeX_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
418 { "yacc", Yacc_entries, Yacc_suffixes, NULL }, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
419 { "auto", NULL }, /* default guessing scheme */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
420 { "none", just_read_file }, /* regexp matching only */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
421 { NULL, NULL } /* end of list */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
422 }; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
423 |
240 | 424 |
425 void | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
426 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
|
427 { |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
428 struct lang_entry *lang; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
429 char **ext; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
430 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
431 puts ("\nThese are the currently supported languages, along with the\n\ |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
432 default file name suffixes:"); |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
433 for (lang = lang_names; lang->name != NULL; lang++) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
434 { |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
435 printf ("\t%s\t", lang->name); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
436 if (lang->suffixes != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
437 for (ext = lang->suffixes; *ext != NULL; ext++) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
438 printf (" .%s", *ext); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
439 puts (""); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
440 } |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
441 puts ("Where `auto' means use default language for files based on file\n\ |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
442 name suffix, and `none' means only do regexp processing on files.\n\ |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
443 If no language is specified and no matching suffix is found,\n\ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
444 the first line of the file is read for a sharp-bang (#!) sequence\n\ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
445 followed by the name of an interpreter. If no such sequence is found,\n\ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
446 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
|
447 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
448 |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
449 #ifndef VERSION |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
450 # define VERSION "19" |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
451 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
452 void |
621 | 453 print_version () |
454 { | |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
455 printf ("%s for Emacs version %s\n", (CTAGS) ? "ctags" : "etags", VERSION); |
621 | 456 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
457 exit (GOOD); |
621 | 458 } |
459 | |
460 void | |
461 print_help () | |
462 { | |
463 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
|
464 abbreviations for the long option names. A - as file name means read\n\ |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
465 names from stdin.", progname); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
466 if (!CTAGS) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
467 printf (" Absolute names are stored in the output file as they\n\ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
468 are. Relative ones are stored relative to the output file's directory."); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
469 puts ("\n"); |
621 | 470 |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
471 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
|
472 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
|
473 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
474 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
475 puts ("-B, --backward-search\n\ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
476 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
|
477 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
|
478 |
4126
9a906e5f9b28
* etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents:
4052
diff
changeset
|
479 puts ("-C, --c++\n\ |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
480 Treat files whose name suffix defaults to C language as C++ files."); |
621 | 481 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
482 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
483 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
|
484 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
|
485 else |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
486 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
|
487 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
|
488 the tags file smaller."); |
621 | 489 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
490 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
|
491 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 } |
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
500 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
501 #ifdef ETAGS_REGEXPS |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
502 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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 --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
|
508 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
|
509 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
|
510 #endif /* ETAGS_REGEXPS */ |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
511 puts ("-o FILE, --output=FILE\n\ |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
512 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
|
513 puts ("-I, --ignore-indentation\n\ |
621 | 514 Don't rely on indentation quite as much as normal. Currently,\n\ |
515 this means not to assume that a closing brace in the first\n\ | |
516 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
|
517 definition in C and C++."); |
621 | 518 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
519 if (CTAGS) |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
520 { |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
521 puts ("-t, --typedefs\n\ |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
522 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
|
523 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
|
524 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
|
525 and C++ member functions."); |
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
526 puts ("-u, --update\n\ |
621 | 527 Update the tag entries for the given files, leaving tag\n\ |
528 entries for other files in place. Currently, this is\n\ | |
529 implemented by deleting the existing entries for the given\n\ | |
530 files and then rewriting the new entries at the end of the\n\ | |
531 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
|
532 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
|
533 puts ("-v, --vgrind\n\ |
621 | 534 Generates an index of items intended for human consumption,\n\ |
535 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
|
536 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
|
537 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
|
538 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
|
539 files."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
540 puts ("-x, --cxref\n\ |
621 | 541 Like --vgrind, but in the style of cxref, rather than vgrind.\n\ |
542 The output uses line numbers instead of page numbers, but\n\ | |
543 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
|
544 which you like."); |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
545 } |
621 | 546 |
547 puts ("-V, --version\n\ | |
548 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
|
549 -h, --help\n\ |
621 | 550 Print this help message."); |
551 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
552 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
|
553 |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
554 exit (GOOD); |
621 | 555 } |
556 | |
557 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
558 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
|
559 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
560 at_language, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
561 at_regexp, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
562 at_filename |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
563 }; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
564 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
565 /* 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
|
566 typedef struct |
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 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
|
569 char *what; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
570 Lang_function *function; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
571 } argument; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
572 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
573 #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
|
574 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
575 #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
|
576 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
577 /* 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
|
578 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
|
579 #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
|
580 typedef struct { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
581 short curlen; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
582 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
|
583 } vspec; |
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 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
586 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
|
587 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
|
588 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
|
589 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
|
590 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
|
591 is returned, the function ignores the value of in_spec, and will |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
592 only start processing a new spec with the following call. |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
593 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
|
594 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
|
595 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
596 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
|
597 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
|
598 names the function returns zero. If on the first call no file |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
599 matches in_spec, or there is any other error, -1 is returned. |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
600 */ |
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 #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
|
603 #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
|
604 #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
|
605 short |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
606 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
|
607 vspec *out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
608 char *in; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
609 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
610 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
|
611 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
|
612 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
|
613 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
|
614 long status; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
615 short retval; |
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 if (pass1) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
618 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
619 pass1 = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
620 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
|
621 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
|
622 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
|
623 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
|
624 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
|
625 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
|
626 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
|
627 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
|
628 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
629 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
|
630 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
631 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
|
632 return 1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
633 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
634 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
|
635 retval = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
636 else |
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 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
|
639 retval = -1; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
640 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
641 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
|
642 pass1 = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
643 return retval; |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
644 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
645 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
646 /* |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
647 v1.01 nmm 19-Aug-85 gfnames - return in successive calls the |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
648 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
|
649 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
650 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
651 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
|
652 char *arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
653 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
|
654 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
655 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
|
656 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
657 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
|
658 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
659 case 1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
660 *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
|
661 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
|
662 case 0: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
663 *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
|
664 return NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
665 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
666 *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
|
667 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
|
668 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
669 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
670 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
671 #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
|
672 system (cmd) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
673 char *cmd; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
674 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
675 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
|
676 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
677 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
678 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
679 #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
|
680 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
|
681 char *s; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
682 { |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
683 char *start = s; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
684 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
685 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
|
686 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
|
687 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
688 *s = EOS; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
689 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
690 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
691 else |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
692 *s = lowcase (*s); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
693 return start; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
694 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
695 #endif /* VMS */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
696 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
697 |
621 | 698 void |
240 | 699 main (argc, argv) |
700 int argc; | |
701 char *argv[]; | |
702 { | |
703 int i; | |
401 | 704 unsigned int nincluded_files = 0; |
4052
9535e8ffb209
* etags.c (alloca): removed all references to it.
Jim Blandy <jimb@redhat.com>
parents:
4051
diff
changeset
|
705 char **included_files = xnew (argc, char *); |
240 | 706 char *this_file; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
707 argument *argbuffer; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
708 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
|
709 struct linebuffer filename_lb; |
240 | 710 #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
|
711 logical got_err; |
240 | 712 #endif |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
713 |
9773
bd49556a7552
(main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents:
9635
diff
changeset
|
714 #ifdef DOS_NT |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
715 _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
|
716 #endif /* DOS_NT */ |
5448
18de002e47dd
(main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents:
5044
diff
changeset
|
717 |
240 | 718 progname = argv[0]; |
719 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
720 /* 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
|
721 is small. */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
722 argbuffer = xnew (argc, argument); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
723 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
724 #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
|
725 /* 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
|
726 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
|
727 #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
|
728 |
240 | 729 /* |
730 * If etags, always find typedefs and structure tags. Why not? | |
731 * Also default is to find macro constants. | |
732 */ | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
733 if (!CTAGS) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
734 typedefs = typedefs_and_cplusplus = constantypedefs = TRUE; |
240 | 735 |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
736 while (1) |
240 | 737 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
738 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
|
739 "-aCdDf:Il:o:r:RStTi:BuvxwVhH", longopts, 0); |
621 | 740 |
741 if (opt == EOF) | |
742 break; | |
743 | |
744 switch (opt) | |
240 | 745 { |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
746 case 0: |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
747 /* If getopt returns 0, then it has already processed a |
621 | 748 long-named option. We should do nothing. */ |
749 break; | |
240 | 750 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
751 case 1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
752 /* 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
|
753 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
|
754 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
|
755 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
756 ++file_count; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
757 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
758 |
621 | 759 /* Common options. */ |
760 case 'a': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
761 append_to_tagfile = TRUE; |
621 | 762 break; |
763 case 'C': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
764 cplusplus = TRUE; |
621 | 765 break; |
766 case 'd': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
767 constantypedefs = TRUE; |
621 | 768 break; |
769 case 'D': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
770 constantypedefs = FALSE; |
621 | 771 break; |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
772 case 'f': /* for compatibility with old makefiles */ |
621 | 773 case 'o': |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
774 if (tagfile) |
621 | 775 { |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
776 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
|
777 progname, opt); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
778 suggest_asking_for_help (); |
240 | 779 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
780 tagfile = optarg; |
621 | 781 break; |
10449
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
782 case 'I': |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
783 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
|
784 noindentypedefs = TRUE; |
2266157d9bcc
* etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents:
10404
diff
changeset
|
785 break; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
786 case 'l': |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
787 argbuffer[current_arg].function = get_language_from_name (optarg); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
788 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
|
789 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
790 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
791 #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
|
792 case 'r': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
793 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
|
794 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
|
795 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
796 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
797 case 'R': |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
798 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
|
799 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
|
800 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
801 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
802 #endif /* ETAGS_REGEXPS */ |
621 | 803 case 'V': |
804 print_version (); | |
805 break; | |
10047
9b284d98b102
* etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents:
9976
diff
changeset
|
806 case 'h': |
621 | 807 case 'H': |
808 print_help (); | |
809 break; | |
8180
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
810 case 't': |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
811 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
|
812 break; |
c98f9acb71e3
* etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents:
7776
diff
changeset
|
813 case 'T': |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
814 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
|
815 break; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
816 #if (!CTAGS) |
621 | 817 /* Etags options */ |
818 case 'i': | |
819 included_files[nincluded_files++] = optarg; | |
820 break; | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
821 #else /* CTAGS */ |
621 | 822 /* Ctags options. */ |
823 case 'B': | |
824 searchar = '?'; | |
825 break; | |
826 case 'u': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
827 update = TRUE; |
621 | 828 break; |
829 case 'v': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
830 vgrind_style = TRUE; |
621 | 831 /*FALLTHRU*/ |
832 case 'x': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
833 cxref_style = TRUE; |
621 | 834 break; |
835 case 'w': | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
836 no_warnings = TRUE; |
621 | 837 break; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
838 #endif /* CTAGS */ |
621 | 839 default: |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
840 suggest_asking_for_help (); |
240 | 841 } |
842 } | |
843 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
844 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
|
845 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
846 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
|
847 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
|
848 ++current_arg; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
849 ++file_count; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
850 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
851 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
852 if (nincluded_files == 0 && file_count == 0) |
240 | 853 { |
621 | 854 fprintf (stderr, "%s: No input files specified.\n", progname); |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
855 suggest_asking_for_help (); |
240 | 856 } |
857 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
858 if (tagfile == NULL) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
859 tagfile = CTAGS ? "tags" : "TAGS"; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
860 cwd = etags_getcwd (); /* the current working directory */ |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
861 if (cwd[strlen(cwd)-1] != '/') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
862 strcat (cwd, "/"); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
863 if (streq (tagfile, "-")) |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
864 tagfiledir = cwd; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
865 else |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
866 tagfiledir = absolute_dirname (tagfile, cwd); |
240 | 867 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
868 init (); /* set up boolean "functions" */ |
240 | 869 |
870 initbuffer (&lb); | |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
871 initbuffer (&token_name); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
872 initbuffer (&lbs[0].lb); |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
873 initbuffer (&lbs[1].lb); |
240 | 874 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
|
875 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
876 if (!CTAGS) |
240 | 877 { |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
878 if (streq (tagfile, "-")) |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
879 { |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
880 tagf = stdout; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
881 #ifdef DOS_NT |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
882 /* Switch redirected `stdout' to binary mode (setting `_fmode' |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
883 doesn't take effect until after `stdout' is already open), */ |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
884 if (!isatty (fileno (stdout))) |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
885 setmode (fileno (stdout), O_BINARY); |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
886 #endif /* DOS_NT */ |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
887 } |
240 | 888 else |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
889 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
|
890 if (tagf == NULL) |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
891 pfatal (tagfile); |
240 | 892 } |
893 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
894 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
895 * 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
|
896 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
897 for (i = 0; i < current_arg; ++i) |
240 | 898 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
899 switch (argbuffer[i].arg_type) |
240 | 900 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
901 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
|
902 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
|
903 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
904 #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
|
905 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
|
906 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
|
907 break; |
240 | 908 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
909 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
|
910 #ifdef VMS |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
911 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
|
912 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
913 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
|
914 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
915 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
|
916 argc--, argv++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
917 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
918 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
919 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
920 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
|
921 } |
240 | 922 #else |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
923 this_file = argbuffer[i].what; |
240 | 924 #endif |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
925 /* 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
|
926 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
|
927 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
|
928 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
|
929 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
|
930 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
931 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
|
932 #ifdef VMS |
240 | 933 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
934 #endif |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
935 break; |
240 | 936 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
937 } |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
938 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
939 if (!CTAGS) |
240 | 940 { |
401 | 941 while (nincluded_files-- > 0) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
942 fprintf (tagf, "\f\n%s,include\n", *included_files++); |
401 | 943 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
944 fclose (tagf); |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
945 exit (GOOD); |
240 | 946 } |
947 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
948 /* 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
|
949 because we want them ordered. Let's do it now. */ |
240 | 950 if (cxref_style) |
951 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
952 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
|
953 if (tagf == NULL) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
954 pfatal (tagfile); |
240 | 955 put_entries (head); |
956 exit (GOOD); | |
957 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
958 |
621 | 959 if (update) |
240 | 960 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
961 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
|
962 for (i = 0; i < current_arg; ++i) |
240 | 963 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
964 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
|
965 continue; |
240 | 966 sprintf (cmd, |
967 "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
|
968 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
|
969 if (system (cmd) != GOOD) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
970 fatal ("failed to execute shell command"); |
240 | 971 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
972 append_to_tagfile = TRUE; |
240 | 973 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
974 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
975 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
|
976 if (tagf == NULL) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
977 pfatal (tagfile); |
240 | 978 put_entries (head); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
979 fclose (tagf); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
980 |
240 | 981 if (update) |
982 { | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
983 char cmd[BUFSIZ]; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
984 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
|
985 exit (system (cmd)); |
240 | 986 } |
987 exit (GOOD); | |
988 } | |
989 | |
990 | |
991 /* | |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
992 * Return a Lang_function given the name. |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
993 */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
994 Lang_function * |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
995 get_language_from_name (name) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
996 char *name; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
997 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
998 struct lang_entry *lang; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
999 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1000 if (name != NULL) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1001 for (lang = lang_names; lang->name != NULL; lang++) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1002 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1003 if (streq (name, lang->name)) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1004 return lang->function; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1005 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1006 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1007 fprintf (stderr, "%s: language \"%s\" not recognized.\n", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1008 progname, optarg); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1009 suggest_asking_for_help (); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1010 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1011 /* This point should never be reached. The function should either |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1012 return a function pointer or never return. Note that a NULL |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1013 pointer cannot be considered as an error, as it means that the |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1014 language has not been explicitely imposed by the user ("auto"). */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1015 return NULL; /* avoid warnings from compiler */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1016 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1017 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1018 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1019 /* |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1020 * Return a Lang_function given the interpreter name. |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1021 */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1022 Lang_function * |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1023 get_language_from_interpreter (interpreter) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1024 char *interpreter; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1025 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1026 struct lang_entry *lang; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1027 char **iname; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1028 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1029 if (interpreter == NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1030 return NULL; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1031 for (lang = lang_names; lang->name != NULL; lang++) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1032 if (lang->interpreters != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1033 for (iname = lang->interpreters; *iname != NULL; iname++) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1034 if (streq (*iname, interpreter)) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1035 return lang->function; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1036 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1037 return NULL; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1038 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1039 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1040 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1041 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1042 /* |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1043 * Return a Lang_function given the file suffix. |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1044 */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1045 Lang_function * |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1046 get_language_from_suffix (suffix) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1047 char *suffix; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1048 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1049 struct lang_entry *lang; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1050 char **ext; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1051 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1052 if (suffix == NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1053 return NULL; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1054 for (lang = lang_names; lang->name != NULL; lang++) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1055 if (lang->suffixes != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1056 for (ext = lang->suffixes; *ext != NULL; ext++) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1057 if (streq (*ext, suffix)) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1058 return lang->function; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1059 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1060 return NULL; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1061 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1062 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1063 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1064 /* |
240 | 1065 * This routine is called on each file argument. |
1066 */ | |
1067 void | |
1068 process_file (file) | |
1069 char *file; | |
1070 { | |
1071 struct stat stat_buf; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1072 FILE *inf; |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1073 #ifdef DOS_NT |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1074 /* The rest of the program can't grok `\\'-style slashes. */ |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1075 char *p = file; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1076 |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1077 while (*p) |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1078 { |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1079 if (*p == '\\') |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1080 *p = '/'; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1081 ++p; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1082 } |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
1083 #endif |
240 | 1084 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1085 if (stat (file, &stat_buf) == 0 && !S_ISREG (stat_buf.st_mode)) |
240 | 1086 { |
1087 fprintf (stderr, "Skipping %s: it is not a regular file.\n", file); | |
1088 return; | |
1089 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1090 if (streq (file, tagfile) && !streq (tagfile, "-")) |
240 | 1091 { |
1092 fprintf (stderr, "Skipping inclusion of %s in self.\n", file); | |
1093 return; | |
1094 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1095 inf = fopen (file, "r"); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1096 if (inf == NULL) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1097 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1098 perror (file); |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1099 return; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1100 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1101 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1102 find_entries (file, inf); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1103 |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1104 if (!CTAGS) |
240 | 1105 { |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1106 char *filename; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1107 |
12344
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
1108 if (absolutefn (file)) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1109 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1110 /* file is an absolute filename. Canonicalise it. */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1111 filename = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1112 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1113 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1114 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1115 /* 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
|
1116 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
|
1117 filename = relative_filename (file, tagfiledir); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1118 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1119 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
|
1120 free (filename); |
240 | 1121 put_entries (head); |
1122 free_tree (head); | |
1123 head = NULL; | |
1124 } | |
1125 } | |
1126 | |
1127 /* | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3569
diff
changeset
|
1128 * 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
|
1129 * by setting boolean flags dependent upon the corresponding character |
240 | 1130 * Every char which is NOT in that string is not a white char. Therefore, |
1131 * all of the array "_wht" is set to FALSE, and then the elements | |
1132 * subscripted by the chars in "white" are set to TRUE. Thus "_wht" | |
1133 * of a char is TRUE if it is the string "white", else FALSE. | |
1134 */ | |
1135 void | |
1136 init () | |
1137 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1138 register char *sp; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1139 register int i; |
240 | 1140 |
1141 for (i = 0; i < 0177; i++) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1142 _wht[i] = _etk[i] = _itk[i] = _btk[i] = FALSE; |
240 | 1143 for (sp = white; *sp; sp++) |
1144 _wht[*sp] = TRUE; | |
1145 for (sp = endtk; *sp; sp++) | |
1146 _etk[*sp] = TRUE; | |
1147 for (sp = intk; *sp; sp++) | |
1148 _itk[*sp] = TRUE; | |
1149 for (sp = begtk; *sp; sp++) | |
1150 _btk[*sp] = TRUE; | |
1151 _wht[0] = _wht['\n']; | |
1152 _etk[0] = _etk['\n']; | |
1153 _btk[0] = _btk['\n']; | |
1154 _itk[0] = _itk['\n']; | |
1155 } | |
1156 | |
1157 /* | |
1158 * This routine opens the specified file and calls the function | |
1159 * which finds the function and type definitions. | |
1160 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1161 void |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1162 find_entries (file, inf) |
240 | 1163 char *file; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1164 FILE *inf; |
240 | 1165 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1166 char *cp; |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1167 Lang_function *function; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1168 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
|
1169 extern NODE *last_node; |
240 | 1170 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1171 |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1172 /* Memory leakage here: the memory block pointed by curfile is never |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1173 released. The amount of memory leaked here is the sum of the |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1174 lengths of the input file names. */ |
240 | 1175 curfile = savestr (file); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1176 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1177 /* If user specified a language, use it. */ |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1178 function = lang_func; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1179 if (function != NULL) |
240 | 1180 { |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1181 function (inf); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1182 fclose (inf); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1183 return; |
240 | 1184 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1185 |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1186 cp = etags_strrchr (file, '.'); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1187 if (cp != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1188 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1189 cp += 1; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1190 function = get_language_from_suffix (cp); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1191 if (function != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1192 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1193 function (inf); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1194 fclose (inf); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1195 return; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1196 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1197 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1198 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1199 /* Look for sharp-bang as the first two characters. */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1200 if (readline_internal (&lb, inf) > 2 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1201 && lb.buffer[0] == '#' |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1202 && lb.buffer[1] == '!') |
240 | 1203 { |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1204 char *lp; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1205 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1206 /* Set lp to point at the first char after the last slash in the |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1207 line or, if no slashes, at the first nonblank. Then set cp to |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1208 the first successive blank and terminate the string. */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1209 lp = etags_strrchr (lb.buffer+2, '/'); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1210 if (lp != NULL) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1211 lp += 1; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1212 else |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1213 for (lp = lb.buffer+2; *lp != '\0' && isspace (*lp); lp++) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1214 continue; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1215 for (cp = lp; *cp != '\0' && !isspace (*cp); cp++) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1216 continue; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1217 *cp = '\0'; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1218 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1219 if (strlen (lp) > 0) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1220 { |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1221 function = get_language_from_interpreter (lp); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1222 if (function != NULL) |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1223 { |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1224 function (inf); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1225 fclose (inf); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1226 return; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1227 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1228 } |
240 | 1229 } |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1230 rewind (inf); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1231 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1232 /* Try Fortran. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1233 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
|
1234 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
|
1235 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1236 /* 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
|
1237 if (old_last_node == last_node) |
12344
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
1238 { |
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
1239 rewind (inf); |
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
1240 default_C_entries (inf); |
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
1241 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1242 fclose (inf); |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
1243 return; |
240 | 1244 } |
1245 | |
1246 /* Record a tag. */ | |
1247 void | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1248 pfnote (name, is_func, linestart, linelen, lno, cno) |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1249 char *name; /* tag name, or NULL if unnamed */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1250 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
|
1251 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
|
1252 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
|
1253 int lno; /* line number */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1254 long cno; /* character number */ |
240 | 1255 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1256 register NODE *np; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1257 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1258 if (CTAGS && name == NULL) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1259 return; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1260 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1261 np = xnew (1, NODE); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1262 |
240 | 1263 /* 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
|
1264 if (CTAGS && !cxref_style && streq (name, "main")) |
240 | 1265 { |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1266 register char *fp = etags_strrchr (curfile, '/'); |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1267 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
|
1268 fp = etags_strrchr (np->name, '.'); |
240 | 1269 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
|
1270 fp[0] = 0; |
240 | 1271 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1272 else |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1273 np->name = name; |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
1274 np->been_warned = FALSE; |
240 | 1275 np->file = curfile; |
1276 np->is_func = is_func; | |
1277 np->lno = lno; | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1278 /* 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
|
1279 ctags compatibility? old versions compatibility? I don't know. |
14021
19bab04cf346
(substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents:
13696
diff
changeset
|
1280 Anyway, since emacs's are 1-base we expect etags.el to take care |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1281 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
|
1282 uncomment the +1 below. */ |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
1283 np->cno = cno /* + 1 */ ; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1284 np->left = np->right = NULL; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1285 if (CTAGS && !cxref_style) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1286 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1287 if (strlen (linestart) < 50) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1288 np->pat = concat (linestart, "$", ""); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1289 else |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1290 np->pat = savenstr (linestart, 50); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1291 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1292 else |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1293 np->pat = savenstr (linestart, linelen); |
240 | 1294 |
1295 add_node (np, &head); | |
1296 } | |
1297 | |
1298 /* | |
1299 * free_tree () | |
1300 * recurse on left children, iterate on right children. | |
1301 */ | |
1302 void | |
1303 free_tree (node) | |
1304 register NODE *node; | |
1305 { | |
1306 while (node) | |
1307 { | |
1308 register NODE *node_right = node->right; | |
1309 free_tree (node->left); | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1310 if (node->name != NULL) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1311 free (node->name); |
240 | 1312 free (node->pat); |
1313 free ((char *) node); | |
1314 node = node_right; | |
1315 } | |
1316 } | |
1317 | |
1318 /* | |
1319 * add_node () | |
1320 * Adds a node to the tree of nodes. In etags mode, we don't keep | |
1321 * it sorted; we just keep a linear list. In ctags mode, maintain | |
1322 * an ordered tree, with no attempt at balancing. | |
1323 * | |
1324 * add_node is the only function allowed to add nodes, so it can | |
1325 * maintain state. | |
1326 */ | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1327 NODE *last_node = NULL; |
240 | 1328 void |
1329 add_node (node, cur_node_p) | |
1330 NODE *node, **cur_node_p; | |
1331 { | |
1332 register int dif; | |
1333 register NODE *cur_node = *cur_node_p; | |
1334 | |
1335 if (cur_node == NULL) | |
1336 { | |
1337 *cur_node_p = node; | |
1338 last_node = node; | |
1339 return; | |
1340 } | |
1341 | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1342 if (!CTAGS) |
240 | 1343 { |
1344 /* Etags Mode */ | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1345 if (last_node == NULL) |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
1346 fatal ("internal error in add_node", 0); |
240 | 1347 last_node->right = node; |
1348 last_node = node; | |
1349 } | |
1350 else | |
1351 { | |
1352 /* Ctags Mode */ | |
1353 dif = strcmp (node->name, cur_node->name); | |
1354 | |
1355 /* | |
1356 * If this tag name matches an existing one, then | |
1357 * do not add the node, but maybe print a warning. | |
1358 */ | |
1359 if (!dif) | |
1360 { | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1361 if (streq (node->file, cur_node->file)) |
240 | 1362 { |
1363 if (!no_warnings) | |
1364 { | |
1365 fprintf (stderr, "Duplicate entry in file %s, line %d: %s\n", | |
1366 node->file, lineno, node->name); | |
1367 fprintf (stderr, "Second entry ignored\n"); | |
1368 } | |
1369 } | |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1370 else if (!cur_node->been_warned && !no_warnings) |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1371 { |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1372 fprintf |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1373 (stderr, |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1374 "Duplicate entry in files %s and %s: %s (Warning only)\n", |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1375 node->file, cur_node->file, node->name); |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1376 cur_node->been_warned = TRUE; |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1377 } |
240 | 1378 return; |
1379 } | |
1380 | |
1381 /* Actually add the node */ | |
1382 add_node (node, dif < 0 ? &cur_node->left : &cur_node->right); | |
1383 } | |
1384 } | |
1385 | |
1386 void | |
1387 put_entries (node) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1388 register NODE *node; |
240 | 1389 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1390 register char *sp; |
240 | 1391 |
1392 if (node == NULL) | |
1393 return; | |
1394 | |
1395 /* Output subentries that precede this one */ | |
1396 put_entries (node->left); | |
1397 | |
1398 /* Output this entry */ | |
1399 | |
6530
12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents:
6482
diff
changeset
|
1400 if (!CTAGS) |
240 | 1401 { |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1402 if (node->name != NULL) |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1403 fprintf (tagf, "%s\177%s\001%d,%d\n", |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1404 node->pat, node->name, node->lno, node->cno); |
240 | 1405 else |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1406 fprintf (tagf, "%s\177%d,%d\n", |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1407 node->pat, node->lno, node->cno); |
240 | 1408 } |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1409 else |
240 | 1410 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1411 if (node->name == NULL) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1412 error ("internal error: NULL name in ctags mode.", 0); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1413 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1414 if (cxref_style) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1415 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1416 if (vgrind_style) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1417 fprintf (stdout, "%s %s %d\n", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1418 node->name, node->file, (node->lno + 63) / 64); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1419 else |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1420 fprintf (stdout, "%-16s %3d %-16s %s\n", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1421 node->name, node->lno, node->file, node->pat); |
240 | 1422 } |
1423 else | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1424 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1425 fprintf (tagf, "%s\t%s\t", node->name, node->file); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1426 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1427 if (node->is_func) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1428 { /* a function */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1429 putc (searchar, tagf); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1430 putc ('^', tagf); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1431 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1432 for (sp = node->pat; *sp; sp++) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1433 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1434 if (*sp == '\\' || *sp == searchar) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1435 putc ('\\', tagf); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1436 putc (*sp, tagf); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1437 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1438 putc (searchar, tagf); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1439 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1440 else |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1441 { /* a typedef; text pattern inadequate */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1442 fprintf (tagf, "%d", node->lno); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1443 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1444 putc ('\n', tagf); |
240 | 1445 } |
1446 } | |
1447 | |
1448 /* Output subentries that follow this one */ | |
1449 put_entries (node->right); | |
1450 } | |
1451 | |
1452 /* Length of a number's decimal representation. */ | |
1453 int | |
1454 number_len (num) | |
1455 long num; | |
1456 { | |
1457 int len = 0; | |
1458 if (!num) | |
1459 return 1; | |
1460 for (; num; num /= 10) | |
1461 ++len; | |
1462 return len; | |
1463 } | |
1464 | |
1465 /* | |
1466 * 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
|
1467 * 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
|
1468 * 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
|
1469 * 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
|
1470 * backward compatibility. |
240 | 1471 */ |
1472 int | |
1473 total_size_of_entries (node) | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1474 register NODE *node; |
240 | 1475 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1476 register int total; |
240 | 1477 |
1478 if (node == NULL) | |
1479 return 0; | |
1480 | |
1481 total = 0; | |
1482 for (; node; node = node->right) | |
1483 { | |
1484 /* Count left subentries. */ | |
1485 total += total_size_of_entries (node->left); | |
1486 | |
1487 /* Count this entry */ | |
1488 total += strlen (node->pat) + 1; | |
1489 total += number_len ((long) node->lno) + 1 + number_len (node->cno) + 1; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
1490 if (node->name != NULL) |
240 | 1491 total += 1 + strlen (node->name); /* \001name */ |
1492 } | |
1493 | |
1494 return total; | |
1495 } | |
1496 | |
1497 /* | |
1498 * The C symbol tables. | |
1499 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1500 enum sym_type |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1501 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1502 st_none, st_C_objprot, st_C_objimpl, st_C_objend, st_C_gnumacro, |
14230
6b836f84bccf
(enum sym_type, anonymous enum): Delete final comma.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1503 st_C_struct, st_C_enum, st_C_define, st_C_typedef, st_C_typespec |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1504 }; |
240 | 1505 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1506 /* 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
|
1507 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
|
1508 %[ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1509 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
|
1510 %% |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1511 @interface, 0, st_C_objprot |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1512 @protocol, 0, st_C_objprot |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1513 @implementation,0, st_C_objimpl |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1514 @end, 0, st_C_objend |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1515 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
|
1516 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
|
1517 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
|
1518 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
|
1519 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
|
1520 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
|
1521 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
|
1522 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
|
1523 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
|
1524 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
|
1525 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
|
1526 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
|
1527 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
|
1528 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
|
1529 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
|
1530 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
|
1531 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
|
1532 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
|
1533 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
|
1534 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
|
1535 volatile, 0, st_C_typespec |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1536 # DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach). |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1537 DEFUN, 0, st_C_gnumacro |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1538 SYSCALL, 0, st_C_gnumacro |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1539 ENTRY, 0, st_C_gnumacro |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1540 PSEUDO, 0, st_C_gnumacro |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1541 # These are defined inside C functions, so currently they are not met. |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1542 # EXFUN used in glibc, DEFVAR_* in emacs. |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1543 #EXFUN, 0, st_C_gnumacro |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1544 #DEFVAR_, 0, st_C_gnumacro |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1545 %] |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1546 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
|
1547 /*%<*/ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1548 /* 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
|
1549 /* Command-line: gperf -c -k1,3 -o -p -r -t */ |
240 | 1550 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1551 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1552 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
|
1553 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1554 #define MIN_WORD_LENGTH 3 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1555 #define MAX_WORD_LENGTH 15 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1556 #define MIN_HASH_VALUE 7 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1557 #define MAX_HASH_VALUE 63 |
240 | 1558 /* |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1559 29 keywords |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1560 57 is the maximum key range |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1561 */ |
240 | 1562 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1563 static int |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1564 hash (str, len) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1565 register char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1566 register int len; |
240 | 1567 { |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1568 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
|
1569 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1570 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1571 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1572 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1573 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1574 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1575 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1576 63, 63, 63, 63, 17, 63, 63, 63, 4, 14, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1577 4, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1578 8, 63, 63, 0, 23, 63, 63, 63, 63, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1579 63, 63, 63, 63, 63, 63, 63, 28, 63, 28, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1580 10, 31, 27, 18, 63, 6, 63, 63, 26, 1, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1581 11, 2, 29, 63, 29, 16, 26, 13, 15, 63, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1582 63, 63, 63, 63, 63, 63, 63, 63, |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1583 }; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1584 return len + hash_table[str[2]] + hash_table[str[0]]; |
240 | 1585 } |
1586 | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1587 struct C_stab_entry * |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1588 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
|
1589 register char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1590 register int len; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1591 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1592 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1593 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
|
1594 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1595 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1596 {"SYSCALL", 0, st_C_gnumacro}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1597 {"",}, {"",}, {"",}, {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1598 {"DEFUN", 0, st_C_gnumacro}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1599 {"",}, {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1600 {"domain", C_STAR, st_C_struct}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1601 {"",}, {"",}, {"",}, {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1602 {"short", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1603 {"union", 0, st_C_struct}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1604 {"void", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1605 {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1606 {"PSEUDO", 0, st_C_gnumacro}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1607 {"double", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1608 {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1609 {"@end", 0, st_C_objend}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1610 {"@implementation", 0, st_C_objimpl}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1611 {"float", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1612 {"int", 0, st_C_typespec}, |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1613 {"",}, |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1614 {"unsigned", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1615 {"@interface", 0, st_C_objprot}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1616 {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1617 {"signed", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1618 {"long", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1619 {"ENTRY", 0, st_C_gnumacro}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1620 {"define", 0, st_C_define}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1621 {"const", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1622 {"",}, {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1623 {"enum", 0, st_C_enum}, |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1624 {"volatile", 0, st_C_typespec}, |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1625 {"static", 0, st_C_typespec}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1626 {"struct", 0, st_C_struct}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1627 {"",}, {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1628 {"@protocol", 0, st_C_objprot}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1629 {"",}, {"",}, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1630 {"auto", 0, st_C_typespec}, |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1631 {"",}, |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1632 {"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
|
1633 {"class", C_PLPL, st_C_struct}, |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1634 {"typedef", 0, st_C_typedef}, |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1635 {"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
|
1636 }; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1637 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1638 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
|
1639 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1640 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
|
1641 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1642 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
|
1643 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1644 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
|
1645 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1646 if (*s == *str && !strncmp (str + 1, s + 1, len - 1)) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1647 return &wordlist[key]; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1648 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1649 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1650 return 0; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1651 } |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1652 /*%>*/ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1653 |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1654 enum sym_type |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1655 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
|
1656 char *str; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1657 int len; |
240 | 1658 int c_ext; |
1659 { | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1660 register struct C_stab_entry *se = in_word_set(str, len); |
240 | 1661 |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1662 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
|
1663 return st_none; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1664 return se->type; |
240 | 1665 } |
1666 | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1667 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1668 * 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
|
1669 * funcdef is its state variable. |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1670 */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1671 enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1672 { |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1673 fnone, /* nothing seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1674 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
|
1675 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
|
1676 finlist, /* in parameter list */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1677 flistseen, /* after parameter list */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
1678 fignore /* before open brace */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1679 } funcdef; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1680 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1681 |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1682 /* |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1683 * typedefs are recognized using a simple finite automaton. |
14021
19bab04cf346
(substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents:
13696
diff
changeset
|
1684 * typdef is its state variable. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1685 */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1686 enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1687 { |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1688 tnone, /* nothing seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1689 ttypedseen, /* typedef keyword seen */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
1690 tinbody, /* inside typedef body */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1691 tend, /* just before typedef tag */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1692 tignore /* junk after typedef tag */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1693 } typdef; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1694 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1695 |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1696 /* |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1697 * 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
|
1698 * 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
|
1699 * variable. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1700 */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1701 enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1702 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1703 snone, /* nothing seen yet */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1704 skeyseen, /* struct-like keyword seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1705 stagseen, /* struct-like tag seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1706 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
|
1707 sinbody /* in struct body: recognize member func defs*/ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1708 } structdef; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
1709 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1710 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1711 * When structdef is stagseen, scolonseen, or sinbody, structtag is the |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1712 * struct tag, and structtype is the type of the preceding struct-like |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1713 * keyword. |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1714 */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1715 char *structtag = "<uninited>"; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
1716 enum sym_type structtype; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1717 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1718 /* |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1719 * When objdef is different from onone, objtag is the name of the class. |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1720 */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1721 char *objtag = "<uninited>"; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1722 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1723 /* |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1724 * 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
|
1725 */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1726 enum |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1727 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1728 dnone, /* nothing seen */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1729 dsharpseen, /* '#' seen as first char on line */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1730 ddefineseen, /* '#' and 'define' seen */ |
5044
d3bd7baee39f
(FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents:
4937
diff
changeset
|
1731 dignorerest /* ignore rest of line */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1732 } definedef; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1733 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1734 /* |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1735 * State machine for Objective C protocols and implementations. |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1736 */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1737 enum |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1738 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1739 onone, /* nothing seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1740 oprotocol, /* @interface or @protocol seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1741 oimplementation, /* @implementations seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1742 otagseen, /* class name seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1743 oparenseen, /* parenthesis before category seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1744 ocatseen, /* category name seen */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1745 oinbody, /* in @implementation body */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1746 omethodsign, /* in @implementation body, after +/- */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1747 omethodtag, /* after method name */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1748 omethodcolon, /* after method colon */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1749 omethodparm, /* after method parameter */ |
14230
6b836f84bccf
(enum sym_type, anonymous enum): Delete final comma.
Karl Heuer <kwzh@gnu.org>
parents:
14186
diff
changeset
|
1750 oignore /* wait for @end */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1751 } objdef; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1752 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1753 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1754 * 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
|
1755 * 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
|
1756 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1757 logical next_token_is_func; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1758 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1759 /* |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1760 * 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
|
1761 */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1762 logical yacc_rules; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
1763 |
240 | 1764 /* |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1765 * methodlen is the length of the method name stored in token_name. |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1766 */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1767 int methodlen; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1768 |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1769 /* |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1770 * consider_token () |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1771 * 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
|
1772 * 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
|
1773 * tag. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1774 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1775 * *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
|
1776 * 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
|
1777 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1778 * 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
|
1779 * 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
|
1780 * `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
|
1781 * whatever follows `operator'. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1782 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1783 * Globals |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1784 * funcdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1785 * structdef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1786 * definedef IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1787 * typdef IN OUT |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1788 * objdef IN OUT |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1789 * next_token_is_func IN OUT |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1790 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1791 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1792 logical |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1793 consider_token (str, len, c, c_ext, cblev, parlev, is_func) |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1794 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
|
1795 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
|
1796 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
|
1797 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
|
1798 int cblev; /* IN: curly brace level */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1799 int parlev; /* IN: parenthesis level */ |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1800 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
|
1801 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1802 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
|
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 * Advance the definedef state machine. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1806 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1807 switch (definedef) |
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 case dnone: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1810 /* 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
|
1811 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1812 case dsharpseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1813 if (toktype == st_C_define) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1814 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1815 definedef = ddefineseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1816 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1817 else |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1818 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1819 definedef = dignorerest; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1820 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1821 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1822 case ddefineseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1823 /* |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
1824 * 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
|
1825 * and constantypedefs is FALSE. |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1826 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1827 definedef = dignorerest; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1828 *is_func = (c == '('); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1829 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
|
1830 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1831 else |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1832 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1833 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
|
1834 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1835 default: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1836 error ("internal error: definedef value.", 0); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1837 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1838 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1839 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1840 * Now typedefs |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1841 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1842 switch (typdef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1843 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1844 case tnone: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1845 if (toktype == st_C_typedef) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1846 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1847 if (typedefs) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1848 typdef = ttypedseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1849 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
|
1850 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1851 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1852 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1853 case ttypedseen: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1854 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1855 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1856 case st_none: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1857 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1858 typdef = tend; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1859 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1860 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1861 case st_C_enum: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1862 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1863 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1864 /* 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
|
1865 break; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1866 case tend: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1867 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1868 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1869 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1870 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1871 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
|
1872 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1873 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1874 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1875 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1876 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1877 /* |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1878 * 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
|
1879 * 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
|
1880 * 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
|
1881 * within structs. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1882 * |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1883 * 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
|
1884 * 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
|
1885 * 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
|
1886 * |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1887 * This if statement deals with the typdef state machine as |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1888 * follows: if typdef==ttypedseen and token is struct/union/class/enum, |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
1889 * 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
|
1890 * state machine. |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1891 */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1892 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1893 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1894 case st_C_struct: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1895 case st_C_enum: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1896 if (typdef == ttypedseen |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1897 || (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
|
1898 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1899 structdef = skeyseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1900 structtype = toktype; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1901 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
1902 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1903 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1904 if (structdef == skeyseen) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1905 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1906 /* 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
|
1907 defined inside. */ |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1908 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
|
1909 structtag = savenstr (str, len); |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1910 else |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
1911 structtag = "<enum>"; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1912 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
|
1913 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1914 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1915 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1916 /* 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
|
1917 if (typdef != tnone) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1918 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1919 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
|
1920 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1921 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1922 |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1923 /* Detect GNU macros. */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1924 if (definedef == dnone && toktype == st_C_gnumacro) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1925 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1926 next_token_is_func = TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1927 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1928 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1929 if (next_token_is_func) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1930 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1931 next_token_is_func = FALSE; |
9635
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1932 funcdef = fignore; |
8defeb29b293
* etags.c (prestr, substr): return a logical type.
Francesco Potortì <pot@gnu.org>
parents:
9621
diff
changeset
|
1933 *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
|
1934 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1935 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
1936 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1937 /* |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1938 * Detecting Objective C constructs. |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1939 */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1940 switch (objdef) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1941 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1942 case onone: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1943 switch (toktype) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1944 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1945 case st_C_objprot: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1946 objdef = oprotocol; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1947 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1948 case st_C_objimpl: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1949 objdef = oimplementation; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1950 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1951 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1952 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1953 case oimplementation: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1954 /* Save the class tag for functions that may be defined inside. */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1955 objtag = savenstr (str, len); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1956 objdef = oinbody; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1957 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1958 case oprotocol: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1959 /* Save the class tag for categories. */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1960 objtag = savenstr (str, len); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1961 objdef = otagseen; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1962 *is_func = TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1963 return TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1964 case oparenseen: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1965 objdef = ocatseen; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1966 *is_func = TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1967 return TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1968 case oinbody: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1969 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1970 case omethodsign: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1971 if (parlev == 0) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1972 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1973 objdef = omethodtag; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1974 methodlen = len; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1975 GROW_LINEBUFFER (token_name, methodlen+1); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1976 strncpy (token_name.buffer, str, len); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1977 token_name.buffer[methodlen] = '\0'; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1978 return TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1979 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1980 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1981 case omethodcolon: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1982 if (parlev == 0) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1983 objdef = omethodparm; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1984 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1985 case omethodparm: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1986 if (parlev == 0) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1987 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1988 objdef = omethodtag; |
14144
beb39f795f21
(consider_token): Fix typo in expression.
Karl Heuer <kwzh@gnu.org>
parents:
14021
diff
changeset
|
1989 methodlen += len; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1990 GROW_LINEBUFFER (token_name, methodlen+1); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1991 strncat (token_name.buffer, str, len); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1992 return TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1993 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1994 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1995 case oignore: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1996 if (toktype == st_C_objend) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1997 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1998 /* Memory leakage here: the string pointed by objtag is |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
1999 never released, because many tests would be needed to |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2000 avoid breaking on incorrect input code. The amount of |
14021
19bab04cf346
(substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents:
13696
diff
changeset
|
2001 memory leaked here is the sum of the lengths of the |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2002 class tags. |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2003 free (objtag); */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2004 objdef = onone; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2005 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2006 return FALSE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2007 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2008 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2009 /* A function? */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2010 switch (toktype) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2011 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2012 case st_C_typespec: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2013 if (funcdef != finlist && funcdef != fignore) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2014 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
|
2015 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2016 default: |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2017 if (funcdef == fnone) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2018 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2019 funcdef = ftagseen; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2020 *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
|
2021 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2022 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2023 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2024 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2025 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2026 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2027 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2028 /* |
240 | 2029 * C_entries () |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2030 * 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
|
2031 * struct/union/enum definitions in C syntax and adds them |
240 | 2032 * to the list. |
2033 */ | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2034 typedef struct |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2035 { |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2036 logical valid; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2037 char *str; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2038 logical named; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2039 int linelen; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2040 int lineno; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2041 long linepos; |
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2042 char *buffer; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2043 } TOKEN; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2044 |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2045 #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
|
2046 #define switch_line_buffers() (curndx = 1 - curndx) |
240 | 2047 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2048 #define curlb (lbs[curndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2049 #define othlb (lbs[1-curndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2050 #define newlb (lbs[newndx].lb) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2051 #define curlinepos (lbs[curndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2052 #define othlinepos (lbs[1-curndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2053 #define newlinepos (lbs[newndx].linepos) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2054 |
240 | 2055 #define CNL_SAVE_DEFINEDEF \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2056 do { \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2057 curlinepos = charno; \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2058 lineno++; \ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2059 charno += readline (&curlb, inf); \ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2060 lp = curlb.buffer; \ |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
2061 quotednl = FALSE; \ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2062 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
|
2063 } while (0) |
240 | 2064 |
2065 #define CNL \ | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2066 do { \ |
240 | 2067 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
|
2068 if (savetok.valid) \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2069 { \ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2070 tok = savetok; \ |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2071 savetok.valid = FALSE; \ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2072 } \ |
240 | 2073 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
|
2074 } while (0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2075 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2076 /* Ideally this macro should never be called wihen tok.valid is FALSE, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2077 but this would mean that the state machines always guess right. */ |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2078 #define make_tag(isfun) do \ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2079 if (tok.valid) { \ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2080 char *name = NULL; \ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2081 if (CTAGS || tok.named) \ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2082 name = savestr (token_name.buffer); \ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2083 pfnote (name, isfun, tok.buffer, tok.linelen, tok.lineno, tok.linepos); \ |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2084 tok.valid = FALSE; \ |
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2085 } while (0) |
240 | 2086 |
2087 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2088 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
|
2089 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
|
2090 FILE *inf; /* input file */ |
240 | 2091 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2092 register char c; /* latest char read; '\0' for end of line */ |
240 | 2093 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
|
2094 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
|
2095 TOKEN tok; /* latest token read */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2096 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
|
2097 register int toklen; /* length of current token */ |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2098 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
|
2099 int parlev; /* current parenthesis level */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2100 logical incomm, inquote, inchar, quotednl, midtoken; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2101 logical cplpl; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2102 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
|
2103 |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2104 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2105 curndx = newndx = 0; |
240 | 2106 lineno = 0; |
2107 charno = 0; | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2108 lp = curlb.buffer; |
240 | 2109 *lp = 0; |
2110 | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2111 funcdef = fnone; typdef = tnone; structdef = snone; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2112 definedef = dnone; objdef = onone; |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2113 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
|
2114 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
|
2115 tok.valid = savetok.valid = FALSE; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2116 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
|
2117 parlev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2118 cplpl = c_ext & C_PLPL; |
240 | 2119 |
2120 while (!feof (inf)) | |
2121 { | |
2122 c = *lp++; | |
2123 if (c == '\\') | |
2124 { | |
621 | 2125 /* If we're at the end of the line, the next character is a |
2126 '\0'; don't skip it, because it's the thing that tells us | |
2127 to read the next line. */ | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2128 if (*lp == '\0') |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
2129 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2130 quotednl = TRUE; |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
2131 continue; |
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
2132 } |
401 | 2133 lp++; |
240 | 2134 c = ' '; |
2135 } | |
2136 else if (incomm) | |
2137 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2138 switch (c) |
240 | 2139 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2140 case '*': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2141 if (*lp == '/') |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2142 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2143 c = *lp++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2144 incomm = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2145 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2146 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2147 case '\0': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2148 /* 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
|
2149 traditional cpp. */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2150 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2151 break; |
240 | 2152 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2153 continue; |
240 | 2154 } |
2155 else if (inquote) | |
2156 { | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2157 switch (c) |
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 case '"': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2160 inquote = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2161 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2162 case '\0': |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2163 /* 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
|
2164 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
|
2165 usually accept them. */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2166 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2167 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2168 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2169 continue; |
240 | 2170 } |
2171 else if (inchar) | |
2172 { | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2173 switch (c) |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2174 { |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2175 case '\0': |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2176 /* Hmmm, something went wrong. */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2177 CNL; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2178 /* FALLTHRU */ |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2179 case '\'': |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2180 inchar = FALSE; |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2181 break; |
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2182 } |
240 | 2183 continue; |
2184 } | |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2185 else |
240 | 2186 switch (c) |
2187 { | |
2188 case '"': | |
2189 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
|
2190 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
|
2191 funcdef = fnone; |
240 | 2192 continue; |
2193 case '\'': | |
2194 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
|
2195 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
|
2196 funcdef = fnone; |
240 | 2197 continue; |
2198 case '/': | |
2199 if (*lp == '*') | |
2200 { | |
2201 lp++; | |
2202 incomm = TRUE; | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2203 continue; |
240 | 2204 } |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2205 else if (/* cplpl && */ *lp == '/') |
240 | 2206 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2207 c = '\0'; |
727 | 2208 break; |
240 | 2209 } |
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 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
|
2211 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2212 case '%': |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2213 if ((c_ext & YACC) && *lp == '%') |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2214 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2215 /* 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
|
2216 lp++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2217 definedef = dnone; funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2218 typdef = tnone; structdef = snone; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2219 next_token_is_func = FALSE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2220 midtoken = inquote = inchar = incomm = quotednl = FALSE; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2221 cblev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2222 yacc_rules = !yacc_rules; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2223 continue; |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2224 } |
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
|
2225 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
|
2226 break; |
240 | 2227 case '#': |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2228 if (definedef == dnone) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2229 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2230 char *cp; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2231 logical cpptoken = TRUE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2232 |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2233 /* 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
|
2234 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
|
2235 token. */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2236 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
|
2237 if (!iswhite (*cp)) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2238 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2239 if (*cp == '*' && *(cp+1) == '/') |
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 cp++; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2242 cpptoken = TRUE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2243 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2244 else |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2245 cpptoken = FALSE; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2246 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2247 if (cpptoken) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2248 definedef = dsharpseen; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2249 } /* if (definedef == dnone) */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2250 |
240 | 2251 continue; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2252 } /* switch (c) */ |
240 | 2253 |
2254 | |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2255 /* 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
|
2256 if ((definedef != dnone |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2257 || (cblev == 0 && structdef != scolonseen) |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2258 || (cblev == 1 && cplpl && structdef == sinbody)) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2259 && typdef != tignore |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2260 && definedef != dignorerest |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2261 && funcdef != finlist) |
240 | 2262 { |
2263 if (midtoken) | |
2264 { | |
2265 if (endtoken (c)) | |
2266 { | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2267 if (c == ':' && cplpl && *lp == ':' && begtoken(*(lp + 1))) |
240 | 2268 { |
2269 /* | |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2270 * 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
|
2271 * beginning of an identifier. |
240 | 2272 */ |
2273 lp += 2; | |
2274 toklen += 3; | |
2275 } | |
2276 else | |
2277 { | |
4750
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2278 logical is_func = FALSE; |
240 | 2279 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2280 if (yacc_rules |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2281 || consider_token (newlb.buffer + tokoff, toklen, c, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2282 c_ext, cblev, parlev, &is_func)) |
240 | 2283 { |
2004
6469a137fea6
(C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents:
1938
diff
changeset
|
2284 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
|
2285 && definedef == dnone |
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2286 && is_func) |
cdefe4f21650
Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents:
4696
diff
changeset
|
2287 /* 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
|
2288 { |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2289 GROW_LINEBUFFER (token_name, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2290 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
|
2291 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
|
2292 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
|
2293 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
|
2294 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
|
2295 tok.named = TRUE; |
240 | 2296 } |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2297 else if (objdef == ocatseen) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2298 /* Objective C category */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2299 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2300 GROW_LINEBUFFER (token_name, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2301 strlen(objtag)+2+toklen+1); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2302 strcpy (token_name.buffer, objtag); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2303 strcat (token_name.buffer, "("); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2304 strncat (token_name.buffer, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2305 newlb.buffer+tokoff, toklen); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2306 strcat (token_name.buffer, ")"); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2307 tok.named = TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2308 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2309 else if (objdef == omethodtag |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2310 || objdef == omethodparm) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2311 /* Objective C method */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2312 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2313 tok.named = TRUE; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2314 } |
240 | 2315 else |
2316 { | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2317 GROW_LINEBUFFER (token_name, toklen+1); |
10801
32f98b512dd9
* etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents:
10761
diff
changeset
|
2318 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
|
2319 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
|
2320 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
|
2321 if (structdef == stagseen |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2322 || typdef == tend |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2323 || (is_func |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2324 && definedef == dignorerest)) /* macro */ |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2325 tok.named = TRUE; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2326 else |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2327 tok.named = FALSE; |
240 | 2328 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2329 tok.lineno = lineno; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2330 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
|
2331 tok.buffer = newlb.buffer; |
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2332 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
|
2333 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
|
2334 |
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 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
|
2336 && (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
|
2337 || structdef == stagseen |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2338 || typdef == tend |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2339 || objdef != onone)) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2340 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2341 if (current_lb_is_new) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2342 switch_line_buffers (); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2343 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2344 else |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2345 make_tag (is_func); |
240 | 2346 } |
2347 midtoken = FALSE; | |
2348 } | |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2349 } /* if (endtoken (c)) */ |
240 | 2350 else if (intoken (c)) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2351 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2352 toklen++; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2353 continue; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2354 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2355 } /* if (midtoken) */ |
240 | 2356 else if (begtoken (c)) |
2357 { | |
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
|
2358 switch (definedef) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2359 { |
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
|
2360 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
|
2361 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
|
2362 { |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2363 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
|
2364 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
|
2365 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
|
2366 case flistseen: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2367 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
|
2368 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
|
2369 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
|
2370 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
|
2371 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
|
2372 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
|
2373 } |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2374 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
|
2375 structdef = snone; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2376 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
|
2377 case dsharpseen: |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
2378 savetok = tok; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2379 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2380 if (!yacc_rules || lp == newlb.buffer + 1) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2381 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2382 tokoff = lp - 1 - newlb.buffer; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2383 toklen = 1; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2384 midtoken = TRUE; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2385 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2386 continue; |
10623
8a73e71a55e3
* etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents:
10449
diff
changeset
|
2387 } /* if (begtoken) */ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2388 } /* if must look at token */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2389 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2390 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2391 /* 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
|
2392 after having handled a token.*/ |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2393 switch (c) |
401 | 2394 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2395 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
|
2396 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
|
2397 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2398 switch (objdef) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2399 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2400 case otagseen: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2401 objdef = oignore; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2402 make_tag (TRUE); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2403 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2404 case omethodtag: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2405 case omethodparm: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2406 objdef = omethodcolon; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2407 methodlen += 1; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2408 GROW_LINEBUFFER (token_name, methodlen+1); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2409 strcat (token_name.buffer, ":"); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2410 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2411 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2412 if (structdef == stagseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2413 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
|
2414 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
|
2415 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
|
2416 { |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2417 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
|
2418 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
|
2419 { |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2420 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
|
2421 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
|
2422 } |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2423 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
|
2424 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
|
2425 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
|
2426 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
|
2427 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2428 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2429 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
|
2430 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
|
2431 break; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2432 if (cblev == 0) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2433 switch (typdef) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2434 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2435 case tend: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2436 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2437 /* FALLTHRU */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2438 default: |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2439 typdef = tnone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2440 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2441 if (funcdef != fignore) |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2442 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2443 funcdef = fnone; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2444 /* The following instruction invalidates the token. |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2445 Probably the token should be invalidated in all |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2446 other cases where some state machine is reset. */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2447 tok.valid = FALSE; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2448 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2449 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2450 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2451 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2452 case ',': |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2453 if (definedef != dnone) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2454 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2455 switch (objdef) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2456 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2457 case omethodtag: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2458 case omethodparm: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2459 make_tag (TRUE); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2460 objdef = oinbody; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2461 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2462 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2463 if (funcdef != finlist && funcdef != fignore) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2464 funcdef = fnone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2465 if (structdef == stagseen) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2466 structdef = snone; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2467 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2468 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
|
2469 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
|
2470 break; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2471 if (cblev == 0 && typdef == tend) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2472 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2473 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2474 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2475 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2476 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2477 if (funcdef != finlist && funcdef != fignore) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2478 funcdef = fnone; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2479 if (structdef == stagseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2480 structdef = snone; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2481 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2482 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
|
2483 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
|
2484 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2485 if (objdef == otagseen && parlev == 0) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2486 objdef = oparenseen; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2487 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
|
2488 { |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2489 case fnone: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2490 switch (typdef) |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2491 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2492 case ttypedseen: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2493 case tend: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2494 /* 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
|
2495 This handles constructs like: |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2496 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
|
2497 if (*lp != '*') |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2498 { |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2499 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2500 make_tag (FALSE); |
9193
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2501 } |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2502 break; |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2503 } /* switch (typdef) */ |
86fd33a4f327
* etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents:
8789
diff
changeset
|
2504 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2505 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
|
2506 funcdef = fstartlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2507 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2508 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
|
2509 funcdef = finlist; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2510 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
|
2511 } |
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
|
2512 parlev++; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2513 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2514 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
|
2515 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
|
2516 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2517 if (objdef == ocatseen && parlev == 1) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2518 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2519 make_tag (TRUE); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2520 objdef = oignore; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2521 } |
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
|
2522 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
|
2523 { |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2524 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
|
2525 { |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2526 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
|
2527 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
|
2528 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
|
2529 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
|
2530 } |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2531 if (cblev == 0 && typdef == tend) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2532 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2533 typdef = tignore; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2534 make_tag (FALSE); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2535 } |
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
|
2536 } |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2537 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
|
2538 parlev = 0; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2539 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2540 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
|
2541 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
|
2542 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2543 if (typdef == ttypedseen) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2544 typdef = tinbody; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2545 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
|
2546 { |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2547 case skeyseen: /* unnamed struct */ |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2548 structtag = "_anonymous_"; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2549 structdef = sinbody; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2550 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2551 case stagseen: |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2552 case scolonseen: /* named struct */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2553 structdef = sinbody; |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2554 make_tag (FALSE); |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2555 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
|
2556 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2557 switch (funcdef) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2558 { |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2559 case flistseen: |
10754
cd1c0b5e8634
* etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents:
10623
diff
changeset
|
2560 make_tag (TRUE); |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2561 /* FALLTHRU */ |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2562 case fignore: |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2563 funcdef = fnone; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2564 break; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
2565 case fnone: |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2566 switch (objdef) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2567 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2568 case otagseen: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2569 make_tag (TRUE); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2570 objdef = oignore; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2571 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2572 case omethodtag: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2573 case omethodparm: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2574 make_tag (TRUE); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2575 objdef = oinbody; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2576 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2577 default: |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2578 /* Neutralize `extern "C" {' grot and look inside structs. */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2579 if (cblev == 0 && structdef == snone && typdef == tnone) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2580 cblev = -1; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2581 } |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2582 } |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2583 cblev++; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
2584 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2585 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
|
2586 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
|
2587 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
|
2588 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
|
2589 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
|
2590 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2591 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
|
2592 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
|
2593 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2594 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
|
2595 { |
50db67ef8d64
Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents:
4905
diff
changeset
|
2596 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
|
2597 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
|
2598 } |
4051
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2599 else if (cblev > 0) |
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2600 cblev--; |
73aa16fc728d
(consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents:
3921
diff
changeset
|
2601 if (cblev == 0) |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2602 { |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2603 if (typdef == tinbody) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2604 typdef = tend; |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2605 /* Memory leakage here: the string pointed by structtag is |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2606 never released, because I fear to miss something and |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2607 break things while freeing the area. The amount of |
14021
19bab04cf346
(substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents:
13696
diff
changeset
|
2608 memory leaked here is the sum of the lengths of the |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2609 struct tags. |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2610 if (structdef == sinbody) |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
2611 free (structtag); */ |
10761
7aa80669e697
* etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents:
10754
diff
changeset
|
2612 |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2613 structdef = snone; |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2614 structtag = "<error>"; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2615 } |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2616 break; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2617 case '+': |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2618 case '-': |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2619 if (objdef == oinbody && cblev == 0) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2620 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2621 objdef = omethodsign; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2622 break; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2623 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2624 /* FALLTHRU */ |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2625 case '=': case '#': case '~': case '&': case '%': case '/': |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
2626 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
|
2627 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
|
2628 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
|
2629 /* 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
|
2630 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
|
2631 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
|
2632 break; |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2633 case '\0': |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2634 if (objdef == otagseen) |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2635 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2636 make_tag (TRUE); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2637 objdef = oignore; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2638 } |
2323
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2639 /* 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
|
2640 if (quotednl) |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2641 CNL_SAVE_DEFINEDEF; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2642 else |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2643 CNL; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2644 break; |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2645 } /* switch (c) */ |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2646 |
626d9ac52bc9
(YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents:
2004
diff
changeset
|
2647 } /* while not eof */ |
240 | 2648 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2649 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2650 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2651 * 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
|
2652 * 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
|
2653 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2654 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2655 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
|
2656 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2657 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2658 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
|
2659 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2660 |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2661 /* Always do plain ANSI C. */ |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2662 void |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2663 plain_C_entries (inf) |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2664 FILE *inf; |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2665 { |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2666 C_entries (0, inf); |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2667 } |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2668 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2669 /* 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
|
2670 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2671 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
|
2672 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2673 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2674 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
|
2675 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2676 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2677 /* 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
|
2678 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2679 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
|
2680 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2681 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2682 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
|
2683 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2684 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2685 /* 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
|
2686 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2687 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
|
2688 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2689 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2690 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
|
2691 } |
240 | 2692 |
2693 /* Fortran parsing */ | |
2694 | |
2695 char *dbp; | |
2696 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2697 logical |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2698 tail (cp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2699 char *cp; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2700 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2701 register int len = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2702 |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2703 while (*cp && lowcase(*cp) == lowcase(dbp[len])) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2704 cp++, len++; |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2705 if (*cp == '\0' && !intoken(dbp[len])) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2706 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2707 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
|
2708 return TRUE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2709 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2710 return FALSE; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2711 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2712 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2713 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2714 takeprec () |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2715 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2716 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2717 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2718 if (*dbp != '*') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2719 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2720 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2721 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2722 dbp++; |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2723 if (strneq (dbp, "(*)", 3)) |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2724 { |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2725 dbp += 3; |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2726 return; |
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2727 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2728 if (!isdigit (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2729 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2730 --dbp; /* force failure */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2731 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2732 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2733 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2734 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2735 while (isdigit (*dbp)); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2736 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2737 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2738 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2739 getit (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2740 FILE *inf; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2741 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2742 register char *cp; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2743 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2744 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2745 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2746 if (*dbp == '\0') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2747 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2748 lineno++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2749 linecharno = charno; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2750 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2751 dbp = lb.buffer; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2752 if (dbp[5] != '&') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2753 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2754 dbp += 6; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2755 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2756 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2757 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2758 if (!isalpha (*dbp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2759 && *dbp != '_' |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2760 && *dbp != '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2761 return; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2762 for (cp = dbp + 1; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2763 (*cp |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2764 && (isalpha (*cp) || isdigit (*cp) || (*cp == '_') || (*cp == '$'))); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2765 cp++) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2766 continue; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2767 pfnote ((CTAGS) ? savenstr (dbp, cp-dbp) : NULL, TRUE, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2768 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
|
2769 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2770 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2771 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2772 Fortran_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2773 FILE *inf; |
240 | 2774 { |
2775 lineno = 0; | |
2776 charno = 0; | |
2777 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2778 while (!feof (inf)) |
240 | 2779 { |
2780 lineno++; | |
2781 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2782 charno += readline (&lb, inf); |
240 | 2783 dbp = lb.buffer; |
2784 if (*dbp == '%') | |
2785 dbp++; /* Ratfor escape to fortran */ | |
2786 while (isspace (*dbp)) | |
2787 dbp++; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2788 if (*dbp == '\0') |
240 | 2789 continue; |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2790 switch (lowcase (*dbp)) |
240 | 2791 { |
2792 case 'i': | |
2793 if (tail ("integer")) | |
2794 takeprec (); | |
2795 break; | |
2796 case 'r': | |
2797 if (tail ("real")) | |
2798 takeprec (); | |
2799 break; | |
2800 case 'l': | |
2801 if (tail ("logical")) | |
2802 takeprec (); | |
2803 break; | |
2804 case 'c': | |
2805 if (tail ("complex") || tail ("character")) | |
2806 takeprec (); | |
2807 break; | |
2808 case 'd': | |
2809 if (tail ("double")) | |
2810 { | |
2811 while (isspace (*dbp)) | |
2812 dbp++; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2813 if (*dbp == '\0') |
240 | 2814 continue; |
2815 if (tail ("precision")) | |
2816 break; | |
2817 continue; | |
2818 } | |
2819 break; | |
2820 } | |
2821 while (isspace (*dbp)) | |
2822 dbp++; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2823 if (*dbp == '\0') |
240 | 2824 continue; |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
2825 switch (lowcase (*dbp)) |
240 | 2826 { |
2827 case 'f': | |
2828 if (tail ("function")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2829 getit (inf); |
240 | 2830 continue; |
2831 case 's': | |
2832 if (tail ("subroutine")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2833 getit (inf); |
240 | 2834 continue; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2835 case 'e': |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2836 if (tail ("entry")) |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2837 getit (inf); |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
2838 continue; |
240 | 2839 case 'p': |
2840 if (tail ("program")) | |
2841 { | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2842 getit (inf); |
240 | 2843 continue; |
2844 } | |
2845 if (tail ("procedure")) | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2846 getit (inf); |
240 | 2847 continue; |
2848 } | |
2849 } | |
2850 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2851 |
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 * 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
|
2854 * Unix and microcontroller assembly tag handling |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2855 * 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
|
2856 */ |
240 | 2857 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2858 Asm_labels (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2859 FILE *inf; |
240 | 2860 { |
2861 register char *cp; | |
2862 | |
2863 lineno = 0; | |
2864 charno = 0; | |
2865 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2866 while (!feof (inf)) |
240 | 2867 { |
2868 lineno++; | |
2869 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2870 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2871 cp = lb.buffer; |
240 | 2872 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2873 /* 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
|
2874 following identifier. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2875 if (isalpha (*cp) || *cp == '_' || *cp == '.' || *cp == '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2876 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2877 /* Read past label. */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2878 cp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2879 while (isalnum (*cp) || *cp == '_' || *cp == '.' || *cp == '$') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2880 cp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2881 if (*cp == ':' || isspace (*cp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2882 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2883 /* Found end of label, so copy it and add it to the table. */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2884 pfnote ((CTAGS) ? savenstr(lb.buffer, cp-lb.buffer) : NULL, TRUE, |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2885 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
|
2886 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2887 } |
240 | 2888 } |
2889 } | |
2890 | |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2891 /* |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2892 * Perl support by Bart Robinson <lomew@cs.utah.edu> |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2893 * Perl sub names: look for /^sub[ \t\n]+[^ \t\n{]+/ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2894 */ |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2895 void |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2896 Perl_functions (inf) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2897 FILE *inf; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2898 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2899 register char *cp; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2900 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2901 lineno = 0; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2902 charno = 0; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2903 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2904 while (!feof (inf)) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2905 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2906 lineno++; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2907 linecharno = charno; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2908 charno += readline (&lb, inf); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2909 cp = lb.buffer; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2910 |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2911 if (*cp++ == 's' && *cp++ == 'u' && *cp++ == 'b' && isspace(*cp++)) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2912 { |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2913 while (*cp && isspace(*cp)) |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2914 cp++; |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2915 while (*cp && ! isspace(*cp) && *cp != '{') |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2916 cp++; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2917 pfnote ((CTAGS) ? savenstr (lb.buffer, cp-lb.buffer) : NULL, TRUE, |
13404
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2918 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2919 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2920 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2921 } |
9d6c77b66cfb
* etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents:
13380
diff
changeset
|
2922 |
240 | 2923 /* Added by Mosur Mohan, 4/22/88 */ |
2924 /* Pascal parsing */ | |
2925 | |
2926 #define GET_NEW_LINE \ | |
2927 { \ | |
2928 linecharno = charno; lineno++; \ | |
2929 charno += 1 + readline (&lb, inf); \ | |
2930 dbp = lb.buffer; \ | |
2931 } | |
2932 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
2933 /* |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
2934 * 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
|
2935 * 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
|
2936 * "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
|
2937 * the tag is skipped. |
240 | 2938 */ |
2939 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2940 Pascal_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
2941 FILE *inf; |
240 | 2942 { |
2943 struct linebuffer tline; /* mostly copied from C_entries */ | |
2944 long save_lcno; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2945 int save_lineno, save_len; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
2946 char c, *cp, *namebuf; |
240 | 2947 |
2948 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
|
2949 incomment, /* point is inside a comment */ |
240 | 2950 inquote, /* point is inside '..' string */ |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2951 get_tagname, /* point is after PROCEDURE/FUNCTION |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2952 keyword, so next item = potential tag */ |
240 | 2953 found_tag, /* point is after a potential tag */ |
2954 inparms, /* point is within parameter-list */ | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2955 verify_tag; /* point has passed the parm-list, so the |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2956 next token will determine whether this |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2957 is a FORWARD/EXTERN to be ignored, or |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2958 whether it is a real tag */ |
240 | 2959 |
2960 lineno = 0; | |
2961 charno = 0; | |
2962 dbp = lb.buffer; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2963 *dbp = '\0'; |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2964 save_len = 0; |
240 | 2965 initbuffer (&tline); |
2966 | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2967 incomment = inquote = FALSE; |
240 | 2968 found_tag = FALSE; /* have a proc name; check if extern */ |
2969 get_tagname = FALSE; /* have found "procedure" keyword */ | |
2970 inparms = FALSE; /* found '(' after "proc" */ | |
2971 verify_tag = FALSE; /* check if "extern" is ahead */ | |
2972 | |
2973 /* 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
|
2974 while (!feof (inf)) |
240 | 2975 { |
2976 c = *dbp++; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2977 if (c == '\0') /* if end of line */ |
240 | 2978 { |
2979 GET_NEW_LINE; | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
2980 if (*dbp == '\0') |
240 | 2981 continue; |
2982 if (!((found_tag && verify_tag) || | |
2983 get_tagname)) | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2984 c = *dbp++; /* only if don't need *dbp pointing |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2985 to the beginning of the name of |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2986 the procedure or function */ |
240 | 2987 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2988 if (incomment) |
240 | 2989 { |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2990 if (c == '}') /* within { } comments */ |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2991 incomment = FALSE; |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
2992 else if (c == '*' && *dbp == ')') /* within (* *) comments */ |
240 | 2993 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2994 dbp++; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
2995 incomment = FALSE; |
240 | 2996 } |
2997 continue; | |
2998 } | |
2999 else if (inquote) | |
3000 { | |
3001 if (c == '\'') | |
3002 inquote = FALSE; | |
3003 continue; | |
3004 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3005 else |
240 | 3006 switch (c) |
3007 { | |
3008 case '\'': | |
3009 inquote = TRUE; /* found first quote */ | |
3010 continue; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3011 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
|
3012 incomment = TRUE; |
240 | 3013 continue; |
3014 case '(': | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3015 if (*dbp == '*') /* found open (* comment */ |
240 | 3016 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3017 incomment = TRUE; |
240 | 3018 dbp++; |
3019 } | |
3020 else if (found_tag) /* found '(' after tag, i.e., parm-list */ | |
3021 inparms = TRUE; | |
3022 continue; | |
3023 case ')': /* end of parms list */ | |
3024 if (inparms) | |
3025 inparms = FALSE; | |
3026 continue; | |
3027 case ';': | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3028 if (found_tag && !inparms) /* end of proc or fn stmt */ |
240 | 3029 { |
3030 verify_tag = TRUE; | |
3031 break; | |
3032 } | |
3033 continue; | |
3034 } | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3035 if (found_tag && verify_tag && (*dbp != ' ')) |
240 | 3036 { |
3037 /* check if this is an "extern" declaration */ | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3038 if (*dbp == '\0') |
240 | 3039 continue; |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3040 if (lowcase (*dbp == 'e')) |
240 | 3041 { |
3042 if (tail ("extern")) /* superfluous, really! */ | |
3043 { | |
3044 found_tag = FALSE; | |
3045 verify_tag = FALSE; | |
3046 } | |
3047 } | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3048 else if (lowcase (*dbp) == 'f') |
240 | 3049 { |
3050 if (tail ("forward")) /* check for forward reference */ | |
3051 { | |
3052 found_tag = FALSE; | |
3053 verify_tag = FALSE; | |
3054 } | |
3055 } | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3056 if (found_tag && verify_tag) /* not external proc, so make tag */ |
240 | 3057 { |
3058 found_tag = FALSE; | |
3059 verify_tag = FALSE; | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3060 pfnote (namebuf, TRUE, |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3061 tline.buffer, save_len, save_lineno, save_lcno); |
240 | 3062 continue; |
3063 } | |
3064 } | |
3065 if (get_tagname) /* grab name of proc or fn */ | |
3066 { | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3067 if (*dbp == '\0') |
240 | 3068 continue; |
3069 | |
3070 /* save all values for later tagging */ | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3071 GROW_LINEBUFFER (tline, strlen (lb.buffer) + 1); |
240 | 3072 strcpy (tline.buffer, lb.buffer); |
3073 save_lineno = lineno; | |
3074 save_lcno = linecharno; | |
3075 | |
3076 /* grab block name */ | |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3077 for (cp = dbp + 1; *cp && (!endtoken (*cp)); cp++) |
240 | 3078 continue; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3079 namebuf = (CTAGS) ? savenstr (dbp, cp-dbp) : NULL; |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3080 dbp = cp; /* set dbp to e-o-token */ |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3081 save_len = dbp - lb.buffer + 1; |
240 | 3082 get_tagname = FALSE; |
3083 found_tag = TRUE; | |
3084 continue; | |
3085 | |
3086 /* and proceed to check for "extern" */ | |
3087 } | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3088 else if (!incomment && !inquote && !found_tag) |
240 | 3089 { |
3090 /* check for proc/fn keywords */ | |
12398
ccfd646cfad9
* etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents:
12344
diff
changeset
|
3091 switch (lowcase (c)) |
240 | 3092 { |
3093 case 'p': | |
3094 if (tail ("rocedure")) /* c = 'p', dbp has advanced */ | |
3095 get_tagname = TRUE; | |
3096 continue; | |
3097 case 'f': | |
3098 if (tail ("unction")) | |
3099 get_tagname = TRUE; | |
3100 continue; | |
3101 } | |
3102 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3103 } /* while not eof */ |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
3104 |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3105 free (tline.buffer); |
240 | 3106 } |
3107 | |
3108 /* | |
3109 * lisp tag functions | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3110 * look for (def or (DEF, quote or QUOTE |
240 | 3111 */ |
3112 int | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3113 L_isdef (strp) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3114 register char *strp; |
240 | 3115 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3116 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
|
3117 && (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
|
3118 && (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
|
3119 } |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3120 |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3121 int |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3122 L_isquote (strp) |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3123 register char *strp; |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3124 { |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3125 return ((*(++strp) == 'q' || *strp == 'Q') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3126 && (*(++strp) == 'u' || *strp == 'U') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3127 && (*(++strp) == 'o' || *strp == 'O') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3128 && (*(++strp) == 't' || *strp == 'T') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3129 && (*(++strp) == 'e' || *strp == 'E') |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3130 && isspace(*(++strp))); |
240 | 3131 } |
3132 | |
3133 void | |
3134 L_getit () | |
3135 { | |
3136 register char *cp; | |
3137 | |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3138 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
|
3139 dbp++; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3140 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
|
3141 { |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3142 dbp += 7; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3143 while (isspace(*dbp)) |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3144 dbp++; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3145 } |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3146 for (cp = dbp /*+1*/; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3147 *cp && *cp != '(' && *cp != ' ' && *cp != ')'; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3148 cp++) |
4663
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3149 continue; |
5f0ff5c890a8
* etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents:
4406
diff
changeset
|
3150 if (cp == dbp) |
240 | 3151 return; |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
3152 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3153 pfnote ((CTAGS) ? savenstr (dbp, cp-dbp) : NULL, TRUE, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3154 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
240 | 3155 } |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3156 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3157 void |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3158 Lisp_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3159 FILE *inf; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3160 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3161 lineno = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3162 charno = 0; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3163 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3164 while (!feof (inf)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3165 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3166 lineno++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3167 linecharno = charno; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3168 charno += readline (&lb, inf); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3169 dbp = lb.buffer; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3170 if (dbp[0] == '(') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3171 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3172 if (L_isdef (dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3173 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3174 while (!isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3175 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3176 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3177 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3178 L_getit (); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3179 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3180 else |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3181 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3182 /* Check for (foo::defmumble name-defined ... */ |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3183 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3184 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3185 while (*dbp && !isspace (*dbp) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3186 && *dbp != ':' && *dbp != '(' && *dbp != ')'); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3187 if (*dbp == ':') |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3188 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3189 do |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3190 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3191 while (*dbp == ':'); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3192 |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3193 if (L_isdef (dbp - 1)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3194 { |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3195 while (!isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3196 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3197 while (isspace (*dbp)) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3198 dbp++; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3199 L_getit (); |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3200 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3201 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3202 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3203 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3204 } |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3205 } |
240 | 3206 |
3207 /* | |
3208 * Scheme tag functions | |
3209 * look for (def... xyzzy | |
3210 * look for (def... (xyzzy | |
3211 * look for (def ... ((...(xyzzy .... | |
3212 * look for (set! xyzzy | |
3213 */ | |
3214 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3215 void get_scheme (); |
240 | 3216 |
3217 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3218 Scheme_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3219 FILE *inf; |
240 | 3220 { |
3221 lineno = 0; | |
3222 charno = 0; | |
3223 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3224 while (!feof (inf)) |
240 | 3225 { |
3226 lineno++; | |
3227 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3228 charno += readline (&lb, inf); |
240 | 3229 dbp = lb.buffer; |
3230 if (dbp[0] == '(' && | |
3231 (dbp[1] == 'D' || dbp[1] == 'd') && | |
3232 (dbp[2] == 'E' || dbp[2] == 'e') && | |
3233 (dbp[3] == 'F' || dbp[3] == 'f')) | |
3234 { | |
3235 while (!isspace (*dbp)) | |
3236 dbp++; | |
3237 /* Skip over open parens and white space */ | |
3238 while (*dbp && (isspace (*dbp) || *dbp == '(')) | |
3239 dbp++; | |
3240 get_scheme (); | |
3241 } | |
3242 if (dbp[0] == '(' && | |
3243 (dbp[1] == 'S' || dbp[1] == 's') && | |
3244 (dbp[2] == 'E' || dbp[2] == 'e') && | |
3245 (dbp[3] == 'T' || dbp[3] == 't') && | |
3246 (dbp[4] == '!' || dbp[4] == '!') && | |
3247 (isspace (dbp[5]))) | |
3248 { | |
3249 while (!isspace (*dbp)) | |
3250 dbp++; | |
3251 /* Skip over white space */ | |
3252 while (isspace (*dbp)) | |
3253 dbp++; | |
3254 get_scheme (); | |
3255 } | |
3256 } | |
3257 } | |
3258 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3259 void |
240 | 3260 get_scheme () |
3261 { | |
3262 register char *cp; | |
3263 | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3264 if (*dbp == '\0') |
240 | 3265 return; |
3266 /* 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
|
3267 for (cp = dbp + 1; |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3268 *cp && *cp != '(' && *cp != ')' && !isspace (*cp); |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
3269 cp++) |
240 | 3270 continue; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3271 pfnote ((CTAGS) ? savenstr (dbp, cp-dbp) : NULL, TRUE, |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
3272 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
240 | 3273 } |
3274 | |
3275 /* Find tags in TeX and LaTeX input files. */ | |
3276 | |
3277 /* TEX_toktab is a table of TeX control sequences that define tags. | |
3278 Each TEX_tabent records one such control sequence. | |
3279 CONVERT THIS TO USE THE Stab TYPE!! */ | |
3280 struct TEX_tabent | |
3281 { | |
3282 char *name; | |
3283 int len; | |
3284 }; | |
3285 | |
3286 struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */ | |
3287 | |
3288 /* Default set of control sequences to put into TEX_toktab. | |
3289 The value of environment var TEXTAGS is prepended to this. */ | |
3290 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3291 char *TEX_defenv = "\ |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
3292 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ |
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
3293 :part:appendix:entry:index"; |
240 | 3294 |
3295 void TEX_mode (); | |
3296 struct TEX_tabent *TEX_decode_env (); | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3297 int TEX_Token (); |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3298 #if TeX_named_tokens |
240 | 3299 void TEX_getit (); |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3300 #endif |
240 | 3301 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3302 char TEX_esc = '\\'; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3303 char TEX_opgrp = '{'; |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3304 char TEX_clgrp = '}'; |
240 | 3305 |
3306 /* | |
3307 * TeX/LaTeX scanning loop. | |
3308 */ | |
3309 void | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3310 TeX_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3311 FILE *inf; |
240 | 3312 { |
3313 char *lasthit; | |
3314 | |
3315 lineno = 0; | |
3316 charno = 0; | |
3317 | |
3318 /* 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
|
3319 TEX_mode (inf); |
240 | 3320 |
3321 /* Initialize token table once from environment. */ | |
3322 if (!TEX_toktab) | |
3323 TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv); | |
3324 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3325 while (!feof (inf)) |
1040 | 3326 { /* Scan each line in file */ |
240 | 3327 lineno++; |
3328 linecharno = charno; | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3329 charno += readline (&lb, inf); |
240 | 3330 dbp = lb.buffer; |
3331 lasthit = dbp; | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3332 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
|
3333 { |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3334 register int i; |
240 | 3335 |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3336 if (!*(++dbp)) |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3337 break; |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3338 linecharno += dbp - lasthit; |
240 | 3339 lasthit = dbp; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3340 i = TEX_Token (lasthit); |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3341 if (0 <= i) |
240 | 3342 { |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3343 pfnote (NULL, TRUE, |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3344 lb.buffer, strlen (lb.buffer), lineno, linecharno); |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3345 #if TeX_named_tokens |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3346 TEX_getit (lasthit, TEX_toktab[i].len); |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3347 #endif |
1040 | 3348 break; /* We only save a line once */ |
240 | 3349 } |
3350 } | |
3351 } | |
3352 } | |
3353 | |
3354 #define TEX_LESC '\\' | |
3355 #define TEX_SESC '!' | |
3356 #define TEX_cmt '%' | |
3357 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3358 /* 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
|
3359 chars accordingly. */ |
240 | 3360 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3361 TEX_mode (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3362 FILE *inf; |
240 | 3363 { |
3364 int c; | |
3365 | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3366 while ((c = getc (inf)) != EOF) |
240 | 3367 { |
3368 /* Skip to next line if we hit the TeX comment char. */ | |
3369 if (c == TEX_cmt) | |
3370 while (c != '\n') | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3371 c = getc (inf); |
240 | 3372 else if (c == TEX_LESC || c == TEX_SESC ) |
3373 break; | |
3374 } | |
3375 | |
3376 if (c == TEX_LESC) | |
3377 { | |
3378 TEX_esc = TEX_LESC; | |
3379 TEX_opgrp = '{'; | |
3380 TEX_clgrp = '}'; | |
3381 } | |
3382 else | |
3383 { | |
3384 TEX_esc = TEX_SESC; | |
3385 TEX_opgrp = '<'; | |
3386 TEX_clgrp = '>'; | |
3387 } | |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3388 rewind (inf); |
240 | 3389 } |
3390 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3391 /* 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
|
3392 Build token table. */ |
240 | 3393 struct TEX_tabent * |
3394 TEX_decode_env (evarname, defenv) | |
3395 char *evarname; | |
3396 char *defenv; | |
3397 { | |
3398 register char *env, *p; | |
3399 | |
3400 struct TEX_tabent *tab; | |
3401 int size, i; | |
3402 | |
3403 /* Append default string to environment. */ | |
3404 env = getenv (evarname); | |
3405 if (!env) | |
3406 env = defenv; | |
3407 else | |
3408 env = concat (env, defenv, ""); | |
3409 | |
3410 /* Allocate a token table */ | |
3411 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
|
3412 if ((p = etags_strchr (p, ':')) && *(++p)) |
240 | 3413 size++; |
1026
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3414 /* Add 1 to leave room for null terminator. */ |
cc96e2df9b71
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
774
diff
changeset
|
3415 tab = xnew (size + 1, struct TEX_tabent); |
240 | 3416 |
3417 /* Unpack environment string into token table. Be careful about */ | |
3418 /* zero-length strings (leading ':', "::" and trailing ':') */ | |
3419 for (i = 0; *env;) | |
3420 { | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
3421 p = etags_strchr (env, ':'); |
240 | 3422 if (!p) /* End of environment string. */ |
3423 p = env + strlen (env); | |
3424 if (p - env > 0) | |
3425 { /* Only non-zero strings. */ | |
3426 tab[i].name = savenstr (env, p - env); | |
3427 tab[i].len = strlen (tab[i].name); | |
3428 i++; | |
3429 } | |
3430 if (*p) | |
3431 env = p + 1; | |
3432 else | |
3433 { | |
3434 tab[i].name = NULL; /* Mark end of table. */ | |
3435 tab[i].len = 0; | |
3436 break; | |
3437 } | |
3438 } | |
3439 return tab; | |
3440 } | |
3441 | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3442 #if TeX_named_tokens |
240 | 3443 /* Record a tag defined by a TeX command of length LEN and starting at NAME. |
3444 The name being defined actually starts at (NAME + LEN + 1). | |
3445 But we seem to include the TeX command in the tag name. */ | |
3446 void | |
3447 TEX_getit (name, len) | |
3448 char *name; | |
3449 int len; | |
3450 { | |
3451 char *p = name + len; | |
3452 | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3453 if (*name == '\0') |
240 | 3454 return; |
3455 | |
3456 /* Let tag name extend to next group close (or end of line) */ | |
3457 while (*p && *p != TEX_clgrp) | |
3458 p++; | |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3459 pfnote (savenstr (name, p-name), TRUE, |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3460 lb.buffer, strlen (lb.buffer), lineno, linecharno); |
240 | 3461 } |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
3462 #endif |
240 | 3463 |
3464 /* 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
|
3465 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
|
3466 Otherwise return -1. |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
3467 Keep the capital `T' in `Token' for dumb truncating compilers |
240 | 3468 (this distinguishes it from `TEX_toktab' */ |
3469 int | |
3470 TEX_Token (cp) | |
3471 char *cp; | |
3472 { | |
3473 int i; | |
3474 | |
3475 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
|
3476 if (strneq (TEX_toktab[i].name, cp, TEX_toktab[i].len)) |
240 | 3477 return i; |
3478 return -1; | |
3479 } | |
3480 | |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3481 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3482 * Prolog support (rewritten) by Anders Lindgren, Mar. 96 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3483 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3484 * Assumes that the predicate starts at column 0. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3485 * Only the first clause of a predicate is added. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3486 */ |
240 | 3487 void |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3488 Prolog_functions (inf) |
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3489 FILE *inf; |
240 | 3490 { |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3491 int prolog_pred (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3492 void prolog_skip_comment (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3493 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3494 char * last; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3495 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3496 int allocated; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3497 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3498 allocated = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3499 len = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3500 last = NULL; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3501 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3502 lineno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3503 linecharno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3504 charno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3505 |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3506 while (!feof (inf)) |
240 | 3507 { |
3508 lineno++; | |
3509 linecharno += charno; | |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3510 charno = readline (&lb, inf); |
240 | 3511 dbp = lb.buffer; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3512 if (dbp[0] == '\0') /* Empty line */ |
240 | 3513 continue; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3514 else if (isspace (dbp[0])) /* Not a predicate */ |
240 | 3515 continue; |
3516 else if (dbp[0] == '/' && dbp[1] == '*') /* comment. */ | |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3517 prolog_skip_comment (&lb, inf, &lineno, &linecharno); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3518 else if (len = prolog_pred (dbp, last)) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3519 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3520 /* Predicate. Store the function name so that we only |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3521 * generates a tag for the first clause. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3522 if (last == NULL) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3523 last = xnew(len + 1, char); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3524 else if (len + 1 > allocated) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3525 last = (char *) xrealloc(last, len + 1); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3526 allocated = len + 1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3527 strncpy (last, dbp, len); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3528 last[len] = '\0'; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3529 } |
240 | 3530 } |
3531 } | |
3532 | |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3533 |
240 | 3534 void |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3535 prolog_skip_comment (plb, inf) |
240 | 3536 struct linebuffer *plb; |
6756
8086a2590e2f
* etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents:
6592
diff
changeset
|
3537 FILE *inf; |
240 | 3538 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3539 char *cp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3540 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3541 do |
240 | 3542 { |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3543 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
|
3544 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
|
3545 return; |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3546 lineno++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3547 linecharno += readline (plb, inf); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3548 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3549 while (!feof(inf)); |
240 | 3550 } |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3551 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3552 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3553 * A predicate definition is added if it matches: |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3554 * <beginning of line><Prolog Atom><whitespace>( |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3555 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3556 * It is added to the tags database if it doesn't match the |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3557 * name of the previous clause header. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3558 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3559 * Return the size of the name of the predicate, or 0 if no header |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3560 * was found. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3561 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3562 int |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3563 prolog_pred (s, last) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3564 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3565 char *last; /* Name of last clause. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3566 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3567 int prolog_atom(); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3568 int prolog_white(); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3569 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3570 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3571 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3572 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3573 pos = prolog_atom(s, 0); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3574 if (pos < 1) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3575 return 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3576 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3577 len = pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3578 pos += prolog_white(s, pos); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3579 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3580 if ((s[pos] == '(') || (s[pos] == '.')) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3581 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3582 if (s[pos] == '(') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3583 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3584 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3585 /* Save only the first clause. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3586 if ((last == NULL) || |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3587 (len != strlen(last)) || |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3588 (strncmp(s, last, len) != 0)) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3589 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3590 pfnote ((CTAGS) ? savenstr (s, len) : NULL, TRUE, |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3591 s, pos, lineno, linecharno); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3592 return len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3593 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3594 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3595 return 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3596 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3597 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3598 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3599 * Consume a Prolog atom. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3600 * Return the number of bytes consumed, or -1 if there was an error. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3601 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3602 * A prolog atom, in this context, could be one of: |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3603 * - An alphanumeric sequence, starting with a lower case letter. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3604 * - A quoted arbitrary string. Single quotes can escape themselves. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3605 * Backslash quotes everything. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3606 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3607 int |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3608 prolog_atom (s, pos) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3609 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3610 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3611 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3612 int origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3613 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3614 origpos = pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3615 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3616 if (islower(s[pos]) || (s[pos] == '_')) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3617 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3618 /* The atom is unquoted. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3619 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3620 while (isalnum(s[pos]) || (s[pos] == '_')) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3621 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3622 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3623 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3624 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3625 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3626 else if (s[pos] == '\'') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3627 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3628 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3629 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3630 while (1) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3631 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3632 if (s[pos] == '\'') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3633 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3634 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3635 if (s[pos] != '\'') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3636 break; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3637 pos++; /* A double quote */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3638 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3639 else if (s[pos] == '\0') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3640 /* Multiline quoted atoms are ignored. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3641 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3642 else if (s[pos] == '\\') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3643 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3644 if (s[pos+1] == '\0') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3645 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3646 pos += 2; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3647 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3648 else |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3649 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3650 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3651 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3652 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3653 else |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3654 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3655 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3656 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3657 /* Consume whitespace. Return the number of bytes eaten. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3658 int |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3659 prolog_white (s, pos) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3660 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3661 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3662 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3663 int origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3664 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3665 origpos = pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3666 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3667 while (isspace(s[pos])) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3668 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3669 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3670 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3671 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3672 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3673 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3674 * Support for Erlang -- Anders Lindgren, Feb 1996. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3675 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3676 * Generates tags for functions, defines, and records. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3677 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3678 * Assumes that Erlang functions start at column 0. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3679 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3680 void |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3681 Erlang_functions (inf) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3682 FILE *inf; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3683 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3684 int erlang_func (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3685 void erlang_attribute (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3686 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3687 char * last; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3688 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3689 int allocated; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3690 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3691 allocated = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3692 len = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3693 last = NULL; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3694 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3695 lineno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3696 linecharno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3697 charno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3698 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3699 while (!feof (inf)) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3700 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3701 lineno++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3702 linecharno += charno; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3703 charno = readline (&lb, inf); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3704 dbp = lb.buffer; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3705 if (dbp[0] == '\0') /* Empty line */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3706 continue; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3707 else if (isspace (dbp[0])) /* Not function nor attribute */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3708 continue; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3709 else if (dbp[0] == '%') /* comment */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3710 continue; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3711 else if (dbp[0] == '"') /* Sometimes, strings start in column one */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3712 continue; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3713 else if (dbp[0] == '-') /* attribute, e.g. "-define" */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3714 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3715 erlang_attribute(dbp); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3716 last = NULL; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3717 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3718 else if (len = erlang_func (dbp, last)) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3719 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3720 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3721 * Function. Store the function name so that we only |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3722 * generates a tag for the first clause. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3723 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3724 if (last == NULL) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3725 last = xnew(len + 1, char); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3726 else if (len + 1 > allocated) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3727 last = (char *) xrealloc(last, len + 1); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3728 allocated = len + 1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3729 strncpy (last, dbp, len); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3730 last[len] = '\0'; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3731 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3732 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3733 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3734 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3735 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3736 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3737 * A function definition is added if it matches: |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3738 * <beginning of line><Erlang Atom><whitespace>( |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3739 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3740 * It is added to the tags database if it doesn't match the |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3741 * name of the previous clause header. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3742 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3743 * Return the size of the name of the function, or 0 if no function |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3744 * was found. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3745 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3746 int |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3747 erlang_func (s, last) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3748 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3749 char *last; /* Name of last clause. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3750 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3751 int erlang_atom (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3752 int erlang_white (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3753 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3754 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3755 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3756 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3757 pos = erlang_atom(s, 0); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3758 if (pos < 1) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3759 return 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3760 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3761 len = pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3762 pos += erlang_white(s, pos); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3763 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3764 if (s[pos++] == '(') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3765 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3766 /* Save only the first clause. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3767 if ((last == NULL) || |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3768 (len != strlen(last)) || |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3769 (strncmp(s, last, len) != 0)) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3770 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3771 pfnote ((CTAGS) ? savenstr (s, len) : NULL, TRUE, |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3772 s, pos, lineno, linecharno); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3773 return len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3774 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3775 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3776 return 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3777 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3778 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3779 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3780 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3781 * Handle attributes. Currently, tags are generated for defines |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3782 * and records. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3783 * |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3784 * They are on the form: |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3785 * -define(foo, bar). |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3786 * -define(Foo(M, N), M+N). |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3787 * -record(graph, {vtab = notable, cyclic = true}). |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3788 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3789 void |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3790 erlang_attribute (s) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3791 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3792 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3793 int erlang_atom (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3794 int erlang_white (); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3795 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3796 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3797 int len; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3798 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3799 if ((strncmp(s, "-define", 7) == 0) || |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3800 (strncmp(s, "-record", 7) == 0)) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3801 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3802 pos = 7; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3803 pos += erlang_white(s, pos); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3804 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3805 if (s[pos++] == '(') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3806 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3807 pos += erlang_white(s, pos); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3808 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3809 if (len = erlang_atom(s, pos)) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3810 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3811 pfnote ((CTAGS) ? savenstr (& s[pos], len) : NULL, TRUE, |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3812 s, pos + len, lineno, linecharno); |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3813 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3814 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3815 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3816 return; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3817 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3818 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3819 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3820 /* |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3821 * Consume an Erlang atom (or variable). |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3822 * Return the number of bytes consumed, or -1 if there was an error. |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3823 */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3824 int |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3825 erlang_atom (s, pos) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3826 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3827 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3828 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3829 int origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3830 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3831 origpos = pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3832 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3833 if (isalpha (s[pos]) || s[pos] == '_') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3834 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3835 /* The atom is unquoted. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3836 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3837 while (isalnum (s[pos]) || s[pos] == '_') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3838 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3839 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3840 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3841 else if (s[pos] == '\'') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3842 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3843 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3844 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3845 while (1) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3846 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3847 if (s[pos] == '\'') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3848 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3849 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3850 break; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3851 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3852 else if (s[pos] == '\0') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3853 /* Multiline quoted atoms are ignored. */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3854 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3855 else if (s[pos] == '\\') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3856 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3857 if (s[pos+1] == '\0') |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3858 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3859 pos += 2; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3860 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3861 else |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3862 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3863 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3864 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3865 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3866 else |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3867 return -1; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3868 } |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3869 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3870 /* Consume whitespace. Return the number of bytes eaten */ |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3871 int |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3872 erlang_white (s, pos) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3873 char *s; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3874 int pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3875 { |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3876 int origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3877 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3878 origpos = pos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3879 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3880 while (isspace (s[pos])) |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3881 pos++; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3882 |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3883 return pos - origpos; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
3884 } |
240 | 3885 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3886 #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
|
3887 /* 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
|
3888 that the first and last characters are the same, and handling |
14021
19bab04cf346
(substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents:
13696
diff
changeset
|
3889 quoted separator characters. Actually, stops on the occurrence of |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3890 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
|
3891 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
|
3892 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
|
3893 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3894 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
|
3895 char *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3896 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3897 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
|
3898 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
|
3899 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
|
3900 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3901 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
|
3902 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3903 if (quoted) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3904 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3905 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
|
3906 *copyto++ = '\t'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3907 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
|
3908 *copyto++ = sep; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3909 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3910 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3911 /* 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
|
3912 *copyto++ = '\\'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3913 *copyto++ = *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3914 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3915 quoted = FALSE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3916 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3917 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
|
3918 quoted = TRUE; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3919 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
|
3920 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3921 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3922 *copyto++ = *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3923 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3924 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3925 /* 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
|
3926 *copyto = '\0'; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3927 return name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3928 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3929 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3930 /* 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
|
3931 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
|
3932 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3933 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
|
3934 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
|
3935 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3936 char *name; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3937 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
|
3938 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
|
3939 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3940 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
|
3941 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3942 /* 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
|
3943 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
|
3944 patterns = NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3945 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3946 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3947 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3948 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
|
3949 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3950 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
|
3951 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3952 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3953 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
|
3954 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3955 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
|
3956 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3957 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3958 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
|
3959 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
|
3960 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3961 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
|
3962 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3963 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3964 (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
|
3965 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3966 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
|
3967 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
|
3968 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
|
3969 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
|
3970 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
|
3971 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3972 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
|
3973 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
|
3974 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3975 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
|
3976 return; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3977 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3978 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3979 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
|
3980 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
|
3981 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
|
3982 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3983 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
|
3984 xrealloc (patterns, |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3985 (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
|
3986 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
|
3987 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
|
3988 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
|
3989 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3990 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3991 /* |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
3992 * Do the substitutions indicated by the regular expression and |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3993 * arguments. |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3994 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3995 char * |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
3996 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
|
3997 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
|
3998 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
|
3999 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4000 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
|
4001 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
|
4002 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4003 /* 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
|
4004 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
|
4005 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4006 if (*t == '\\') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4007 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4008 ++t; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4009 if (!*t) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4010 { |
14021
19bab04cf346
(substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents:
13696
diff
changeset
|
4011 fprintf (stderr, "%s: pattern substitution ends prematurely\n", |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4012 progname); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4013 return NULL; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4014 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4015 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
|
4016 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4017 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
|
4018 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
|
4019 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4020 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4021 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4022 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4023 /* 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
|
4024 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
|
4025 size = 0; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4026 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
|
4027 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4028 if (*out == '\\') |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4029 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4030 ++out; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4031 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
|
4032 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4033 /* 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
|
4034 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
|
4035 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
|
4036 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
|
4037 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
|
4038 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4039 else |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
4040 result[size++] = *out; |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4041 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4042 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4043 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
|
4044 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4045 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
|
4046 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4047 return result; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4048 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4049 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4050 #endif /* ETAGS_REGEXPS */ |
240 | 4051 /* Initialize a linebuffer for use */ |
4052 void | |
4053 initbuffer (linebuffer) | |
4054 struct linebuffer *linebuffer; | |
4055 { | |
4056 linebuffer->size = 200; | |
4057 linebuffer->buffer = xnew (200, char); | |
4058 } | |
4059 | |
4060 /* | |
4061 * Read a line of text from `stream' into `linebuffer'. | |
4062 * Return the number of characters read from `stream', | |
4063 * which is the length of the line including the newline, if any. | |
4064 */ | |
4065 long | |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4066 readline_internal (linebuffer, stream) |
240 | 4067 struct linebuffer *linebuffer; |
4068 register FILE *stream; | |
4069 { | |
4070 char *buffer = linebuffer->buffer; | |
4071 register char *p = linebuffer->buffer; | |
4072 register char *pend; | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4073 int chars_deleted; |
240 | 4074 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3569
diff
changeset
|
4075 pend = p + linebuffer->size; /* Separate to avoid 386/IX compiler bug. */ |
240 | 4076 |
4077 while (1) | |
4078 { | |
4079 register int c = getc (stream); | |
4080 if (p == pend) | |
4081 { | |
4082 linebuffer->size *= 2; | |
4083 buffer = (char *) xrealloc (buffer, linebuffer->size); | |
4084 p += buffer - linebuffer->buffer; | |
4085 pend = buffer + linebuffer->size; | |
4086 linebuffer->buffer = buffer; | |
4087 } | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4088 if (c == EOF) |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4089 { |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
4090 *p = '\0'; |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4091 chars_deleted = 0; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4092 break; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4093 } |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4094 if (c == '\n') |
240 | 4095 { |
10990
c0ceaa45ded7
* etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents:
10801
diff
changeset
|
4096 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
|
4097 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4098 *--p = '\0'; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4099 chars_deleted = 2; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4100 } |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4101 else |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4102 { |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4103 *p = '\0'; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4104 chars_deleted = 1; |
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4105 } |
240 | 4106 break; |
4107 } | |
4108 *p++ = c; | |
4109 } | |
4110 | |
10376
b1c4515958b6
* etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents:
10355
diff
changeset
|
4111 return p - buffer + chars_deleted; |
240 | 4112 } |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4113 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4114 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4115 * 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
|
4116 * 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
|
4117 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4118 long |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4119 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
|
4120 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
|
4121 FILE *stream; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4122 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4123 /* Read new line. */ |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4124 long result = readline_internal (linebuffer, stream); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4125 #ifdef ETAGS_REGEXPS |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4126 int i; |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4127 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4128 /* 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
|
4129 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
|
4130 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4131 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
|
4132 (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
|
4133 switch (match) |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4134 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4135 case -2: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4136 /* Some error. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4137 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
|
4138 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4139 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
|
4140 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
|
4141 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4142 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4143 case -1: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4144 /* No match. */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4145 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4146 default: |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4147 /* 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
|
4148 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
|
4149 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4150 /* 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
|
4151 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
|
4152 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
|
4153 &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
|
4154 if (name != NULL) |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4155 pfnote (name, TRUE, |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4156 linebuffer->buffer, match, lineno, linecharno); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4157 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4158 else |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4159 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4160 /* Make an unnamed tag. */ |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4161 pfnote (NULL, TRUE, |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4162 linebuffer->buffer, match, lineno, linecharno); |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4163 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4164 break; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4165 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4166 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4167 #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
|
4168 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4169 return result; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4170 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4171 |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4172 /* |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4173 * 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
|
4174 * 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
|
4175 */ |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4176 void |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4177 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
|
4178 FILE *inf; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4179 { |
14859
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
4180 lineno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
4181 charno = 0; |
efa1bc6b7b17
* etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents:
14230
diff
changeset
|
4182 |
9976
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4183 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
|
4184 { |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4185 ++lineno; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4186 linecharno = charno; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4187 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
|
4188 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4189 } |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4190 |
240 | 4191 |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4192 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4193 * 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
|
4194 * 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
|
4195 */ |
240 | 4196 char * |
4197 savestr (cp) | |
4198 char *cp; | |
4199 { | |
4200 return savenstr (cp, strlen (cp)); | |
4201 } | |
4202 | |
10404
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4203 /* |
631f1dac6f7a
Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents:
10378
diff
changeset
|
4204 * 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
|
4205 * 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
|
4206 */ |
240 | 4207 char * |
4208 savenstr (cp, len) | |
4209 char *cp; | |
4210 int len; | |
4211 { | |
4212 register char *dp; | |
4213 | |
4214 dp = xnew (len + 1, char); | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
4215 strncpy (dp, cp, len); |
240 | 4216 dp[len] = '\0'; |
4217 return dp; | |
4218 } | |
4219 | |
4220 /* | |
4221 * Return the ptr in sp at which the character c last | |
4222 * appears; NULL if not found | |
4223 * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4224 * Identical to System V strrchr, included for portability. |
240 | 4225 */ |
4226 char * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4227 etags_strrchr (sp, c) |
240 | 4228 register char *sp, c; |
4229 { | |
4230 register char *r; | |
4231 | |
4232 r = NULL; | |
4233 do | |
4234 { | |
4235 if (*sp == c) | |
4236 r = sp; | |
4237 } 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
|
4238 return r; |
240 | 4239 } |
4240 | |
774 | 4241 |
240 | 4242 /* |
4243 * Return the ptr in sp at which the character c first | |
4244 * appears; NULL if not found | |
4245 * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4246 * Identical to System V strchr, included for portability. |
240 | 4247 */ |
4248 char * | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4249 etags_strchr (sp, c) |
240 | 4250 register char *sp, c; |
4251 { | |
4252 do | |
4253 { | |
4254 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
|
4255 return sp; |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4256 } while (*sp++); |
2869e501c2de
* etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents:
9975
diff
changeset
|
4257 return NULL; |
240 | 4258 } |
4259 | |
4260 /* Print error message and exit. */ | |
4261 void | |
4262 fatal (s1, s2) | |
4263 char *s1, *s2; | |
4264 { | |
4265 error (s1, s2); | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
4266 exit (BAD); |
240 | 4267 } |
4268 | |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4269 void |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4270 pfatal (s1) |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4271 char *s1; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4272 { |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4273 perror (s1); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4274 exit (BAD); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4275 } |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4276 |
13696
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4277 void |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4278 suggest_asking_for_help () |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4279 { |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4280 fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n", |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4281 progname); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4282 exit (BAD); |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4283 } |
f89aa5a5c485
* etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents:
13404
diff
changeset
|
4284 |
240 | 4285 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
4286 void | |
4287 error (s1, s2) | |
4288 char *s1, *s2; | |
4289 { | |
4290 fprintf (stderr, "%s: ", progname); | |
4291 fprintf (stderr, s1, s2); | |
4292 fprintf (stderr, "\n"); | |
4293 } | |
4294 | |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4295 /* Return a newly-allocated string whose contents |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4296 concatenate those of s1, s2, s3. */ |
240 | 4297 char * |
4298 concat (s1, s2, s3) | |
4299 char *s1, *s2, *s3; | |
4300 { | |
4301 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | |
4302 char *result = xnew (len1 + len2 + len3 + 1, char); | |
4303 | |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
4304 strcpy (result, s1); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
4305 strcpy (result + len1, s2); |
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
4306 strcpy (result + len1 + len2, s3); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4307 result[len1 + len2 + len3] = '\0'; |
240 | 4308 |
4309 return result; | |
4310 } | |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4311 |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4312 /* Does the same work as the system V getcwd, but does not need to |
13380
12bfc1ecec61
* etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents:
12879
diff
changeset
|
4313 guess the buffer size in advance. */ |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
4314 char * |
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
4315 etags_getcwd () |
11992
e550e0d13e83
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11990
diff
changeset
|
4316 { |
11990
1e5d25c997ca
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11957
diff
changeset
|
4317 #ifdef DOS_NT |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4318 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
|
4319 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4320 getwd (path); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4321 p = path; |
7227
6fa038c33a0f
[MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents:
7049
diff
changeset
|
4322 while (*p) |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4323 { |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4324 if (*p == '\\') |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4325 *p++ = '/'; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4326 else |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4327 *p++ = lowcase (*p); |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4328 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4329 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4330 return strdup (path); |
11992
e550e0d13e83
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11990
diff
changeset
|
4331 #else /* not DOS_NT */ |
e550e0d13e83
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11990
diff
changeset
|
4332 #if HAVE_GETCWD |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4333 int bufsize = 200; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4334 char *path = xnew (bufsize, char); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4335 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4336 while (getcwd (path, bufsize) == NULL) |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4337 { |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
4338 if (errno != ERANGE) |
11886
c5db1295f7df
* etags.c (etags_getcwd): Use /bin/pwd instead of pwd because the
Francesco Potortì <pot@gnu.org>
parents:
11673
diff
changeset
|
4339 pfatal ("getcwd"); |
9975
e21b0674f37c
* etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents:
9773
diff
changeset
|
4340 bufsize *= 2; |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4341 path = xnew (bufsize, char); |
8789
81a2817b99b2
(etags_getcwd): Use getcwd if available.
Karl Heuer <kwzh@gnu.org>
parents:
8180
diff
changeset
|
4342 } |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4343 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4344 return path; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4345 #else /* not DOS_NT and not HAVE_GETCWD */ |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4346 struct linebuffer path; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4347 FILE *pipe; |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4348 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4349 initbuffer (&path); |
11990
1e5d25c997ca
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11957
diff
changeset
|
4350 pipe = (FILE *) popen ("pwd 2>/dev/null", "r"); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4351 if (pipe == NULL || readline_internal (&path, pipe) == 0) |
11990
1e5d25c997ca
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11957
diff
changeset
|
4352 pfatal ("pwd"); |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4353 pclose (pipe); |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4354 |
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4355 return path.buffer; |
11992
e550e0d13e83
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11990
diff
changeset
|
4356 #endif /* not HAVE_GETCWD */ |
e550e0d13e83
* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents:
11990
diff
changeset
|
4357 #endif /* not DOS_NT */ |
10378
fb23ac6e6199
* etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents:
10376
diff
changeset
|
4358 } |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4359 |
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4360 /* 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
|
4361 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
|
4362 should end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4363 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4364 relative_filename (file, dir) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4365 char *file, *dir; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4366 { |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4367 char *fp, *dp, *abs, *res; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4368 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4369 /* Find the common root of file and dir. */ |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4370 abs = absolute_filename (file, cwd); |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4371 fp = abs; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4372 dp = dir; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4373 while (*fp++ == *dp++) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4374 continue; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4375 do |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4376 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4377 fp--; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4378 dp--; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4379 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4380 while (*fp != '/'); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4381 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4382 /* 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
|
4383 for (dp = etags_strchr (dp + 1, '/'), res = ""; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4384 dp != NULL; |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4385 dp = etags_strchr (dp + 1, '/')) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4386 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4387 res = concat (res, "../", ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4388 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4389 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4390 /* 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
|
4391 res = concat (res, fp + 1, ""); |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4392 free (abs); |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4393 |
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4394 return res; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4395 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4396 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4397 /* 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
|
4398 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
|
4399 end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4400 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4401 absolute_filename (file, cwd) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4402 char *file, *cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4403 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4404 char *slashp, *cp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4405 |
12344
7e7941d8cceb
* etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents:
12242
diff
changeset
|
4406 if (absolutefn (file)) |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4407 res = concat (file, "", ""); |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4408 #ifdef DOS_NT |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4409 /* We don't support non-absolute filenames with a drive |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4410 letter, like `d:NAME' (it's too much hassle). */ |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4411 else if (file[1] == ':') |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4412 fatal ("%s: relative filenames with drive letters not supported", file); |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4413 #endif |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4414 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4415 res = concat (cwd, file, ""); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4416 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4417 /* Delete the "/dirname/.." and "/." substrings. */ |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4418 slashp = etags_strchr (res, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4419 while (slashp != NULL && slashp[0] != '\0') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4420 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4421 if (slashp[1] == '.') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4422 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4423 if (slashp[2] == '.' |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4424 && (slashp[3] == '/' || slashp[3] == '\0')) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4425 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4426 cp = slashp; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4427 do |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4428 cp--; |
14924
67ec801831b8
(absolute_filename): Use absolutefn.
Richard M. Stallman <rms@gnu.org>
parents:
14920
diff
changeset
|
4429 while (cp >= res && !absolutefn (cp)); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4430 if (*cp == '/') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4431 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4432 strcpy (cp, slashp + 3); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4433 } |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4434 #ifdef DOS_NT |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4435 /* Under MSDOS and NT we get `d:/NAME' as absolute |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4436 filename, so the luser could say `d:/../NAME'. |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4437 We silently treat this as `d:/NAME'. */ |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4438 else if (cp[1] == ':') |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4439 strcpy (cp + 3, slashp + 4); |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4440 #endif |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4441 else /* else (cp == res) */ |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4442 { |
6944
daa29eabfc65
* etags.c (absolute_filename): compare against '\0' instead of NULL.
Francesco Potortì <pot@gnu.org>
parents:
6831
diff
changeset
|
4443 if (slashp[3] != '\0') |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4444 strcpy (cp, slashp + 4); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4445 else |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4446 return "."; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4447 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4448 slashp = cp; |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
4449 continue; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4450 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4451 else if (slashp[2] == '/' || slashp[2] == '\0') |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4452 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4453 strcpy (slashp, slashp + 2); |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
4454 continue; |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4455 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4456 } |
7776
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
4457 |
f91e2cf8770b
* etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents:
7775
diff
changeset
|
4458 slashp = etags_strchr (slashp + 1, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4459 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4460 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4461 return res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4462 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4463 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4464 /* 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
|
4465 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
|
4466 end with a slash). */ |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4467 char * |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4468 absolute_dirname (file, cwd) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4469 char *file, *cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4470 { |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4471 char *slashp, *res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4472 char save; |
14920
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4473 #ifdef DOS_NT |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4474 char *p = file; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4475 |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4476 while (*p) |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4477 { |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4478 if (*p == '\\') |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4479 *p = '/'; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4480 ++p; |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4481 } |
b909bb3e64c9
(absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents:
14859
diff
changeset
|
4482 #endif |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4483 |
6592
9a76406c9f98
* etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents:
6530
diff
changeset
|
4484 slashp = etags_strrchr (file, '/'); |
6482
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4485 if (slashp == NULL) |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4486 return cwd; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4487 save = slashp[1]; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4488 slashp[1] = '\0'; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4489 res = absolute_filename (file, cwd); |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4490 slashp[1] = save; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4491 |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4492 return res; |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4493 } |
91112dd5c9f5
* etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents:
5976
diff
changeset
|
4494 |
240 | 4495 /* Like malloc but get fatal error if memory is exhausted. */ |
11673
46d2178719ad
(C_entries): Cast result of xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
11231
diff
changeset
|
4496 long * |
240 | 4497 xmalloc (size) |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
4498 unsigned int size; |
240 | 4499 { |
11673
46d2178719ad
(C_entries): Cast result of xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
11231
diff
changeset
|
4500 long *result = (long *) malloc (size); |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
4501 if (result == NULL) |
240 | 4502 fatal ("virtual memory exhausted", 0); |
4503 return result; | |
4504 } | |
4505 | |
11673
46d2178719ad
(C_entries): Cast result of xrealloc.
Richard M. Stallman <rms@gnu.org>
parents:
11231
diff
changeset
|
4506 long * |
240 | 4507 xrealloc (ptr, size) |
4508 char *ptr; | |
5580
517d8eb361f8
* etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents:
5448
diff
changeset
|
4509 unsigned int size; |
240 | 4510 { |
12879
3b90cbba7dad
* etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents:
12398
diff
changeset
|
4511 long *result = (long *) realloc (ptr, size); |
5940
e663f6626075
* etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents:
5580
diff
changeset
|
4512 if (result == NULL) |
240 | 4513 fatal ("virtual memory exhausted"); |
4514 return result; | |
4515 } |