annotate lib-src/etags.c @ 26323:98d99afb5ffb

* etags.c (print_help): Change email address to send bugs to.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 03 Nov 1999 13:09:07 +0000
parents c416a18b0a5d
children f1ae5b57d9db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Tags file maker to go with GNU Emacs
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
2 Copyright (C) 1984, 87, 88, 89, 93, 94, 95, 98, 99
11231
3cf67df24e7f Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 10990
diff changeset
3 Free Software Foundation, Inc. and Ken Arnold
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14144
diff changeset
4
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
5 This file is not considered part of GNU Emacs.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
7 This program is free software; you can redistribute it and/or modify
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
9 the Free Software Foundation; either version 2 of the License, or
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
10 (at your option) any later version.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
2932
b68f975d505a Change permission notice (not "part of Emacs").
Richard M. Stallman <rms@gnu.org>
parents: 2911
diff changeset
12 This program is distributed in the hope that it will be useful,
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 GNU General Public License for more details.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14144
diff changeset
18 along with this program; if not, write to the Free Software Foundation,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14144
diff changeset
19 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 * Authors:
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 * Ctags originally by Ken Arnold.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
24 * Fortran added by Jim Kleckner.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 * Ed Pelegri-Llopart added C typedefs.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 * Gnu Emacs TAGS format and modifications by RMS?
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 */
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
33
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
34 char pot_etags_version[] = "@(#) pot revision number is 13.31";
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
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
39 #define _GNU_SOURCE /* enables some compiler checks on GNU */
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
40 #ifndef DEBUG
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
41 # define DEBUG FALSE
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
42 #endif
10754
cd1c0b5e8634 * etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents: 10623
diff changeset
43
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
44 #ifdef HAVE_CONFIG_H
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
45 # include <config.h>
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
46 /* On some systems, Emacs defines static as nothing for the sake
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
47 of unexec. We don't want that here since we don't use unexec. */
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
48 # undef static
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
49 # define ETAGS_REGEXPS /* use the regexp features */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
50 # define LONG_OPTIONS /* accept long options */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
51 #endif /* HAVE_CONFIG_H */
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
52
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
53 #ifdef MSDOS
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
54 # include <fcntl.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
55 # include <sys/param.h>
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
56 # include <io.h>
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
57 # ifndef HAVE_CONFIG_H
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
58 # define DOS_NT
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
59 # include <sys/config.h>
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
60 # endif
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
61 #endif /* MSDOS */
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
62
9773
bd49556a7552 (main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 9635
diff changeset
63 #ifdef WINDOWSNT
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
64 # include <stdlib.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
65 # include <fcntl.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
66 # include <string.h>
14982
b470e33ce4a9 [WINDOWSNT]: Include io.h.
Richard M. Stallman <rms@gnu.org>
parents: 14924
diff changeset
67 # 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
68 # define MAXPATHLEN _MAX_PATH
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
69 # ifdef HAVE_CONFIG_H
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
70 # undef HAVE_NTGUI
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
71 # else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
72 # define DOS_NT
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
73 # endif /* not HAVE_CONFIG_H */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
74 # ifndef HAVE_GETCWD
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
75 # define HAVE_GETCWD
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
76 # endif /* undef HAVE_GETCWD */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
77 #endif /* WINDOWSNT */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
78
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
79 #if !defined (WINDOWSNT) && defined (STDC_HEADERS)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
80 #include <stdlib.h>
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
81 #include <string.h>
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
82 #endif
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
83
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
84 #ifdef HAVE_UNISTD_H
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
85 # include <unistd.h>
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
86 #else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
87 # ifdef HAVE_GETCWD
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
88 extern char *getcwd ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
89 # endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
90 #endif /* HAVE_UNISTD_H */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
91
3921
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
92 #include <stdio.h>
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
93 #include <ctype.h>
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
94 #include <errno.h>
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
95 #ifndef errno
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
96 extern int errno;
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
97 #endif
3921
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
98 #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
99 #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
100
4804
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
101 #if !defined (S_ISREG) && defined (S_IFREG)
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
102 # 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
103 #endif
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
104
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
105 #ifdef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
106 # include <getopt.h>
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
107 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
108 # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
109 extern char *optarg;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
110 extern int optind, opterr;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
111 #endif /* LONG_OPTIONS */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
112
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
113 #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
114 # 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
115 #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
116
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
117 /* Define CTAGS to make the program "ctags" compatible with the usual one.
17168
53314a257690 * etags.c (add_regex): reset *putbuf before using it.
Francesco Potortì <pot@gnu.org>
parents: 16733
diff changeset
118 Leave it undefined to make the program "etags", which makes emacs-style
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
119 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
120 #ifdef CTAGS
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
121 # undef CTAGS
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
122 # define CTAGS TRUE
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
123 #else
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
124 # define CTAGS FALSE
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 #endif
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 /* Exit codes for success and failure. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 #ifdef VMS
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
129 # define GOOD 1
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
130 # define BAD 0
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 #else
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
132 # define GOOD 0
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
133 # define BAD 1
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 #endif
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
136 /* C extensions. */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
137 #define C_PLPL 0x00001 /* C++ */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
138 #define C_STAR 0x00003 /* C* */
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
139 #define C_JAVA 0x00005 /* JAVA */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
140 #define YACC 0x10000 /* yacc file */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141
16733
a8927c5085fe (streq, strneq): Use == NULL rather than !.
Richard M. Stallman <rms@gnu.org>
parents: 16607
diff changeset
142 #define streq(s,t) ((DEBUG && (s) == NULL && (t) == NULL \
a8927c5085fe (streq, strneq): Use == NULL rather than !.
Richard M. Stallman <rms@gnu.org>
parents: 16607
diff changeset
143 && (abort (), 1)) || !strcmp (s, t))
a8927c5085fe (streq, strneq): Use == NULL rather than !.
Richard M. Stallman <rms@gnu.org>
parents: 16607
diff changeset
144 #define strneq(s,t,n) ((DEBUG && (s) == NULL && (t) == NULL \
a8927c5085fe (streq, strneq): Use == NULL rather than !.
Richard M. Stallman <rms@gnu.org>
parents: 16607
diff changeset
145 && (abort (), 1)) || !strncmp (s, t, n))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
147 #define lowcase(c) tolower ((char)c)
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
148
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
149 #define CHARS 256 /* 2^sizeof(char) */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
150 #define CHAR(x) ((unsigned int)x & (CHARS - 1))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
151 #define iswhite(c) (_wht[CHAR(c)]) /* c is white */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
152 #define notinname(c) (_nin[CHAR(c)]) /* c is not in a name */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
153 #define begtoken(c) (_btk[CHAR(c)]) /* c can start token */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
154 #define intoken(c) (_itk[CHAR(c)]) /* c can be in token */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
155 #define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
157
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
158 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
159 * xnew, xrnew -- allocate, reallocate storage
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
160 *
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
161 * SYNOPSIS: Type *xnew (int n, Type);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
162 * Type *xrnew (OldPointer, int n, Type);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
163 */
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
164 #ifdef chkmalloc
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
165 # include "chkmalloc.h"
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
166 # define xnew(n,Type) ((Type *) trace_malloc (__FILE__, __LINE__, \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
167 (n) * sizeof (Type)))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
168 # define xrnew(op,n,Type) ((Type *) trace_realloc (__FILE__, __LINE__, \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
169 (op), (n) * sizeof (Type)))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
170 #else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
171 # define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type)))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
172 # define xrnew(op,n,Type) ((Type *) xrealloc ((op), (n) * sizeof (Type)))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
173 #endif
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
175 typedef int bool;
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
176
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
177 typedef void Lang_function ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
178
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
179 typedef struct
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
180 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
181 char *suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
182 char *command; /* Takes one arg and decompresses to stdout */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
183 } compressor;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
184
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
185 typedef struct
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
186 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
187 char *name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
188 Lang_function *function;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
189 char **suffixes;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
190 char **interpreters;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
191 } language;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
192
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
193 extern char *getenv ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
195 /* Many compilers barf on this:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
196 Lang_function Ada_funcs;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
197 so let's write it this way */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
198 void Ada_funcs ();
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
199 void Asm_labels ();
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
200 void C_entries ();
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
201 void default_C_entries ();
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
202 void plain_C_entries ();
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
203 void Cjava_entries ();
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
204 void Cobol_paragraphs ();
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
205 void Cplusplus_entries ();
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
206 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
207 void Erlang_functions ();
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
208 void Fortran_functions ();
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
209 void Yacc_entries ();
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
210 void Lisp_functions ();
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
211 void Pascal_functions ();
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
212 void Perl_functions ();
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
213 void Postscript_functions ();
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
214 void Prolog_functions ();
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
215 void Python_functions ();
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
216 void Scheme_functions ();
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
217 void TeX_functions ();
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
218 void just_read_file ();
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
219
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
220 compressor *get_compressor_from_suffix ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
221 language *get_language_from_name ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
222 language *get_language_from_interpreter ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
223 language *get_language_from_suffix ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 int total_size_of_entries ();
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
225 long readline (), readline_internal ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
226 void get_tag ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
227
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
228 #ifdef ETAGS_REGEXPS
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
229 void analyse_regex ();
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
230 void add_regex ();
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
231 void free_patterns ();
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
232 #endif /* ETAGS_REGEXPS */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 void error ();
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
234 void suggest_asking_for_help ();
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
235 void fatal (), pfatal ();
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
236 void add_node ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
237
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
238 void init ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
239 void initbuffer ();
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
240 void find_entries ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 void free_tree ();
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
242 void pfnote (), new_pfnote ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 void process_file ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 void put_entries ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 void takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
247 char *concat ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
248 char *skip_spaces (), *skip_non_spaces ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
249 char *savenstr (), *savestr ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
250 char *etags_strchr (), *etags_strrchr ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
251 char *etags_getcwd ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
252 char *relative_filename (), *absolute_filename (), *absolute_dirname ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
253 bool filename_is_absolute ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
254 void canonicalize_filename ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
255 void grow_linebuffer ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
256 long *xmalloc (), *xrealloc ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
257
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
258
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
259 char searchar = '/'; /* use /.../ searches */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
260
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
261 char *tagfile; /* output file */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
262 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
263 char *cwd; /* current working directory */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
264 char *tagfiledir; /* directory of tagfile */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
265 FILE *tagf; /* ioptr for tags file */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
266
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
267 char *curfile; /* current input file name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
268 language *curlang; /* current language */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
269
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
270 int lineno; /* line number of current line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
271 long charno; /* current character number */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
272 long linecharno; /* charno of start of current line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
273 char *dbp; /* pointer to start of current tag */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
274
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
275 typedef struct node_st
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
276 { /* sorting structure */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
277 char *name; /* function or type name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
278 char *file; /* file name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
279 bool is_func; /* use pattern or line no */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
280 bool been_warned; /* set if noticed dup */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
281 int lno; /* line number tag is on */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
282 long cno; /* character number line starts on */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
283 char *pat; /* search pattern */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
284 struct node_st *left, *right; /* left and right sons */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
285 } node;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
286
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
287 node *head; /* the head of the binary tree of tags */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
290 * A `linebuffer' is a structure which holds a line of text.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
291 * `readline_internal' reads a line from a stream into a linebuffer
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
292 * and works regardless of the length of the line.
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
293 * SIZE is the size of BUFFER, LEN is the length of the string in
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
294 * BUFFER after readline reads it.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
296 typedef struct
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
298 long size;
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
299 int len;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
300 char *buffer;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
301 } linebuffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
302
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
303 linebuffer lb; /* the current line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
304 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
305 struct
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
306 {
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
307 long linepos;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
308 linebuffer lb; /* used by C_entries instead of lb */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
309 } lbs[2];
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
310
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
311 /* boolean "functions" (see init) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
312 bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
313 char
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
314 /* white chars */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
315 *white = " \f\t\n\r",
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
316 /* not in a name */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
317 *nonam = " \f\t\n\r(=,[;",
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
318 /* token ending chars */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
319 *endtk = " \t\n\r\"'#()[]{}=-+%*/&|^~!<>;,.:?",
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
320 /* token starting chars */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
321 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~@",
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
322 /* valid in-token chars */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
323 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789";
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
324
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
325 bool append_to_tagfile; /* -a: append to tags */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
326 /* The following four default to TRUE for etags, but to FALSE for ctags. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
327 bool typedefs; /* -t: create tags for C and Ada typedefs */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
328 bool typedefs_and_cplusplus; /* -T: create tags for C typedefs, level */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 /* 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
330 /* member functions. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
331 bool constantypedefs; /* -d: create tags for C #define, enum */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
332 /* constants and variables. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 /* -D: opposite of -d. Default under ctags. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
334 bool declarations; /* --declarations: tag them and extern in C&Co*/
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
335 bool globals; /* create tags for global variables */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
336 bool members; /* create tags for C member variables */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
337 bool update; /* -u: update tags */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
338 bool vgrind_style; /* -v: create vgrind style index output */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
339 bool no_warnings; /* -w: suppress warnings */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
340 bool cxref_style; /* -x: create cxref style output */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
341 bool cplusplus; /* .[hc] means C++, not C */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
342 bool noindentypedefs; /* -I: ignore indentation in C */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
343 bool packages_only; /* --packages-only: in Ada, only tag packages*/
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
344
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
345 #ifdef LONG_OPTIONS
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
346 struct option longopts[] =
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
347 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
348 { "packages-only", no_argument, &packages_only, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
349 { "append", no_argument, NULL, 'a' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
350 { "backward-search", no_argument, NULL, 'B' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
351 { "c++", no_argument, NULL, 'C' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
352 { "cxref", no_argument, NULL, 'x' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
353 { "defines", no_argument, NULL, 'd' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
354 { "declarations", no_argument, &declarations, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
355 { "no-defines", no_argument, NULL, 'D' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
356 { "globals", no_argument, &globals, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
357 { "no-globals", no_argument, &globals, FALSE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
358 { "help", no_argument, NULL, 'h' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
359 { "help", no_argument, NULL, 'H' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
360 { "ignore-indentation", no_argument, NULL, 'I' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
361 { "include", required_argument, NULL, 'i' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
362 { "language", required_argument, NULL, 'l' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
363 { "members", no_argument, &members, TRUE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
364 { "no-members", no_argument, &members, FALSE },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
365 { "no-warn", no_argument, NULL, 'w' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
366 { "output", required_argument, NULL, 'o' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
367 #ifdef ETAGS_REGEXPS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
368 { "regex", required_argument, NULL, 'r' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
369 { "no-regex", no_argument, NULL, 'R' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
370 { "ignore-case-regex", required_argument, NULL, 'c' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
371 #endif /* ETAGS_REGEXPS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
372 { "typedefs", no_argument, NULL, 't' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
373 { "typedefs-and-c++", no_argument, NULL, 'T' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
374 { "update", no_argument, NULL, 'u' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
375 { "version", no_argument, NULL, 'V' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
376 { "vgrind", no_argument, NULL, 'v' },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
377 { NULL }
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
378 };
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
379 #endif /* LONG_OPTIONS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
380
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
381 #ifdef ETAGS_REGEXPS
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
382 /* 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
383 the compiled pattern, and the name string. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
384 typedef struct pattern
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
385 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
386 struct pattern *p_next;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
387 language *language;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
388 char *regex;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
389 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
390 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
391 char *name_pattern;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
392 bool error_signaled;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
393 } pattern;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
394
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
395 /* List of all regexps. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
396 pattern *p_head = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
397
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
398 /* How many characters in the character set. (From regex.c.) */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
399 #define CHAR_SET_SIZE 256
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
400 /* Translation table for case-insensitive matching. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
401 char lc_trans[CHAR_SET_SIZE];
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
402 #endif /* ETAGS_REGEXPS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
403
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
404 compressor compressors[] =
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
405 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
406 { "z", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
407 { "Z", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
408 { "gz", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
409 { "GZ", "gzip -d -c"},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
410 { "bz2", "bzip2 -d -c" },
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
411 { NULL }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
412 };
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
413
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
414 /*
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
415 * Language stuff.
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
416 */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
417
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
418 /* Non-NULL if language fixed. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
419 language *forced_lang = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
420
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
421 /* Ada code */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
422 char *Ada_suffixes [] =
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
423 { "ads", "adb", "ada", NULL };
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
424
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
425 /* Assembly code */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
426 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
427 "asm", /* Microcontroller assembly */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
428 "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
429 "inc", /* Microcontroller include files */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
430 "ins", /* Microcontroller include files */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
431 "s", "sa", /* Unix assembler */
19185
77910f9661a9 (Yacc_suffixes, Asm_suffixes): Add some alternatives.
Richard M. Stallman <rms@gnu.org>
parents: 18881
diff changeset
432 "S", /* cpp-processed Unix assembler */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
433 "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
434 NULL
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
435 };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
436
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
437 /* 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
438 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
439 char *default_C_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
440 { "c", "h", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
441
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
442 char *Cplusplus_suffixes [] =
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
443 { "C", "H", "c++", "cc", "cpp", "cxx", "h++", "hh", "hpp", "hxx",
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
444 "M", /* Objective C++ */
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
445 "pdb", /* Postscript with C syntax */
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
446 NULL };
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
447
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
448 char *Cjava_suffixes [] =
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
449 { "java", NULL };
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
450
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
451 char *Cobol_suffixes [] =
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
452 { "COB", "cob", NULL };
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
453
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
454 char *Cstar_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
455 { "cs", "hs", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
456
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
457 char *Erlang_suffixes [] =
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
458 { "erl", "hrl", NULL };
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
459
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
460 char *Fortran_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
461 { "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
462
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
463 char *Lisp_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
464 { "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
465
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
466 char *Pascal_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
467 { "p", "pas", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
468
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
469 char *Perl_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
470 { "pl", "pm", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
471 char *Perl_interpreters [] =
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
472 { "perl", "@PERL@", NULL };
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
473
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
474 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
475 { "pc", /* Pro*C file */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
476 "m", /* Objective C file */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
477 "lm", /* Objective lex file */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
478 NULL };
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
479
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
480 char *Postscript_suffixes [] =
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
481 { "ps", "psw", NULL }; /* .psw is for PSWrap */
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
482
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
483 char *Prolog_suffixes [] =
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
484 { "prolog", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
485
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
486 char *Python_suffixes [] =
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
487 { "py", NULL };
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
488
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
489 /* 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
490 char *Scheme_suffixes [] =
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
491 { "SCM", "SM", "oak", "sch", "scheme", "scm", "sm", "ss", "t", NULL };
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
492
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
493 char *TeX_suffixes [] =
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
494 { "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
495
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
496 char *Yacc_suffixes [] =
19185
77910f9661a9 (Yacc_suffixes, Asm_suffixes): Add some alternatives.
Richard M. Stallman <rms@gnu.org>
parents: 18881
diff changeset
497 { "y", "ym", "yy", "yxx", "y++", 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
498
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
499 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
500 * Table of languages.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
501 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
502 * It is ok for a given function to be listed under more than one
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
503 * name. I just didn't.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
504 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
505
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
506 language lang_names [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
507 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
508 { "ada", Ada_funcs, Ada_suffixes, NULL },
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
509 { "asm", Asm_labels, Asm_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
510 { "c", default_C_entries, default_C_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
511 { "c++", Cplusplus_entries, Cplusplus_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
512 { "c*", Cstar_entries, Cstar_suffixes, NULL },
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
513 { "cobol", Cobol_paragraphs, Cobol_suffixes, NULL },
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
514 { "erlang", Erlang_functions, Erlang_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
515 { "fortran", Fortran_functions, Fortran_suffixes, NULL },
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
516 { "java", Cjava_entries, Cjava_suffixes, NULL },
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
517 { "lisp", Lisp_functions, Lisp_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
518 { "pascal", Pascal_functions, Pascal_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
519 { "perl", Perl_functions, Perl_suffixes, Perl_interpreters },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
520 { "postscript", Postscript_functions, Postscript_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
521 { "proc", plain_C_entries, plain_C_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
522 { "prolog", Prolog_functions, Prolog_suffixes, NULL },
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
523 { "python", Python_functions, Python_suffixes, NULL },
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
524 { "scheme", Scheme_functions, Scheme_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
525 { "tex", TeX_functions, TeX_suffixes, NULL },
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
526 { "yacc", Yacc_entries, Yacc_suffixes, NULL },
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
527 { "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
528 { "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
529 { 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
530 };
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532 void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
533 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
534 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
535 language *lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
536 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
537
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
538 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
539 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
540 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
541 {
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
542 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
543 if (lang->suffixes != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
544 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
545 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
546 puts ("");
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
547 }
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
548 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
549 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
550 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
551 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
552 followed by the name of an interpreter. If no such sequence is found,\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
553 Fortran is tried first; if no tags are found, C is tried next.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
554 Compressed files are supported using gzip and bzip2.");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
555 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
556
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
557 #ifndef VERSION
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
558 # define VERSION "20"
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
559 #endif
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
560 void
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
561 print_version ()
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
562 {
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
563 printf ("%s (GNU Emacs %s)\n", (CTAGS) ? "ctags" : "etags", VERSION);
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
564 puts ("Copyright (C) 1999 Free Software Foundation, Inc. and Ken Arnold");
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
565 puts ("This program is distributed under the same terms as Emacs");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
566
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
567 exit (GOOD);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
568 }
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
569
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
570 void
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
571 print_help ()
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
572 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
573 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
574 \n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
575 These are the options accepted by %s.\n", progname, progname);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
576 #ifdef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
577 puts ("You may use unambiguous abbreviations for the long option names.");
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
578 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
579 puts ("Long option names do not work with this executable, as it is not\n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
580 linked with GNU getopt.");
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
581 #endif /* LONG_OPTIONS */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
582 puts ("A - as file name means read names from stdin (one per line).");
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
583 if (!CTAGS)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
584 printf (" Absolute names are stored in the output file as they are.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
585 Relative ones are stored relative to the output file's directory.");
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
586 puts ("\n");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
587
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
588 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
589 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
590
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
591 puts ("--packages-only\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
592 For Ada files, only generate tags for packages .");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
593
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
594 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
595 puts ("-B, --backward-search\n\
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
596 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
597 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
598
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
599 puts ("-C, --c++\n\
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
600 Treat files whose name suffix defaults to C language as C++ files.");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
601
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
602 puts ("--declarations\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
603 In C and derived languages, create tags for function declarations,");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
604 if (CTAGS)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
605 puts ("\tand create tags for extern variables if --globals is used.");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
606 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
607 puts
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
608 ("\tand create tags for extern variables unless --no-globals is used.");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
609
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
610 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
611 puts ("-d, --defines\n\
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
612 Create tag entries for C #define constants and enum constants, too.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
613 else
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
614 puts ("-D, --no-defines\n\
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
615 Don't create tag entries for C #define constants and enum constants.\n\
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
616 This makes the tags file smaller.");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
617
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
618 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
619 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
620 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
621 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
622 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
623 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
624 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
625 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
626 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
627 }
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
628
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
629 if (CTAGS)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
630 puts ("--globals\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
631 Create tag entries for global variables in some languages.");
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
632 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
633 puts ("--no-globals\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
634 Do not create tag entries for global variables in some\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
635 languages. This makes the tags file smaller.");
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
636 puts ("--members\n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
637 Create tag entries for member variables in C and derived languages.");
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
638
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
639 #ifdef ETAGS_REGEXPS
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
640 puts ("-r /REGEXP/, --regex=/REGEXP/ or --regex=@regexfile\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
641 Make a tag for each line matching pattern REGEXP in the following\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
642 files. {LANGUAGE}/REGEXP/ uses REGEXP for LANGUAGE files only.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
643 regexfile is a file containing one REGEXP per line.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
644 REGEXP is anchored (as if preceded by ^).\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
645 The form /REGEXP/NAME/ creates a named tag.\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
646 For example Tcl named tags can be created with:\n\
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
647 --regex=/proc[ \\t]+\\([^ \\t]+\\)/\\1/.");
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
648 puts ("-c /REGEXP/, --ignore-case-regex=/REGEXP/ or --ignore-case-regex=@regexfile\n\
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
649 Like -r, --regex but ignore case when matching expressions.");
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
650 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
651 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
652 #endif /* ETAGS_REGEXPS */
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
653 puts ("-o FILE, --output=FILE\n\
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
654 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
655 puts ("-I, --ignore-indentation\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
656 Don't rely on indentation quite as much as normal. Currently,\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
657 this means not to assume that a closing brace in the first\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
658 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
659 definition in C and C++.");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
660
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
661 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
662 {
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
663 puts ("-t, --typedefs\n\
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
664 Generate tag entries for C and Ada typedefs.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
665 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
666 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
667 and C++ member functions.");
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
668 puts ("-u, --update\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
669 Update the tag entries for the given files, leaving tag\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
670 entries for other files in place. Currently, this is\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
671 implemented by deleting the existing entries for the given\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
672 files and then rewriting the new entries at the end of the\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
673 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
674 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
675 puts ("-v, --vgrind\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
676 Generates an index of items intended for human consumption,\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
677 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
678 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
679 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
680 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
681 files.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
682 puts ("-x, --cxref\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
683 Like --vgrind, but in the style of cxref, rather than vgrind.\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
684 The output uses line numbers instead of page numbers, but\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
685 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
686 which you like.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
687 }
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
688
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
689 puts ("-V, --version\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
690 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
691 -h, --help\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
692 Print this help message.");
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
693
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
694 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
695
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
696 puts ("");
26323
98d99afb5ffb * etags.c (print_help): Change email address to send bugs to.
Gerd Moellmann <gerd@gnu.org>
parents: 26262
diff changeset
697 puts ("Report bugs to bug-gnu-emacs@gnu.org");
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
698
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
699 exit (GOOD);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
700 }
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
701
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
702
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
703 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
704 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
705 at_language,
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
706 at_regexp,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
707 at_filename,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
708 at_icregexp
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
709 };
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
710
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
711 /* This structure helps us allow mixing of --lang and file names. */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
712 typedef struct
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
713 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
714 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
715 char *what;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
716 language *lang; /* language of the regexp */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
717 } argument;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
718
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
719 #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
720
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
721 #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
722
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
723 /* 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
724 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
725 #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
726 typedef struct {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
727 short curlen;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
728 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
729 } vspec;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
730
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
731 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
732 v1.05 nmm 26-Jun-86 fn_exp - expand specification of list of file names
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
733 returning in each successive call the next file name matching the input
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
734 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
735 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
736 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
737 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
738 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
739 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
740 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
741
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
742 With each successive file name returned in out_spec, the
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
743 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
744 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
745 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
746 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
747
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
748 #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
749 #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
750 #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
751 short
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
752 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
753 vspec *out;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
754 char *in;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
755 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
756 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
757 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
758 static struct dsc$descriptor_s i;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
759 static bool pass1 = TRUE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
760 long status;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
761 short retval;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
762
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
763 if (pass1)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
764 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
765 pass1 = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
766 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
767 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
768 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
769 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
770 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
771 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
772 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
773 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
774 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
775 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
776 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
777 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
778 return 1;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
779 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
780 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
781 retval = 0;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
782 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
783 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
784 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
785 retval = -1;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
786 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
787 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
788 pass1 = TRUE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
789 return retval;
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
790 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
791
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
792 /*
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
793 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
794 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
795 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
796 char *
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
797 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
798 char *arg;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
799 bool *p_error;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
800 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
801 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
802
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
803 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
804 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
805 case 1:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
806 *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
807 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
808 case 0:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
809 *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
810 return NULL;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
811 default:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
812 *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
813 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
814 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
815 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
816
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
817 #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
818 system (cmd)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
819 char *cmd;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
820 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
821 error ("%s", "system() function not implemented under VMS");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
822 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
823 #endif
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
824
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
825 #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
826 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
827 char *s;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
828 {
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
829 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
830
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
831 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
832 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
833 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
834 *s = EOS;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
835 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
836 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
837 else
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
838 *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
839 return start;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
840 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
841 #endif /* VMS */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
842
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
843
15683
5f9426e991a3 Declare main as int, not void.
Karl Heuer <kwzh@gnu.org>
parents: 15579
diff changeset
844 int
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
845 main (argc, argv)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
846 int argc;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
847 char *argv[];
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
849 int i;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
850 unsigned int nincluded_files;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
851 char **included_files;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
852 char *this_file;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
853 argument *argbuffer;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
854 int current_arg, file_count;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
855 linebuffer filename_lb;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
856 #ifdef VMS
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
857 bool got_err;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
858 #endif
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
859
9773
bd49556a7552 (main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 9635
diff changeset
860 #ifdef DOS_NT
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
861 _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
862 #endif /* DOS_NT */
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
863
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
864 progname = argv[0];
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
865 nincluded_files = 0;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
866 included_files = xnew (argc, char *);
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
867 current_arg = 0;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
868 file_count = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
869
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
870 /* 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
871 is small. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
872 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
873
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
874 #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
875 /* Set syntax for regular expression routines. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
876 re_set_syntax (RE_SYNTAX_EMACS | RE_INTERVALS);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
877 /* Translation table for case-insensitive search. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
878 for (i = 0; i < CHAR_SET_SIZE; i++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
879 lc_trans[i] = lowcase (i);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
880 #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
881
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
882 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
883 * If etags, always find typedefs and structure tags. Why not?
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
884 * Also default is to find macro constants, enum constants and
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
885 * global variables.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886 */
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
887 if (!CTAGS)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
888 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
889 typedefs = typedefs_and_cplusplus = constantypedefs = TRUE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
890 globals = TRUE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
891 members = FALSE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
892 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
894 while (1)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
896 int opt;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
897 char *optstring;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
898
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
899 #ifdef ETAGS_REGEXPS
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
900 optstring = "-aCdDf:Il:o:r:c:RStTi:BuvxwVhH";
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
901 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
902 optstring = "-aCdDf:Il:o:StTi:BuvxwVhH";
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
903 #endif /* ETAGS_REGEXPS */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
904
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
905 #ifndef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
906 optstring = optstring + 1;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
907 #endif /* LONG_OPTIONS */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
908
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
909 opt = getopt_long (argc, argv, optstring, longopts, 0);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
910 if (opt == EOF)
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
911 break;
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
912
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
913 switch (opt)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 {
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
915 case 0:
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
916 /* If getopt returns 0, then it has already processed a
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
917 long-named option. We should do nothing. */
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
918 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
920 case 1:
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
921 /* This means that a file name has been seen. Record it. */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
922 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
923 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
924 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
925 ++file_count;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
926 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
927
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
928 /* Common options. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
929 case 'a': append_to_tagfile = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
930 case 'C': cplusplus = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
931 case 'd': constantypedefs = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
932 case 'D': constantypedefs = FALSE; break;
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
933 case 'f': /* for compatibility with old makefiles */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
934 case 'o':
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
935 if (tagfile)
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
936 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
937 error ("-%c option may only be given once.", opt);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
938 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
940 tagfile = optarg;
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
941 break;
10449
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
942 case 'I':
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
943 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
944 noindentypedefs = TRUE;
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
945 break;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
946 case 'l':
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
947 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
948 language *lang = get_language_from_name (optarg);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
949 if (lang != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
950 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
951 argbuffer[current_arg].lang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
952 argbuffer[current_arg].arg_type = at_language;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
953 ++current_arg;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
954 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
955 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
956 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
957 #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
958 case 'r':
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
959 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
960 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
961 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
962 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
963 case 'R':
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
964 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
965 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
966 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
967 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
968 case 'c':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
969 argbuffer[current_arg].arg_type = at_icregexp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
970 argbuffer[current_arg].what = optarg;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
971 ++current_arg;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
972 break;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
973 #endif /* ETAGS_REGEXPS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
974 case 'V':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
975 print_version ();
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
976 break;
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
977 case 'h':
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
978 case 'H':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
979 print_help ();
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
980 break;
8180
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
981 case 't':
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
982 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
983 break;
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
984 case 'T':
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
985 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
986 break;
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
987 #if (!CTAGS)
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
988 /* Etags options */
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
989 case 'i':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
990 included_files[nincluded_files++] = optarg;
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
991 break;
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
992 #else /* CTAGS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
993 /* Ctags options. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
994 case 'B': searchar = '?'; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
995 case 'u': update = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
996 case 'v': vgrind_style = TRUE; /*FALLTHRU*/
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
997 case 'x': cxref_style = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
998 case 'w': no_warnings = TRUE; break;
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
999 #endif /* CTAGS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1000 default:
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1001 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1005 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
1006 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1007 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
1008 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
1009 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1010 ++file_count;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1011 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1012
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1013 if (nincluded_files == 0 && file_count == 0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1015 error ("no input files specified.", 0);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1016 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1017 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1018
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1019 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
1020 tagfile = CTAGS ? "tags" : "TAGS";
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1021 cwd = etags_getcwd (); /* the current working directory */
15366
32ab7b623b9b (main): Copy cwd when appending slash.
Richard M. Stallman <rms@gnu.org>
parents: 15243
diff changeset
1022 if (cwd[strlen (cwd) - 1] != '/')
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1023 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1024 char *oldcwd = cwd;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1025 cwd = concat (oldcwd, "/", "");
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1026 free (oldcwd);
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1027 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1028 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
1029 tagfiledir = cwd;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1030 else
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
1031 tagfiledir = absolute_dirname (tagfile, cwd);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1032
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1033 init (); /* set up boolean "functions" */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035 initbuffer (&lb);
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
1036 initbuffer (&token_name);
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1037 initbuffer (&lbs[0].lb);
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1038 initbuffer (&lbs[1].lb);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1039 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
1040
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1041 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1042 {
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1043 if (streq (tagfile, "-"))
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1044 {
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1045 tagf = stdout;
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1046 #ifdef DOS_NT
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1047 /* Switch redirected `stdout' to binary mode (setting `_fmode'
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
1048 doesn't take effect until after `stdout' is already open). */
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1049 if (!isatty (fileno (stdout)))
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1050 setmode (fileno (stdout), O_BINARY);
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1051 #endif /* DOS_NT */
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1052 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1053 else
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1054 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
1055 if (tagf == NULL)
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
1056 pfatal (tagfile);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1057 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1058
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1059 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1060 * 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
1061 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1062 for (i = 0; i < current_arg; ++i)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1063 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1064 switch (argbuffer[i].arg_type)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1065 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1066 case at_language:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1067 forced_lang = argbuffer[i].lang;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1068 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1069 #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
1070 case at_regexp:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1071 analyse_regex (argbuffer[i].what, FALSE);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1072 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1073 case at_icregexp:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1074 analyse_regex (argbuffer[i].what, TRUE);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1075 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1076 #endif
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1077 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
1078 #ifdef VMS
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1079 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
1080 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1081 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
1082 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1083 error ("can't find file %s\n", this_file);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1084 argc--, argv++;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1085 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1086 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1087 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1088 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
1089 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 #else
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1091 this_file = argbuffer[i].what;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1092 #endif
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1093 /* Input file named "-" means read file names from stdin
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1094 (one per line) and use them. */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1095 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
1096 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
1097 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
1098 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1099 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
1100 #ifdef VMS
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1102 #endif
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1103 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1104 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1105 }
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
1106
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1107 #ifdef ETAGS_REGEXPS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1108 free_patterns ();
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1109 #endif /* ETAGS_REGEXPS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1110
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1111 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1112 {
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
1113 while (nincluded_files-- > 0)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1114 fprintf (tagf, "\f\n%s,include\n", *included_files++);
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
1115
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1116 fclose (tagf);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
1117 exit (GOOD);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1118 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1119
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1120 /* 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
1121 because we want them ordered. Let's do it now. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1122 if (cxref_style)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1123 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1124 put_entries (head);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1125 free_tree (head);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1126 head = NULL;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1127 exit (GOOD);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1128 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1129
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1130 if (update)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1131 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1132 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
1133 for (i = 0; i < current_arg; ++i)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1134 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1135 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
1136 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 sprintf (cmd,
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1138 "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
1139 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
1140 if (system (cmd) != GOOD)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
1141 fatal ("failed to execute shell command", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1142 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1143 append_to_tagfile = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1144 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1145
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1146 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
1147 if (tagf == NULL)
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1148 pfatal (tagfile);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1149 put_entries (head);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1150 free_tree (head);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1151 head = NULL;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1152 fclose (tagf);
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1153
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1154 if (update)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1155 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1156 char cmd[BUFSIZ];
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1157 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
1158 exit (system (cmd));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1159 }
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
1160 return GOOD;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1161 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1162
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1163
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1164
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1165 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1166 * Return a compressor given the file name. If EXTPTR is non-zero,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1167 * return a pointer into FILE where the compressor-specific
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1168 * extension begins. If no compressor is found, NULL is returned
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1169 * and EXTPTR is not significant.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1170 * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca>
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1171 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1172 compressor *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1173 get_compressor_from_suffix (file, extptr)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1174 char *file;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1175 char **extptr;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1176 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1177 compressor *compr;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1178 char *slash, *suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1179
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1180 /* This relies on FN to be after canonicalize_filename,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1181 so we don't need to consider backslashes on DOS_NT. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1182 slash = etags_strrchr (file, '/');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1183 suffix = etags_strrchr (file, '.');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1184 if (suffix == NULL || suffix < slash)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1185 return NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1186 if (extptr != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1187 *extptr = suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1188 suffix += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1189 /* Let those poor souls who live with DOS 8+3 file name limits get
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1190 some solace by treating foo.cgz as if it were foo.c.gz, etc.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1191 Only the first do loop is run if not MSDOS */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1192 do
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1193 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1194 for (compr = compressors; compr->suffix != NULL; compr++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1195 if (streq (compr->suffix, suffix))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1196 return compr;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1197 #ifndef MSDOS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1198 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1199 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1200 if (extptr != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1201 *extptr = ++suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1202 } while (*suffix != '\0');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1203 return NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1204 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1205
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1206
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1207
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1208 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1209 * Return a language given the name.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1210 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1211 language *
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1212 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
1213 char *name;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1214 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1215 language *lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1216
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1217 if (name == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1218 error ("empty language name", (char *)NULL);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1219 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1220 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1221 for (lang = lang_names; lang->name != NULL; lang++)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1222 if (streq (name, lang->name))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1223 return lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1224 error ("unknown language \"%s\"", name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1225 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1226
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1227 return NULL;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1228 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1229
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1230
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1231 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1232 * Return a language given the interpreter name.
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1233 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1234 language *
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1235 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
1236 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
1237 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1238 language *lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1239 char **iname;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1240
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1241 if (interpreter == NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1242 return NULL;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1243 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
1244 if (lang->interpreters != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1245 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
1246 if (streq (*iname, interpreter))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1247 return lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1248
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1249 return NULL;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1250 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1251
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1252
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1253
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1254 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1255 * Return a language given the file name.
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1256 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1257 language *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1258 get_language_from_suffix (file)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1259 char *file;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1260 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1261 language *lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1262 char **ext, *suffix;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1263
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1264 suffix = etags_strrchr (file, '.');
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1265 if (suffix == NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1266 return NULL;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1267 suffix += 1;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1268 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
1269 if (lang->suffixes != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1270 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
1271 if (streq (*ext, suffix))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1272 return lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1273 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
1274 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1275
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1276
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1277
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1278 /*
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1279 * This routine is called on each file argument.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1280 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1281 void
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1282 process_file (file)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1283 char *file;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1284 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1285 struct stat stat_buf;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1286 FILE *inf;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1287 compressor *compr;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1288 char *compressed_name, *uncompressed_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1289 char *ext, *real_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1290
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1291
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1292 canonicalize_filename (file);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1293 if (streq (file, tagfile) && !streq (tagfile, "-"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1294 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1295 error ("skipping inclusion of %s in self.", file);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1296 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1297 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1298 if ((compr = get_compressor_from_suffix (file, &ext)) == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1299 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1300 compressed_name = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1301 real_name = uncompressed_name = savestr (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1302 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1303 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1304 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1305 real_name = compressed_name = savestr (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1306 uncompressed_name = savenstr (file, ext - file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1307 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1308
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1309 /* If the canonicalised uncompressed name has already be dealt with,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1310 skip it silently, else add it to the list. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1311 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1312 typedef struct processed_file
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1313 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1314 char *filename;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1315 struct processed_file *next;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1316 } processed_file;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1317 static processed_file *pf_head = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1318 register processed_file *fnp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1319
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1320 for (fnp = pf_head; fnp != NULL; fnp = fnp->next)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1321 if (streq (uncompressed_name, fnp->filename))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1322 goto exit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1323 fnp = pf_head;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1324 pf_head = xnew (1, struct processed_file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1325 pf_head->filename = savestr (uncompressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1326 pf_head->next = fnp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1327 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1328
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1329 if (stat (real_name, &stat_buf) != 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1330 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1331 /* Reset real_name and try with a different name. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1332 real_name = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1333 if (compressed_name != NULL) /* try with the given suffix */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1334 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1335 if (stat (uncompressed_name, &stat_buf) == 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1336 real_name = uncompressed_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1337 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1338 else /* try all possible suffixes */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1339 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1340 for (compr = compressors; compr->suffix != NULL; compr++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1341 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1342 compressed_name = concat (file, ".", compr->suffix);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1343 if (stat (compressed_name, &stat_buf) != 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1344 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1345 #ifdef MSDOS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1346 char *suf = compressed_name + strlen (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1347 size_t suflen = strlen (compr->suffix) + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1348 for ( ; suf[1]; suf++, suflen--)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1349 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1350 memmove (suf, suf + 1, suflen);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1351 if (stat (compressed_name, &stat_buf) == 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1352 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1353 real_name = compressed_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1354 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1355 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1356 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1357 if (real_name != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1358 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1359 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1360 free (compressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1361 compressed_name = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1362 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1363 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1364 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1365 real_name = compressed_name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1366 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1367 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1368 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1369 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1370 if (real_name == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1371 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1372 perror (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1373 goto exit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1374 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1375 } /* try with a different name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1376
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1377 if (!S_ISREG (stat_buf.st_mode))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1378 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1379 error ("skipping %s: it is not a regular file.", real_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1380 goto exit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1381 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1382 if (real_name == compressed_name)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1383 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1384 char *cmd = concat (compr->command, " ", real_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1385 inf = popen (cmd, "r");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1386 free (cmd);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1387 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1388 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1389 inf = fopen (real_name, "r");
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1390 if (inf == NULL)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1391 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1392 perror (real_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1393 goto exit;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1394 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1395
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1396 find_entries (uncompressed_name, inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1397
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1398 if (real_name == compressed_name)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1399 pclose (inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1400 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1401 fclose (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1402
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1403 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1404 {
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1405 char *filename;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1406
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1407 if (filename_is_absolute (uncompressed_name))
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1408 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
1409 /* file is an absolute file name. Canonicalise it. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1410 filename = absolute_filename (uncompressed_name, cwd);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1411 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1412 else
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1413 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
1414 /* file is a file name relative to cwd. Make it relative
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1415 to the directory of the tags file. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1416 filename = relative_filename (uncompressed_name, tagfiledir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1417 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1418 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
1419 free (filename);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1420 put_entries (head);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1421 free_tree (head);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1422 head = NULL;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1423 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1424
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1425 exit:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1426 if (compressed_name) free(compressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1427 if (uncompressed_name) free(uncompressed_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1428 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1429 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1430
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1431 /*
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3569
diff changeset
1432 * This routine sets up the boolean pseudo-functions which work
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1433 * by setting boolean flags dependent upon the corresponding character.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1434 * Every char which is NOT in that string is not a white char. Therefore,
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1435 * all of the array "_wht" is set to FALSE, and then the elements
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1436 * subscripted by the chars in "white" are set to TRUE. Thus "_wht"
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1437 * of a char is TRUE if it is the string "white", else FALSE.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1438 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1439 void
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1440 init ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1441 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1442 register char *sp;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1443 register int i;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1444
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1445 for (i = 0; i < CHARS; i++)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1446 iswhite(i) = notinname(i) = begtoken(i) = intoken(i) = endtoken(i) = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1447 for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1448 for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1449 for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1450 for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1451 for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1452 iswhite('\0') = iswhite('\n');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1453 notinname('\0') = notinname('\n');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1454 begtoken('\0') = begtoken('\n');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1455 intoken('\0') = intoken('\n');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1456 endtoken('\0') = endtoken('\n');
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1457 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1458
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1459 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1460 * This routine opens the specified file and calls the function
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1461 * which finds the function and type definitions.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1462 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1463 node *last_node = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1464
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1465 void
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1466 find_entries (file, inf)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1467 char *file;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1468 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1469 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1470 char *cp;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1471 language *lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1472 node *old_last_node;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1473
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1474 /* Memory leakage here: the string pointed by curfile is
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1475 never released, because curfile is copied into np->file
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1476 for each node, to be used in CTAGS mode. The amount of
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1477 memory leaked here is the sum of the lengths of the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1478 file names. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1479 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
1480
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1481 /* If user specified a language, use it. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1482 lang = forced_lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1483 if (lang != NULL && lang->function != NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1484 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1485 curlang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1486 lang->function (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1487 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1488 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1489
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1490 /* Try to guess the language given the file name. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1491 lang = get_language_from_suffix (file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1492 if (lang != NULL && lang->function != NULL)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1493 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1494 curlang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1495 lang->function (inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1496 return;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1497 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1498
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1499 /* Look for sharp-bang as the first two characters. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1500 if (readline_internal (&lb, inf) > 0
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
1501 && lb.len >= 2
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1502 && lb.buffer[0] == '#'
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1503 && lb.buffer[1] == '!')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1504 {
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1505 char *lp;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1506
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1507 /* 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
1508 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
1509 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
1510 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
1511 if (lp != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1512 lp += 1;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1513 else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1514 lp = skip_spaces (lb.buffer + 2);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1515 cp = skip_non_spaces (lp);
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1516 *cp = '\0';
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1517
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1518 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
1519 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1520 lang = get_language_from_interpreter (lp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1521 if (lang != NULL && lang->function != NULL)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1522 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1523 curlang = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1524 lang->function (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1525 return;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1526 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1527 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1528 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1529 /* We rewind here, even if inf may be a pipe. We fail if the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1530 length of the first line is longer than the pipe block size,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1531 which is unlikely. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1532 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
1533
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1534 /* Try Fortran. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1535 old_last_node = last_node;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1536 curlang = get_language_from_name ("fortran");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1537 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
1538
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1539 /* 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
1540 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
1541 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1542 /* We do not tag if rewind fails.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1543 Only the file name will be recorded in the tags file. */
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1544 rewind (inf);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1545 curlang = get_language_from_name (cplusplus ? "c++" : "c");
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1546 default_C_entries (inf);
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1547 }
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1548 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1549 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1550
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1551 /* Record a tag. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1552 void
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1553 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
1554 char *name; /* tag name, or NULL if unnamed */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1555 bool is_func; /* tag is a function */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1556 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
1557 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
1558 int lno; /* line number */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1559 long cno; /* character number */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1560 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1561 register node *np;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1562
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1563 if (CTAGS && name == NULL)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1564 return;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1565
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1566 np = xnew (1, node);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1567
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1568 /* 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
1569 if (CTAGS && !cxref_style && streq (name, "main"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1570 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1571 register char *fp = etags_strrchr (curfile, '/');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1572 np->name = concat ("M", fp == NULL ? curfile : fp + 1, "");
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1573 fp = etags_strrchr (np->name, '.');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1574 if (fp != NULL && fp[1] != '\0' && fp[2] == '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1575 fp[0] = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1576 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1577 else
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1578 np->name = name;
10623
8a73e71a55e3 * etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents: 10449
diff changeset
1579 np->been_warned = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1580 np->file = curfile;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1581 np->is_func = is_func;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1582 np->lno = lno;
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
1583 /* 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
1584 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
1585 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
1586 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
1587 uncomment the +1 below. */
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
1588 np->cno = cno /* + 1 */ ;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1589 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
1590 if (CTAGS && !cxref_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1591 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1592 if (strlen (linestart) < 50)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1593 np->pat = concat (linestart, "$", "");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1594 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1595 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
1596 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1597 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1598 np->pat = savenstr (linestart, linelen);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1599
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1600 add_node (np, &head);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1601 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1602
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1603 /* Date: Wed, 22 Jan 1997 02:56:31 -0500 [last amended 18 Sep 1997]
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1604 * From: Sam Kendall <kendall@mv.mv.com>
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1605 * Subject: Proposal for firming up the TAGS format specification
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1606 * To: F.Potorti@cnuce.cnr.it
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1607 *
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1608 * pfnote should emit the optimized form [unnamed tag] only if:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1609 * 1. name does not contain any of the characters " \t\r\n(),;";
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1610 * 2. linestart contains name as either a rightmost, or rightmost but
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1611 * one character, substring;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1612 * 3. the character, if any, immediately before name in linestart must
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1613 * be one of the characters " \t(),;";
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1614 * 4. the character, if any, immediately after name in linestart must
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1615 * also be one of the characters " \t(),;".
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1616 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1617 * The real implementation uses the notinname() macro, which recognises
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1618 * characters slightly different form " \t\r\n(),;". See the variable
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1619 * `nonam'.
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1620 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1621 #define traditional_tag_style TRUE
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1622 void
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1623 new_pfnote (name, namelen, is_func, linestart, linelen, lno, cno)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1624 char *name; /* tag name, or NULL if unnamed */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1625 int namelen; /* tag length */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1626 bool is_func; /* tag is a function */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1627 char *linestart; /* start of the line where tag is */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1628 int linelen; /* length of the line where tag is */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1629 int lno; /* line number */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1630 long cno; /* character number */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1631 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1632 register char *cp;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1633 bool named;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1634
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1635 named = TRUE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1636 if (!CTAGS)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1637 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1638 for (cp = name; !notinname (*cp); cp++)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1639 continue;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1640 if (*cp == '\0') /* rule #1 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1641 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1642 cp = linestart + linelen - namelen;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1643 if (notinname (linestart[linelen-1]))
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1644 cp -= 1; /* rule #4 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1645 if (cp >= linestart /* rule #2 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1646 && (cp == linestart
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1647 || notinname (cp[-1])) /* rule #3 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1648 && strneq (name, cp, namelen)) /* rule #2 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1649 named = FALSE; /* use unnamed tag */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1650 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1651 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1652
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1653 if (named)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1654 name = savenstr (name, namelen);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1655 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1656 name = NULL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1657 pfnote (name, is_func, linestart, linelen, lno, cno);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1658 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1659
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1660 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1661 * free_tree ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1662 * recurse on left children, iterate on right children.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1663 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1664 void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1665 free_tree (np)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1666 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1667 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1668 while (np)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1669 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1670 register node *node_right = np->right;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1671 free_tree (np->left);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1672 if (np->name != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1673 free (np->name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1674 free (np->pat);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1675 free (np);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1676 np = node_right;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1677 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1678 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1679
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1680 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1681 * add_node ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1682 * Adds a node to the tree of nodes. In etags mode, we don't keep
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1683 * it sorted; we just keep a linear list. In ctags mode, maintain
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1684 * an ordered tree, with no attempt at balancing.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1685 *
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1686 * add_node is the only function allowed to add nodes, so it can
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1687 * maintain state.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1688 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1689 void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1690 add_node (np, cur_node_p)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1691 node *np, **cur_node_p;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1692 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1693 register int dif;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1694 register node *cur_node = *cur_node_p;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1695
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1696 if (cur_node == NULL)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1697 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1698 *cur_node_p = np;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1699 last_node = np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1700 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1701 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1702
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1703 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1704 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1705 /* Etags Mode */
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
1706 if (last_node == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
1707 fatal ("internal error in add_node", (char *)NULL);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1708 last_node->right = np;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1709 last_node = np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1710 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1711 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1712 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1713 /* Ctags Mode */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1714 dif = strcmp (np->name, cur_node->name);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1715
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1716 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1717 * If this tag name matches an existing one, then
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1718 * do not add the node, but maybe print a warning.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1719 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1720 if (!dif)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1721 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1722 if (streq (np->file, cur_node->file))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1723 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1724 if (!no_warnings)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1725 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1726 fprintf (stderr, "Duplicate entry in file %s, line %d: %s\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1727 np->file, lineno, np->name);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1728 fprintf (stderr, "Second entry ignored\n");
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1729 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1730 }
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1731 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
1732 {
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1733 fprintf
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1734 (stderr,
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1735 "Duplicate entry in files %s and %s: %s (Warning only)\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1736 np->file, cur_node->file, np->name);
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1737 cur_node->been_warned = TRUE;
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1738 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1739 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1740 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1741
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1742 /* Actually add the node */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1743 add_node (np, dif < 0 ? &cur_node->left : &cur_node->right);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1744 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1745 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1746
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1747 void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1748 put_entries (np)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1749 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1750 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1751 register char *sp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1752
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1753 if (np == NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1754 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1755
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1756 /* Output subentries that precede this one */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1757 put_entries (np->left);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1758
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1759 /* Output this entry */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1760
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1761 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1762 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1763 if (np->name != NULL)
21355
b33f3f6d7f74 (put_entries): Use %ld.
Richard M. Stallman <rms@gnu.org>
parents: 20788
diff changeset
1764 fprintf (tagf, "%s\177%s\001%d,%ld\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1765 np->pat, np->name, np->lno, np->cno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1766 else
21355
b33f3f6d7f74 (put_entries): Use %ld.
Richard M. Stallman <rms@gnu.org>
parents: 20788
diff changeset
1767 fprintf (tagf, "%s\177%d,%ld\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1768 np->pat, np->lno, np->cno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1769 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1770 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1771 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1772 if (np->name == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
1773 error ("internal error: NULL name in ctags mode.", (char *)NULL);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1774
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1775 if (cxref_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1776 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1777 if (vgrind_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1778 fprintf (stdout, "%s %s %d\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1779 np->name, np->file, (np->lno + 63) / 64);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1780 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1781 fprintf (stdout, "%-16s %3d %-16s %s\n",
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1782 np->name, np->lno, np->file, np->pat);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1783 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1784 else
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1785 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1786 fprintf (tagf, "%s\t%s\t", np->name, np->file);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1787
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1788 if (np->is_func)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1789 { /* a function */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1790 putc (searchar, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1791 putc ('^', tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1792
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1793 for (sp = np->pat; *sp; sp++)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1794 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1795 if (*sp == '\\' || *sp == searchar)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1796 putc ('\\', tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1797 putc (*sp, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1798 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1799 putc (searchar, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1800 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1801 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1802 { /* a typedef; text pattern inadequate */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1803 fprintf (tagf, "%d", np->lno);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1804 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1805 putc ('\n', tagf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1806 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1807 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1808
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1809 /* Output subentries that follow this one */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1810 put_entries (np->right);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1811 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1812
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1813 /* Length of a number's decimal representation. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1814 int
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1815 number_len (num)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1816 long num;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1817 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1818 int len = 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1819 while ((num /= 10) > 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1820 len += 1;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1821 return len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1822 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1823
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1824 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1825 * 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
1826 * 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
1827 * 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
1828 * 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
1829 * backward compatibility.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1830 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1831 int
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1832 total_size_of_entries (np)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1833 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1834 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1835 register int total;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1836
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1837 if (np == NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1838 return 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1839
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1840 for (total = 0; np != NULL; np = np->right)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1841 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1842 /* Count left subentries. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1843 total += total_size_of_entries (np->left);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1844
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1845 /* Count this entry */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1846 total += strlen (np->pat) + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1847 total += number_len ((long) np->lno) + 1 + number_len (np->cno) + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1848 if (np->name != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1849 total += 1 + strlen (np->name); /* \001name */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1850 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1851
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1852 return total;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1853 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1854
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1855 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1856 * The C symbol tables.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1857 */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1858 enum sym_type
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1859 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1860 st_none,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1861 st_C_objprot, st_C_objimpl, st_C_objend,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1862 st_C_gnumacro,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1863 st_C_ignore,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1864 st_C_javastruct,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1865 st_C_operator,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1866 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1867 };
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1868
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1869 /* Feed stuff between (but not including) %[ and %] lines to:
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1870 gperf -c -k 1,3 -o -p -r -t
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1871 %[
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1872 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
1873 %%
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1874 if, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1875 for, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1876 while, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1877 switch, 0, st_C_ignore
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1878 return, 0, st_C_ignore
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1879 @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
1880 @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
1881 @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
1882 @end, 0, st_C_objend
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1883 import, C_JAVA, st_C_ignore
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1884 package, C_JAVA, st_C_ignore
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1885 friend, C_PLPL, st_C_ignore
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
1886 extends, C_JAVA, st_C_javastruct
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
1887 implements, C_JAVA, st_C_javastruct
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1888 interface, C_JAVA, st_C_struct
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1889 class, C_PLPL, st_C_struct
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1890 namespace, C_PLPL, st_C_struct
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1891 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
1892 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
1893 struct, 0, st_C_struct
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1894 extern, 0, st_C_extern
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1895 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
1896 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
1897 define, 0, st_C_define
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1898 operator, C_PLPL, st_C_operator
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1899 bool, C_PLPL, st_C_typespec
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1900 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
1901 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
1902 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
1903 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
1904 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
1905 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
1906 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
1907 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
1908 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
1909 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
1910 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
1911 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
1912 volatile, 0, st_C_typespec
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1913 explicit, C_PLPL, st_C_typespec
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1914 mutable, C_PLPL, st_C_typespec
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1915 typename, C_PLPL, st_C_typespec
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1916 # 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
1917 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
1918 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
1919 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
1920 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
1921 # 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
1922 # 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
1923 #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
1924 #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
1925 %]
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1926 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
1927 /*%<*/
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1928 /* C code produced by gperf version 2.7.1 (19981006 egcs) */
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1929 /* Command-line: gperf -c -k 1,3 -o -p -r -t */
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1930 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
1931
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1932 #define TOTAL_KEYWORDS 46
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1933 #define MIN_WORD_LENGTH 2
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1934 #define MAX_WORD_LENGTH 15
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1935 #define MIN_HASH_VALUE 13
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1936 #define MAX_HASH_VALUE 123
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1937 /* maximum key range = 111, duplicates = 0 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1938
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1939 #ifdef __GNUC__
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1940 __inline
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1941 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1942 static unsigned int
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1943 hash (str, len)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1944 register const char *str;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1945 register unsigned int len;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1946 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1947 static unsigned char asso_values[] =
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1948 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1949 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1950 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1951 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1952 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1953 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1954 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1955 124, 124, 124, 124, 3, 124, 124, 124, 43, 6,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1956 11, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1957 11, 124, 124, 58, 7, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1958 124, 124, 124, 124, 124, 124, 124, 57, 7, 42,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1959 4, 14, 52, 0, 124, 53, 124, 124, 29, 11,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1960 6, 35, 32, 124, 29, 34, 59, 58, 51, 24,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1961 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1962 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1963 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1964 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1965 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1966 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1967 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1968 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1969 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1970 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1971 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1972 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1973 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1974 124, 124, 124, 124, 124, 124
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1975 };
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1976 register int hval = len;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1977
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1978 switch (hval)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1979 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1980 default:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1981 case 3:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1982 hval += asso_values[(unsigned char)str[2]];
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1983 case 2:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1984 case 1:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1985 hval += asso_values[(unsigned char)str[0]];
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1986 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1987 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1988 return hval;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1989 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1990
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1991 #ifdef __GNUC__
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1992 __inline
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1993 #endif
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1994 struct C_stab_entry *
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1995 in_word_set (str, len)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1996 register const char *str;
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
1997 register unsigned int len;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1998 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1999 static struct C_stab_entry wordlist[] =
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2000 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2001 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2002 {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2003 {"@end", 0, st_C_objend},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2004 {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2005 {"ENTRY", 0, st_C_gnumacro},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2006 {"@interface", 0, st_C_objprot},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2007 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2008 {"domain", C_STAR, st_C_struct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2009 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2010 {"PSEUDO", 0, st_C_gnumacro},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2011 {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2012 {"namespace", C_PLPL, st_C_struct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2013 {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2014 {"@implementation",0, st_C_objimpl},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2015 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2016 {"long", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2017 {"signed", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2018 {"@protocol", 0, st_C_objprot},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2019 {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2020 {"bool", C_PLPL, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2021 {""}, {""}, {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2022 {"const", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2023 {"explicit", C_PLPL, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2024 {"if", 0, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2025 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2026 {"operator", C_PLPL, st_C_operator},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2027 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2028 {"DEFUN", 0, st_C_gnumacro},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2029 {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2030 {"define", 0, st_C_define},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2031 {""}, {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2032 {"double", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2033 {"struct", 0, st_C_struct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2034 {""}, {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2035 {"short", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2036 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2037 {"enum", 0, st_C_enum},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2038 {"mutable", C_PLPL, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2039 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2040 {"extern", 0, st_C_extern},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2041 {"extends", C_JAVA, st_C_javastruct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2042 {"package", C_JAVA, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2043 {"while", 0, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2044 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2045 {"for", 0, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2046 {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2047 {"volatile", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2048 {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2049 {"import", C_JAVA, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2050 {"float", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2051 {"switch", 0, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2052 {"return", 0, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2053 {"implements", C_JAVA, st_C_javastruct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2054 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2055 {"static", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2056 {"typedef", 0, st_C_typedef},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2057 {"typename", C_PLPL, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2058 {"unsigned", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2059 {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2060 {"char", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2061 {"class", C_PLPL, st_C_struct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2062 {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2063 {"void", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2064 {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2065 {"friend", C_PLPL, st_C_ignore},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2066 {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2067 {"int", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2068 {"union", 0, st_C_struct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2069 {""}, {""}, {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2070 {"auto", 0, st_C_typespec},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2071 {"interface", C_JAVA, st_C_struct},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2072 {""},
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2073 {"SYSCALL", 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
2074 };
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2075
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2076 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
2077 {
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2078 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
2079
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2080 if (key <= MAX_HASH_VALUE && key >= 0)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2081 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2082 register const char *s = wordlist[key].name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2083
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2084 if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2085 return &wordlist[key];
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2086 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2087 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2088 return 0;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2089 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2090 /*%>*/
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2091
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2092 enum sym_type
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
2093 C_symtype (str, len, c_ext)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2094 char *str;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2095 int len;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2096 int c_ext;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2097 {
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
2098 register struct C_stab_entry *se = in_word_set (str, len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2099
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2100 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
2101 return st_none;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2102 return se->type;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2103 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2104
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2105 /*
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2106 * C functions and variables are recognized using a simple
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2107 * finite automaton. fvdef is its state variable.
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2108 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2109 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2110 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2111 fvnone, /* nothing seen */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2112 foperator, /* func: operator keyword seen (cplpl) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2113 fvnameseen, /* function or variable name seen */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2114 fstartlist, /* func: just after open parenthesis */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2115 finlist, /* func: in parameter list */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2116 flistseen, /* func: after parameter list */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2117 fignore, /* func: before open brace */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2118 vignore /* var-like: ignore until ';' */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2119 } fvdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2120
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2121 bool fvextern; /* func or var: extern keyword seen; */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2122
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2123 /*
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2124 * typedefs are recognized using a simple finite automaton.
14021
19bab04cf346 (substitute): Fix spelling in message.
Karl Heuer <kwzh@gnu.org>
parents: 13696
diff changeset
2125 * typdef is its state variable.
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2126 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2127 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2128 {
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
2129 tnone, /* nothing seen */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2130 tkeyseen, /* typedef keyword seen */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2131 ttypeseen, /* defined type seen */
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
2132 tinbody, /* inside typedef body */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2133 tend, /* just before typedef tag */
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2134 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
2135 } typdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2136
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2137
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
2138 /*
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2139 * 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
2140 * 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
2141 * variable.
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2142 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2143 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2144 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2145 snone, /* nothing seen yet */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2146 skeyseen, /* struct-like keyword seen */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2147 stagseen, /* struct-like tag seen */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2148 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
2149 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
2150 } structdef;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2151
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2152 /*
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2153 * 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
2154 * 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
2155 * keyword.
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2156 */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2157 char *structtag = "<uninited>";
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2158 enum sym_type structtype;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2159
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2160 /*
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2161 * 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
2162 */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2163 char *objtag = "<uninited>";
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2164
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2165 /*
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2166 * 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
2167 */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2168 enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2169 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2170 dnone, /* nothing seen */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2171 dsharpseen, /* '#' seen as first char on line */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2172 ddefineseen, /* '#' and 'define' seen */
5044
d3bd7baee39f (FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents: 4937
diff changeset
2173 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
2174 } definedef;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2175
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2176 /*
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2177 * State machine for Objective C protocols and implementations.
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
2178 * Tom R.Hageman <tom@basil.icce.rug.nl>
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2179 */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2180 enum
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2181 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2182 onone, /* nothing seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2183 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
2184 oimplementation, /* @implementations seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2185 otagseen, /* class name seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2186 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
2187 ocatseen, /* category name seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2188 oinbody, /* in @implementation body */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2189 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
2190 omethodtag, /* after method name */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2191 omethodcolon, /* after method colon */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2192 omethodparm, /* after method parameter */
14230
6b836f84bccf (enum sym_type, anonymous enum): Delete final comma.
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
2193 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
2194 } objdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2195
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2196
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2197 /*
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2198 * Use this structure to keep info about the token read, and how it
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2199 * should be tagged. Used by the make_C_tag function to build a tag.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2200 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2201 typedef struct
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2202 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2203 bool valid;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2204 char *str;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2205 bool named;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2206 int linelen;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2207 int lineno;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2208 long linepos;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2209 char *buffer;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2210 } token;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2211
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2212 token tok; /* latest token read */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2213
2323
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 * 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
2216 * 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
2217 */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2218 bool next_token_is_func;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2219
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2220 /*
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2221 * 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
2222 */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2223 bool yacc_rules;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2224
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2225 /*
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2226 * 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
2227 */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2228 int methodlen;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2229
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2230 /*
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2231 * consider_token ()
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2232 * checks to see if the current token is at the start of a
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2233 * function or variable, or corresponds to a typedef, or
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2234 * is a struct/union/enum tag, or #define, or an enum constant.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2235 *
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2236 * *IS_FUNC gets TRUE iff the token is a function or #define macro
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2237 * with args. C_EXT is which language we are looking at.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2238 *
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2239 * Globals
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2240 * fvdef IN OUT
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2241 * structdef IN OUT
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2242 * definedef IN OUT
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2243 * typdef IN OUT
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2244 * objdef IN OUT
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2245 * next_token_is_func IN OUT
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2246 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2247
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2248 bool
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2249 consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2250 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
2251 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
2252 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
2253 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
2254 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
2255 int parlev; /* IN: parenthesis level */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2256 bool *is_func_or_var; /* OUT: function or variable found */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2257 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2258 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
2259
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2260 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2261 * Advance the definedef state machine.
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2262 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2263 switch (definedef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2264 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2265 case dnone:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2266 /* 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
2267 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2268 case dsharpseen:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2269 if (toktype == st_C_define)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2270 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2271 definedef = ddefineseen;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2272 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2273 else
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2274 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2275 definedef = dignorerest;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2276 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2277 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2278 case ddefineseen:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2279 /*
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2280 * 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
2281 * and constantypedefs is FALSE.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2282 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2283 definedef = dignorerest;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2284 *is_func_or_var = (c == '(');
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2285 if (!*is_func_or_var && !constantypedefs)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2286 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2287 else
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2288 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2289 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
2290 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2291 default:
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2292 error ("internal error: definedef value.", (char *)NULL);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2293 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2294
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2295 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2296 * Now typedefs
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2297 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2298 switch (typdef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2299 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2300 case tnone:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2301 if (toktype == st_C_typedef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2302 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2303 if (typedefs)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2304 typdef = tkeyseen;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2305 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2306 fvdef = fvnone;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2307 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2308 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2309 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2310 case tkeyseen:
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2311 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2312 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2313 case st_none:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2314 case st_C_typespec:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2315 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2316 case st_C_enum:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2317 typdef = ttypeseen;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2318 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2319 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2320 /* 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
2321 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2322 case tend:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2323 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2324 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2325 case st_C_typespec:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2326 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2327 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
2328 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2329 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2330 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2331 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2332
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2333 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2334 * 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
2335 * 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
2336 * 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
2337 * within structs.
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2338 *
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2339 * 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
2340 * 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
2341 * 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
2342 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2343 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2344 {
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
2345 case st_C_javastruct:
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2346 if (structdef == stagseen)
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2347 structdef = scolonseen;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2348 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2349 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2350 case st_C_enum:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2351 if (typdef == tkeyseen
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2352 || (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
2353 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2354 structdef = skeyseen;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2355 structtype = toktype;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2356 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2357 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2358 }
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2359
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2360 if (structdef == skeyseen)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2361 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2362 /* Save the tag for struct/union/class, for functions and variables
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2363 that may be defined inside. */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2364 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
2365 structtag = savenstr (str, len);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2366 else
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2367 structtag = "<enum>";
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2368 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
2369 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2370 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2371
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2372 if (typdef != tnone)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2373 definedef = dnone;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2374
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2375 /* Detect GNU macros.
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2376
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2377 Writers of emacs code are recommended to put the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2378 first two args of a DEFUN on the same line.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2379
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2380 The DEFUN macro, used in emacs C source code, has a first arg
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2381 that is a string (the lisp function name), and a second arg that
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2382 is a C function name. Since etags skips strings, the second arg
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2383 is tagged. This is unfortunate, as it would be better to tag the
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2384 first arg. The simplest way to deal with this problem would be
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2385 to name the tag with a name built from the function name, by
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2386 removing the initial 'F' character and substituting '-' for '_'.
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2387 Anyway, this assumes that the conventions of naming lisp
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2388 functions will never change. Currently, this method is not
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2389 implemented. */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2390 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
2391 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2392 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
2393 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2394 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2395 if (next_token_is_func)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2396 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2397 next_token_is_func = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2398 fvdef = fignore;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2399 *is_func_or_var = TRUE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2400 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2401 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2402
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2403 /* Detect Objective C constructs. */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2404 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2405 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2406 case onone:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2407 switch (toktype)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2408 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2409 case st_C_objprot:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2410 objdef = oprotocol;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2411 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2412 case st_C_objimpl:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2413 objdef = oimplementation;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2414 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2415 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2416 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2417 case oimplementation:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2418 /* Save the class tag for functions or variables defined inside. */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2419 objtag = savenstr (str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2420 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2421 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2422 case oprotocol:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2423 /* 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
2424 objtag = savenstr (str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2425 objdef = otagseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2426 *is_func_or_var = TRUE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2427 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2428 case oparenseen:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2429 objdef = ocatseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2430 *is_func_or_var = TRUE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2431 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2432 case oinbody:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2433 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2434 case omethodsign:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2435 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2436 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2437 objdef = omethodtag;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2438 methodlen = len;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2439 grow_linebuffer (&token_name, methodlen + 1);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2440 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
2441 token_name.buffer[methodlen] = '\0';
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2442 token_name.len = methodlen;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2443 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2444 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2445 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2446 case omethodcolon:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2447 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2448 objdef = omethodparm;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2449 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2450 case omethodparm:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2451 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2452 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2453 objdef = omethodtag;
14144
beb39f795f21 (consider_token): Fix typo in expression.
Karl Heuer <kwzh@gnu.org>
parents: 14021
diff changeset
2454 methodlen += len;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2455 grow_linebuffer (&token_name, methodlen + 1);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2456 strncat (token_name.buffer, str, len);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2457 token_name.len = methodlen;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2458 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2459 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2460 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2461 case oignore:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2462 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
2463 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2464 /* 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
2465 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
2466 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
2467 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
2468 class tags.
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2469 free (objtag); */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2470 objdef = onone;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2471 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2472 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2473 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2474
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2475 /* A function, variable or enum constant? */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2476 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2477 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2478 case st_C_extern:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2479 fvextern = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2480 /* FALLTHRU */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2481 case st_C_typespec:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2482 if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2483 fvdef = fvnone; /* should be useless */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2484 return FALSE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2485 case st_C_ignore:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2486 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2487 fvdef = vignore;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2488 return FALSE;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2489 case st_C_operator:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2490 fvdef = foperator;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2491 *is_func_or_var = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2492 return TRUE;
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2493 case st_none:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2494 if ((c_ext & C_PLPL) && strneq (str+len-10, "::operator", 10))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2495 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2496 fvdef = foperator;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2497 *is_func_or_var = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2498 return TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2499 }
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2500 if (constantypedefs && structdef == sinbody && structtype == st_C_enum)
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2501 return TRUE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2502 if (fvdef == fvnone)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2503 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2504 fvdef = fvnameseen; /* function or variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2505 *is_func_or_var = TRUE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2506 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2507 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2508 break;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2509 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2510
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2511 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2512 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2513
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2514 /*
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2515 * C_entries ()
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2516 * This routine finds functions, variables, typedefs,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2517 * #define's, enum constants and struct/union/enum definitions in
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2518 * C syntax and adds them to the list.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2519 */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2520 #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
2521 #define switch_line_buffers() (curndx = 1 - curndx)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2522
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2523 #define curlb (lbs[curndx].lb)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2524 #define othlb (lbs[1-curndx].lb)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2525 #define newlb (lbs[newndx].lb)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2526 #define curlinepos (lbs[curndx].linepos)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2527 #define othlinepos (lbs[1-curndx].linepos)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2528 #define newlinepos (lbs[newndx].linepos)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2529
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2530 #define CNL_SAVE_DEFINEDEF() \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2531 do { \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2532 curlinepos = charno; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2533 lineno++; \
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
2534 linecharno = charno; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2535 charno += readline (&curlb, inf); \
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2536 lp = curlb.buffer; \
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2537 quotednl = FALSE; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2538 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
2539 } while (0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2540
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2541 #define CNL() \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2542 do { \
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2543 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
2544 if (savetok.valid) \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2545 { \
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2546 tok = savetok; \
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
2547 savetok.valid = FALSE; \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2548 } \
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2549 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
2550 } while (0)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2551
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2552
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2553 void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2554 make_C_tag (isfun)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2555 bool isfun;
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2556 {
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2557 /* This function should never be called when tok.valid is FALSE, but
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2558 we must protect against invalid input or internal errors. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2559 if (tok.valid)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2560 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2561 if (traditional_tag_style)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2562 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2563 /* This was the original code. Now we call new_pfnote instead,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2564 which uses the new method for naming tags (see new_pfnote). */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2565 char *name = NULL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2566
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2567 if (CTAGS || tok.named)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2568 name = savestr (token_name.buffer);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2569 pfnote (name, isfun,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2570 tok.buffer, tok.linelen, tok.lineno, tok.linepos);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2571 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2572 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2573 new_pfnote (token_name.buffer, token_name.len, isfun,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2574 tok.buffer, tok.linelen, tok.lineno, tok.linepos);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2575 tok.valid = FALSE;
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2576 }
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2577 else if (DEBUG)
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2578 abort ();
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2579 }
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2580
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2581
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2582 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2583 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
2584 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
2585 FILE *inf; /* input file */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2586 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2587 register char c; /* latest char read; '\0' for end of line */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2588 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
2589 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
2590 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
2591 register int toklen; /* length of current token */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2592 char *qualifier; /* string used to qualify names */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2593 int qlen; /* length of qualifier */
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2594 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
2595 int parlev; /* current parenthesis level */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2596 bool incomm, inquote, inchar, quotednl, midtoken;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2597 bool purec, cplpl, cjava;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2598 token savetok; /* token saved during preprocessor handling */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2599
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2600
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2601 tokoff = toklen = 0; /* keep compiler quiet */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2602 curndx = newndx = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2603 lineno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2604 charno = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2605 lp = curlb.buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2606 *lp = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2607
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2608 fvdef = fvnone; fvextern = FALSE; typdef = tnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2609 structdef = snone; 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
2610 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
2611 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
2612 tok.valid = savetok.valid = FALSE;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2613 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
2614 parlev = 0;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2615 purec = !(c_ext & ~YACC); /* no extensions (apart from possibly yacc) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2616 cplpl = (c_ext & C_PLPL) == C_PLPL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2617 cjava = (c_ext & C_JAVA) == C_JAVA;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2618 if (cjava)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2619 { qualifier = "."; qlen = 1; }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2620 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2621 { qualifier = "::"; qlen = 2; }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2622
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2623 while (!feof (inf))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2624 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2625 c = *lp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2626 if (c == '\\')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2627 {
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
2628 /* If we're at the end of the line, the next character is a
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
2629 '\0'; don't skip it, because it's the thing that tells us
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
2630 to read the next line. */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2631 if (*lp == '\0')
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2632 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2633 quotednl = TRUE;
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2634 continue;
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2635 }
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
2636 lp++;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2637 c = ' ';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2638 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2639 else if (incomm)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2640 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2641 switch (c)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2642 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2643 case '*':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2644 if (*lp == '/')
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2645 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2646 c = *lp++;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2647 incomm = FALSE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2648 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2649 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2650 case '\0':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2651 /* 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
2652 traditional cpp. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2653 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2654 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2655 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2656 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2657 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2658 else if (inquote)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2659 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2660 switch (c)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2661 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2662 case '"':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2663 inquote = FALSE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2664 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2665 case '\0':
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2666 /* 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
2667 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
2668 usually accept them. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2669 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2670 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2671 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2672 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2673 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2674 else if (inchar)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2675 {
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2676 switch (c)
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2677 {
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2678 case '\0':
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2679 /* Hmmm, something went wrong. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2680 CNL ();
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2681 /* FALLTHRU */
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2682 case '\'':
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2683 inchar = FALSE;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2684 break;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2685 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2686 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2687 }
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
2688 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2689 switch (c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2690 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2691 case '"':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2692 inquote = TRUE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2693 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2694 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2695 fvextern = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2696 fvdef = fvnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2697 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2698 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2699 case '\'':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2700 inchar = TRUE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2701 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2702 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2703 fvextern = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2704 fvdef = fvnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2705 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2706 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2707 case '/':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2708 if (*lp == '*')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2709 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2710 lp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2711 incomm = TRUE;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2712 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2713 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2714 else if (/* cplpl && */ *lp == '/')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2715 {
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2716 c = '\0';
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 621
diff changeset
2717 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2718 }
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
2719 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
2720 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2721 case '%':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2722 if ((c_ext & YACC) && *lp == '%')
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2723 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2724 /* 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
2725 lp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2726 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2727 typdef = tnone; structdef = snone;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2728 next_token_is_func = FALSE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2729 midtoken = inquote = inchar = incomm = quotednl = FALSE;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2730 cblev = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2731 yacc_rules = !yacc_rules;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2732 continue;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2733 }
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
2734 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
2735 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2736 case '#':
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2737 if (definedef == dnone)
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2738 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2739 char *cp;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2740 bool cpptoken = TRUE;
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2741
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2742 /* 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
2743 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
2744 token. */
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2745 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
2746 if (!iswhite (*cp))
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2747 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2748 if (*cp == '*' && *(cp+1) == '/')
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2749 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2750 cp++;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2751 cpptoken = TRUE;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2752 }
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2753 else
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2754 cpptoken = FALSE;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2755 }
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2756 if (cpptoken)
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2757 definedef = dsharpseen;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2758 } /* if (definedef == dnone) */
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2759
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2760 continue;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2761 } /* switch (c) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2762
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2763
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2764 /* 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
2765 if ((definedef != dnone
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2766 || (cblev == 0 && structdef != scolonseen)
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2767 || (cblev == 1 && cplpl && structdef == sinbody)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2768 || (structdef == sinbody && purec))
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2769 && typdef != tignore
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2770 && definedef != dignorerest
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2771 && fvdef != finlist)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2772 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2773 if (midtoken)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2774 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2775 if (endtoken (c))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2776 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2777 bool funorvar = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2778
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2779 if (c == ':' && cplpl && *lp == ':' && begtoken (lp[1]))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2780 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2781 /*
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2782 * This handles :: in the middle, but not at the
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2783 * beginning of an identifier. Also, space-separated
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2784 * :: is not recognised.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2785 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2786 lp += 2;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2787 toklen += 2;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2788 c = lp[-1];
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2789 goto intoken;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2790 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2791 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2792 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2793 if (yacc_rules
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2794 || consider_token (newlb.buffer + tokoff, toklen, c,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2795 c_ext, cblev, parlev, &funorvar))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2796 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2797 if (fvdef == foperator)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2798 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2799 char *oldlp = lp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2800 lp = skip_spaces (lp-1);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2801 if (*lp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2802 lp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2803 while (*lp != '\0'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2804 && !isspace (*lp) && *lp != '(')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2805 lp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2806 c = *lp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2807 toklen += lp - oldlp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2808 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2809 tok.named = FALSE;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2810 if (!purec
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2811 && funorvar
4750
cdefe4f21650 Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents: 4696
diff changeset
2812 && definedef == dnone
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2813 && structdef == sinbody)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2814 /* function or var defined in C++ class body */
4750
cdefe4f21650 Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents: 4696
diff changeset
2815 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2816 int len = strlen (structtag) + qlen + toklen;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2817 grow_linebuffer (&token_name, len + 1);
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
2818 strcpy (token_name.buffer, structtag);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2819 strcat (token_name.buffer, qualifier);
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
2820 strncat (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2821 newlb.buffer + tokoff, toklen);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2822 token_name.len = len;
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2823 tok.named = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2824 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2825 else if (objdef == ocatseen)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2826 /* Objective C category */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2827 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2828 int len = strlen (objtag) + 2 + toklen;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2829 grow_linebuffer (&token_name, len + 1);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2830 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
2831 strcat (token_name.buffer, "(");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2832 strncat (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2833 newlb.buffer + tokoff, toklen);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2834 strcat (token_name.buffer, ")");
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2835 token_name.len = len;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2836 tok.named = TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2837 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2838 else if (objdef == omethodtag
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2839 || objdef == omethodparm)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2840 /* Objective C method */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2841 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2842 tok.named = TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2843 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2844 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2845 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2846 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
2847 strncpy (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2848 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
2849 token_name.buffer[toklen] = '\0';
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2850 token_name.len = toklen;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2851 /* Name macros and members. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2852 tok.named = (structdef == stagseen
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2853 || typdef == ttypeseen
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2854 || typdef == tend
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2855 || (funorvar
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2856 && definedef == dignorerest)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2857 || (funorvar
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2858 && definedef == dnone
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2859 && structdef == sinbody));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2860 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2861 tok.lineno = lineno;
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2862 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
2863 tok.buffer = newlb.buffer;
cd1c0b5e8634 * etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents: 10623
diff changeset
2864 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
2865 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
2866
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
2867 if (definedef == dnone
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2868 && (fvdef == fvnameseen
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2869 || fvdef == foperator
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2870 || structdef == stagseen
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2871 || typdef == tend
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2872 || objdef != onone))
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2873 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2874 if (current_lb_is_new)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2875 switch_line_buffers ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2876 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2877 else
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2878 make_C_tag (funorvar);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2879 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2880 midtoken = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2881 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2882 } /* if (endtoken (c)) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2883 else if (intoken (c))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2884 intoken:
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2885 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2886 toklen++;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2887 continue;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2888 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2889 } /* if (midtoken) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2890 else if (begtoken (c))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2891 {
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
2892 switch (definedef)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2893 {
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
2894 case dnone:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2895 switch (fvdef)
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2896 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2897 case fstartlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2898 fvdef = finlist;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2899 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
2900 case flistseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2901 make_C_tag (TRUE); /* a function */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2902 fvdef = fignore;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2903 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2904 case fvnameseen:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2905 fvdef = fvnone;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2906 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
2907 }
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2908 if (structdef == stagseen && !cjava)
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
2909 structdef = snone;
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
2910 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
2911 case dsharpseen:
10623
8a73e71a55e3 * etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents: 10449
diff changeset
2912 savetok = tok;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2913 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2914 if (!yacc_rules || lp == newlb.buffer + 1)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2915 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2916 tokoff = lp - 1 - newlb.buffer;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2917 toklen = 1;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2918 midtoken = TRUE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2919 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2920 continue;
10623
8a73e71a55e3 * etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents: 10449
diff changeset
2921 } /* if (begtoken) */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2922 } /* if must look at token */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2923
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2924
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2925 /* 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
2926 after having handled a token.*/
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2927 switch (c)
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
2928 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2929 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
2930 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
2931 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2932 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2933 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2934 case otagseen:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2935 objdef = oignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2936 make_C_tag (TRUE); /* an Objective C class */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2937 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2938 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2939 case omethodparm:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2940 objdef = omethodcolon;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2941 methodlen += 1;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2942 grow_linebuffer (&token_name, methodlen + 1);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2943 strcat (token_name.buffer, ":");
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2944 token_name.len = methodlen;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2945 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2946 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2947 if (structdef == stagseen)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2948 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
2949 else
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2950 switch (fvdef)
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2951 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2952 case fvnameseen:
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
2953 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
2954 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2955 make_C_tag (FALSE); /* a yacc function */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2956 fvdef = fignore;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2957 }
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2958 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
2959 case fstartlist:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2960 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2961 fvdef = fvnone;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
2962 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
2963 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2964 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2965 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
2966 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
2967 break;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2968 if (cblev == 0)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2969 switch (typdef)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2970 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2971 case tend:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2972 make_C_tag (FALSE); /* a typedef */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2973 /* FALLTHRU */
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2974 default:
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2975 typdef = tnone;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2976 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2977 switch (fvdef)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
2978 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2979 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2980 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2981 case fvnameseen:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2982 if ((members && cblev == 1)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2983 || (globals && cblev == 0 && (!fvextern || declarations)))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2984 make_C_tag (FALSE); /* a variable */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2985 fvextern = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2986 fvdef = fvnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2987 tok.valid = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2988 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2989 case flistseen:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2990 if (declarations && (cblev == 0 || cblev == 1))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2991 make_C_tag (TRUE); /* a function declaration */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2992 /* FALLTHRU */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2993 default:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2994 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2995 fvdef = fvnone;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
2996 /* 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
2997 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
2998 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
2999 tok.valid = FALSE;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3000 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3001 if (structdef == stagseen)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3002 structdef = snone;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3003 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3004 case ',':
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3005 if (definedef != dnone)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3006 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3007 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3008 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3009 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3010 case omethodparm:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3011 make_C_tag (TRUE); /* an Objective C method */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3012 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3013 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3014 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3015 switch (fvdef)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3016 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3017 case foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3018 case finlist:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3019 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3020 case vignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3021 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3022 case fvnameseen:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3023 if ((members && cblev == 1)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3024 || (globals && cblev == 0 && (!fvextern || declarations)))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3025 make_C_tag (FALSE); /* a variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3026 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3027 default:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3028 fvdef = fvnone;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3029 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3030 if (structdef == stagseen)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3031 structdef = snone;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3032 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3033 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
3034 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
3035 break;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3036 if (cblev == 0 && typdef == tend)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3037 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3038 typdef = tignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3039 make_C_tag (FALSE); /* a typedef */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3040 break;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3041 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3042 switch (fvdef)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3043 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3044 case foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3045 case finlist:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3046 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3047 case vignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3048 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3049 case fvnameseen:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3050 if ((members && cblev == 1)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3051 || (globals && cblev == 0 && (!fvextern || declarations)))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3052 make_C_tag (FALSE); /* a variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3053 /* FALLTHRU */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3054 default:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3055 fvdef = fvnone;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3056 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3057 if (structdef == stagseen)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3058 structdef = snone;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3059 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3060 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
3061 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
3062 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3063 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
3064 objdef = oparenseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3065 switch (fvdef)
1938
1045deef809f (C_entries): Don't reset definedef when a newline inside a comment is met.
Richard M. Stallman <rms@gnu.org>
parents: 1796
diff changeset
3066 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3067 case fvnameseen:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3068 if (typdef == ttypeseen
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3069 && tok.valid
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3070 && *lp != '*'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3071 && structdef != sinbody)
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3072 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3073 /* This handles constructs like:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3074 typedef void OperatorFun (int fun); */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3075 make_C_tag (FALSE);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3076 typdef = tignore;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3077 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3078 /* FALLTHRU */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3079 case foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3080 fvdef = fstartlist;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3081 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3082 case flistseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3083 fvdef = finlist;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3084 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
3085 }
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
3086 parlev++;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3087 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3088 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
3089 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
3090 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3091 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
3092 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3093 make_C_tag (TRUE); /* an Objective C category */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3094 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3095 }
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
3096 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
3097 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3098 switch (fvdef)
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3099 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3100 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
3101 case finlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3102 fvdef = flistseen;
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3103 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
3104 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3105 if (cblev == 0 && (typdef == tend))
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3106 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3107 typdef = tignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3108 make_C_tag (FALSE); /* a typedef */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3109 }
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
3110 }
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3111 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
3112 parlev = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3113 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3114 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
3115 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
3116 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3117 if (typdef == ttypeseen)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3118 typdef = tinbody;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3119 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
3120 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3121 case skeyseen: /* unnamed struct */
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
3122 structdef = sinbody;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3123 structtag = "_anonymous_";
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3124 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3125 case stagseen:
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3126 case scolonseen: /* named struct */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3127 structdef = sinbody;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3128 make_C_tag (FALSE); /* a struct */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3129 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
3130 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3131 switch (fvdef)
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3132 {
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3133 case flistseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3134 make_C_tag (TRUE); /* a function */
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3135 /* FALLTHRU */
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3136 case fignore:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3137 fvdef = fvnone;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3138 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3139 case fvnone:
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3140 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3141 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3142 case otagseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3143 make_C_tag (TRUE); /* an Objective C class */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3144 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3145 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3146 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3147 case omethodparm:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3148 make_C_tag (TRUE); /* an Objective C method */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3149 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3150 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3151 default:
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
3152 /* Neutralize `extern "C" {' grot. */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3153 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
3154 cblev = -1;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3155 }
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3156 }
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3157 cblev++;
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3158 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3159 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
3160 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
3161 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3162 if (fvdef == fstartlist)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3163 fvdef = fvnone; /* avoid tagging `foo' in `foo (*bar()) ()' */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3164 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3165 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
3166 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
3167 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3168 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
3169 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3170 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
3171 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
3172 }
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3173 else if (cblev > 0)
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3174 cblev--;
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3175 if (cblev == 0)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3176 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3177 if (typdef == tinbody)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3178 typdef = tend;
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
3179 /* 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
3180 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
3181 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
3182 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
3183 struct tags.
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
3184 if (structdef == sinbody)
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
3185 free (structtag); */
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
3186
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3187 structdef = snone;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3188 structtag = "<error>";
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3189 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3190 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3191 case '=':
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3192 if (definedef != dnone)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3193 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3194 switch (fvdef)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3195 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3196 case foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3197 case finlist:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3198 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3199 case vignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3200 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3201 case fvnameseen:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3202 if ((members && cblev == 1)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3203 || (globals && cblev == 0 && (!fvextern || declarations)))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3204 make_C_tag (FALSE); /* a variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3205 /* FALLTHRU */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3206 default:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3207 fvdef = vignore;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3208 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3209 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3210 case '+':
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3211 case '-':
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3212 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
3213 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3214 objdef = omethodsign;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3215 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3216 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3217 /* FALLTHRU */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3218 case '#': case '~': case '&': case '%': case '/': case '|':
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3219 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
3220 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
3221 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3222 /* These surely cannot follow a function tag in C. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3223 switch (fvdef)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3224 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3225 case foperator:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3226 case finlist:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3227 case fignore:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3228 case vignore:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3229 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3230 default:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3231 fvdef = fvnone;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3232 }
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
3233 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3234 case '\0':
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3235 if (objdef == otagseen)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3236 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3237 make_C_tag (TRUE); /* an Objective C class */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3238 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3239 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3240 /* 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
3241 if (quotednl)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3242 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3243 else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3244 CNL ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3245 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3246 } /* switch (c) */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3247
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3248 } /* while not eof */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3249 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3250
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3251 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3252 * 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
3253 * 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
3254 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3255 void
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3256 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
3257 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3258 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3259 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
3260 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3261
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3262 /* Always do plain ANSI C. */
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3263 void
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3264 plain_C_entries (inf)
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3265 FILE *inf;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3266 {
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3267 C_entries (0, inf);
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3268 }
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3269
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3270 /* 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
3271 void
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3272 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
3273 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3274 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3275 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
3276 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3277
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3278 /* Always do Java. */
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3279 void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3280 Cjava_entries (inf)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3281 FILE *inf;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3282 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3283 C_entries (C_JAVA, inf);
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3284 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3285
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3286 /* 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
3287 void
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3288 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
3289 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3290 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3291 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
3292 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3293
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3294 /* 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
3295 void
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3296 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
3297 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3298 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3299 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
3300 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3301
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3302 /* A useful macro. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3303 #define LOOP_ON_INPUT_LINES(file_pointer, line_buffer, char_pointer) \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3304 for (lineno = charno = 0; /* loop initialization */ \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3305 !feof (file_pointer) /* loop test */ \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3306 && (lineno++, /* instructions at start of loop */ \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3307 linecharno = charno, \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3308 charno += readline (&line_buffer, file_pointer), \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3309 char_pointer = lb.buffer, \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3310 TRUE); \
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3311 )
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3312
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3313
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3314 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3315 * Read a file, but do no processing. This is used to do regexp
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3316 * matching on files that have no language defined.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3317 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3318 void
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3319 just_read_file (inf)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3320 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3321 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3322 register char *dummy;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3323
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3324 LOOP_ON_INPUT_LINES (inf, lb, dummy)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3325 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3326 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3327
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3328 /* Fortran parsing */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3329
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3330 bool
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3331 tail (cp)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3332 char *cp;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3333 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3334 register int len = 0;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3335
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3336 while (*cp != '\0' && lowcase (*cp) == lowcase (dbp[len]))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3337 cp++, len++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3338 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
3339 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3340 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
3341 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3342 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3343 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3344 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3345
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3346 void
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3347 takeprec ()
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3348 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3349 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3350 if (*dbp != '*')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3351 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3352 dbp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3353 dbp = skip_spaces (dbp);
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3354 if (strneq (dbp, "(*)", 3))
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3355 {
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3356 dbp += 3;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3357 return;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3358 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3359 if (!isdigit (*dbp))
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3360 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3361 --dbp; /* force failure */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3362 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3363 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3364 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3365 dbp++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3366 while (isdigit (*dbp));
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3367 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3368
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3369 void
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3370 getit (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3371 FILE *inf;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3372 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3373 register char *cp;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3374
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3375 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3376 if (*dbp == '\0')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3377 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3378 lineno++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3379 linecharno = charno;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3380 charno += readline (&lb, inf);
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3381 dbp = lb.buffer;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3382 if (dbp[5] != '&')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3383 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3384 dbp += 6;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3385 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3386 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3387 if (!isalpha (*dbp) && *dbp != '_' && *dbp != '$')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3388 return;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3389 for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3390 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3391 pfnote (savenstr (dbp, cp-dbp), TRUE,
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3392 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
3393 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3394
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3395
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3396 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3397 Fortran_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3398 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3399 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3400 LOOP_ON_INPUT_LINES (inf, lb, dbp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3401 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3402 if (*dbp == '%')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3403 dbp++; /* Ratfor escape to fortran */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3404 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3405 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3406 continue;
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3407 switch (lowcase (*dbp))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3408 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3409 case 'i':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3410 if (tail ("integer"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3411 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3412 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3413 case 'r':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3414 if (tail ("real"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3415 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3416 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3417 case 'l':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3418 if (tail ("logical"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3419 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3420 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3421 case 'c':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3422 if (tail ("complex") || tail ("character"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3423 takeprec ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3424 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3425 case 'd':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3426 if (tail ("double"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3427 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3428 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3429 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3430 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3431 if (tail ("precision"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3432 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3433 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3434 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3435 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3436 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3437 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3438 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3439 continue;
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3440 switch (lowcase (*dbp))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3441 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3442 case 'f':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3443 if (tail ("function"))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3444 getit (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3445 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3446 case 's':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3447 if (tail ("subroutine"))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3448 getit (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3449 continue;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3450 case 'e':
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3451 if (tail ("entry"))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3452 getit (inf);
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3453 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3454 case 'b':
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3455 if (tail ("blockdata") || tail ("block data"))
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3456 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3457 dbp = skip_spaces (dbp);
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3458 if (*dbp == '\0') /* assume un-named */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3459 pfnote (savestr ("blockdata"), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3460 lb.buffer, dbp - lb.buffer, lineno, linecharno);
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3461 else
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3462 getit (inf); /* look for name */
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3463 }
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3464 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3465 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3466 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3467 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3468
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3469 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3470 * Philippe Waroquiers <philippe.waroquiers@eurocontrol.be>, 1998-04-24
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3471 * Ada parsing
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3472 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3473 /* Once we are positioned after an "interesting" keyword, let's get
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3474 the real tag value necessary. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3475 void
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3476 adagetit (inf, name_qualifier)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3477 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3478 char *name_qualifier;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3479 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3480 register char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3481 char *name;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3482 char c;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3483
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3484 while (!feof (inf))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3485 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3486 dbp = skip_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3487 if (*dbp == '\0'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3488 || (dbp[0] == '-' && dbp[1] == '-'))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3489 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3490 lineno++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3491 linecharno = charno;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3492 charno += readline (&lb, inf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3493 dbp = lb.buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3494 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3495 switch (*dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3496 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3497 case 'b':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3498 case 'B':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3499 if (tail ("body"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3500 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3501 /* Skipping body of procedure body or package body or ....
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3502 resetting qualifier to body instead of spec. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3503 name_qualifier = "/b";
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3504 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3505 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3506 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3507 case 't':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3508 case 'T':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3509 /* Skipping type of task type or protected type ... */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3510 if (tail ("type"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3511 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3512 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3513 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3514 if (*dbp == '"')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3515 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3516 dbp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3517 for (cp = dbp; *cp != '\0' && *cp != '"'; cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3518 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3519 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3520 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3521 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3522 dbp = skip_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3523 for (cp = dbp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3524 (*cp != '\0'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3525 && (isalpha (*cp) || isdigit (*cp) || *cp == '_' || *cp == '.'));
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3526 cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3527 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3528 if (cp == dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3529 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3530 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3531 c = *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3532 *cp = '\0';
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3533 name = concat (dbp, name_qualifier, "");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3534 *cp = c;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3535 pfnote (name, TRUE, lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3536 if (c == '"')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3537 dbp = cp + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3538 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3539 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3540 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3541
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3542 void
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3543 Ada_funcs (inf)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3544 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3545 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3546 bool inquote = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3547
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3548 LOOP_ON_INPUT_LINES (inf, lb, dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3549 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3550 while (*dbp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3551 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3552 /* Skip a string i.e. "abcd". */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3553 if (inquote || (*dbp == '"'))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3554 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3555 dbp = etags_strchr ((inquote) ? dbp : dbp+1, '"');
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3556 if (dbp != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3557 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3558 inquote = FALSE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3559 dbp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3560 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3561 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3562 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3563 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3564 inquote = TRUE;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3565 break; /* advance line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3566 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3567 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3568
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3569 /* Skip comments. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3570 if (dbp[0] == '-' && dbp[1] == '-')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3571 break; /* advance line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3572
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3573 /* Skip character enclosed in single quote i.e. 'a'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3574 and skip single quote starting an attribute i.e. 'Image. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3575 if (*dbp == '\'')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3576 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3577 dbp++ ;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3578 if (*dbp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3579 dbp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3580 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3581 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3582
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3583 /* Search for beginning of a token. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3584 if (!begtoken (*dbp))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3585 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3586 dbp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3587 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3588 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3589
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3590 /* We are at the beginning of a token. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3591 switch (*dbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3592 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3593 case 'f':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3594 case 'F':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3595 if (!packages_only && tail ("function"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3596 adagetit (inf, "/f");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3597 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3598 break; /* from switch */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3599 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3600 case 'p':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3601 case 'P':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3602 if (!packages_only && tail ("procedure"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3603 adagetit (inf, "/p");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3604 else if (tail ("package"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3605 adagetit (inf, "/s");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3606 else if (tail ("protected")) /* protected type */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3607 adagetit (inf, "/t");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3608 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3609 break; /* from switch */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3610 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3611 case 't':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3612 case 'T':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3613 if (!packages_only && tail ("task"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3614 adagetit (inf, "/k");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3615 else if (typedefs && !packages_only && tail ("type"))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3616 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3617 adagetit (inf, "/t");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3618 while (*dbp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3619 dbp += 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3620 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3621 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3622 break; /* from switch */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3623 continue; /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3624 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3625
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3626 /* Look for the end of the token. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3627 while (!endtoken (*dbp))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3628 dbp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3629
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3630 } /* advance char */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3631 } /* advance line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3632 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3633
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3634 /*
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3635 * 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
3636 * Unix and microcontroller assembly tag handling
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3637 * 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
3638 */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3639 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3640 Asm_labels (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3641 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3642 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3643 register char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3644
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3645 LOOP_ON_INPUT_LINES (inf, lb, cp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3646 {
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3647 /* 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
3648 following identifier. */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3649 if (isalpha (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3650 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3651 /* Read past label. */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3652 cp++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3653 while (isalnum (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3654 cp++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3655 if (*cp == ':' || isspace (*cp))
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3656 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3657 /* Found end of label, so copy it and add it to the table. */
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3658 pfnote (savenstr(lb.buffer, cp-lb.buffer), TRUE,
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3659 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
3660 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3661 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3662 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3663 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3664
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3665 /*
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3666 * Perl support by Bart Robinson <lomew@cs.utah.edu>
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3667 * enhanced by Michael Ernst <mernst@alum.mit.edu>
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3668 * Perl sub names: look for /^sub[ \t\n]+[^ \t\n{]+/
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3669 * Perl variable names: /^(my|local).../
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3670 */
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3671 void
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3672 Perl_functions (inf)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3673 FILE *inf;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3674 {
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3675 register char *cp;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3676
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3677 LOOP_ON_INPUT_LINES (inf, lb, cp)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3678 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3679 if (*cp++ == 's'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3680 && *cp++ == 'u'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3681 && *cp++ == 'b' && isspace (*cp++))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3682 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3683 cp = skip_spaces (cp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3684 if (*cp != '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3685 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3686 char *sp = cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3687 while (*cp != '\0'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3688 && !isspace (*cp) && *cp != '{' && *cp != '(')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3689 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3690 pfnote (savenstr (sp, cp-sp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3691 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3692 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3693 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3694 else if (globals /* only if tagging global vars is enabled */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3695 && ((cp = lb.buffer,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3696 *cp++ == 'm'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3697 && *cp++ == 'y')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3698 || (cp = lb.buffer,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3699 *cp++ == 'l'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3700 && *cp++ == 'o'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3701 && *cp++ == 'c'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3702 && *cp++ == 'a'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3703 && *cp++ == 'l'))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3704 && (*cp == '(' || isspace (*cp)))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3705 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3706 /* After "my" or "local", but before any following paren or space. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3707 char *varname = NULL;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3708
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3709 cp = skip_spaces (cp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3710 if (*cp == '$' || *cp == '@' || *cp == '%')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3711 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3712 char* varstart = ++cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3713 while (isalnum (*cp) || *cp == '_')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3714 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3715 varname = savenstr (varstart, cp-varstart);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3716 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3717 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3718 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3719 /* Should be examining a variable list at this point;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3720 could insist on seeing an open parenthesis. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3721 while (*cp != '\0' && *cp != ';' && *cp != '=' && *cp != ')')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3722 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3723 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3724
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3725 /* Perhaps I should back cp up one character, so the TAGS table
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3726 doesn't mention (and so depend upon) the following char. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3727 pfnote ((CTAGS) ? savenstr (lb.buffer, cp-lb.buffer) : varname,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3728 FALSE, lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3729 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3730 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3731 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3732
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3733 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3734 * Python support by Eric S. Raymond <esr@thyrsus.com>
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3735 * Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3736 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3737 void
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3738 Python_functions (inf)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3739 FILE *inf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3740 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3741 register char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3742
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3743 LOOP_ON_INPUT_LINES (inf, lb, cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3744 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3745 if (*cp++ == 'd'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3746 && *cp++ == 'e'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3747 && *cp++ == 'f' && isspace (*cp++))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3748 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3749 cp = skip_spaces (cp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3750 while (*cp != '\0' && !isspace (*cp) && *cp != '(' && *cp != ':')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3751 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3752 pfnote (NULL, TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3753 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3754 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3755
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3756 cp = lb.buffer;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3757 if (*cp++ == 'c'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3758 && *cp++ == 'l'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3759 && *cp++ == 'a'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3760 && *cp++ == 's'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3761 && *cp++ == 's' && isspace (*cp++))
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3762 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3763 cp = skip_spaces (cp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3764 while (*cp != '\0' && !isspace (*cp) && *cp != '(' && *cp != ':')
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3765 cp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3766 pfnote (NULL, TRUE,
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3767 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
3768 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3769 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3770 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3771
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3772 /* Idea by Corny de Souza
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3773 * Cobol tag functions
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3774 * We could look for anything that could be a paragraph name.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3775 * i.e. anything that starts in column 8 is one word and ends in a full stop.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3776 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3777 void
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3778 Cobol_paragraphs (inf)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3779 FILE *inf;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3780 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3781 register char *bp, *ep;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3782
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3783 LOOP_ON_INPUT_LINES (inf, lb, bp)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3784 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3785 if (lb.len < 9)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3786 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3787 bp += 8;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3788
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3789 /* If eoln, compiler option or comment ignore whole line. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3790 if (bp[-1] != ' ' || !isalnum (bp[0]))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3791 continue;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3792
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3793 for (ep = bp; isalnum (*ep) || *ep == '-'; ep++)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3794 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3795 if (*ep++ == '.')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3796 pfnote (savenstr (bp, ep-bp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3797 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3798 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3799 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3800
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3801 /* Added by Mosur Mohan, 4/22/88 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3802 /* Pascal parsing */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3803
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
3804 /*
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
3805 * 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
3806 * 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
3807 * "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
3808 * the tag is skipped.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3809 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3810 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3811 Pascal_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3812 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3813 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3814 linebuffer tline; /* mostly copied from C_entries */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3815 long save_lcno;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3816 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
3817 char c, *cp, *namebuf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3818
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3819 bool /* each of these flags is TRUE iff: */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3820 incomment, /* point is inside a comment */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3821 inquote, /* point is inside '..' string */
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3822 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
3823 keyword, so next item = potential tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3824 found_tag, /* point is after a potential tag */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3825 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
3826 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
3827 next token will determine whether this
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3828 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
3829 whether it is a real tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3830
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3831 save_lcno = save_lineno = save_len = 0; /* keep compiler quiet */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3832 namebuf = NULL; /* keep compiler quiet */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3833 lineno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3834 charno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3835 dbp = lb.buffer;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3836 *dbp = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3837 initbuffer (&tline);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3838
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3839 incomment = inquote = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3840 found_tag = FALSE; /* have a proc name; check if extern */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3841 get_tagname = FALSE; /* have found "procedure" keyword */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3842 inparms = FALSE; /* found '(' after "proc" */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3843 verify_tag = FALSE; /* check if "extern" is ahead */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3844
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3845
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3846 while (!feof (inf)) /* long main loop to get next char */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3847 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3848 c = *dbp++;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3849 if (c == '\0') /* if end of line */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3850 {
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
3851 lineno++;
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
3852 linecharno = charno;
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
3853 charno += readline (&lb, inf);
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
3854 dbp = lb.buffer;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3855 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3856 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3857 if (!((found_tag && verify_tag)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3858 || get_tagname))
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3859 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
3860 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
3861 the procedure or function */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3862 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3863 if (incomment)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3864 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3865 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
3866 incomment = FALSE;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3867 else if (c == '*' && *dbp == ')') /* within (* *) comments */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3868 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3869 dbp++;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3870 incomment = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3871 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3872 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3873 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3874 else if (inquote)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3875 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3876 if (c == '\'')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3877 inquote = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3878 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3879 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3880 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3881 switch (c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3882 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3883 case '\'':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3884 inquote = TRUE; /* found first quote */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3885 continue;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3886 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
3887 incomment = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3888 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3889 case '(':
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3890 if (*dbp == '*') /* found open (* comment */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3891 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3892 incomment = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3893 dbp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3894 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3895 else if (found_tag) /* found '(' after tag, i.e., parm-list */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3896 inparms = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3897 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3898 case ')': /* end of parms list */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3899 if (inparms)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3900 inparms = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3901 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3902 case ';':
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3903 if (found_tag && !inparms) /* end of proc or fn stmt */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3904 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3905 verify_tag = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3906 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3907 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3908 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3909 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3910 if (found_tag && verify_tag && (*dbp != ' '))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3911 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3912 /* 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
3913 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3914 continue;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3915 if (lowcase (*dbp == 'e'))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3916 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3917 if (tail ("extern")) /* superfluous, really! */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3918 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3919 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3920 verify_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3921 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3922 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3923 else if (lowcase (*dbp) == 'f')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3924 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3925 if (tail ("forward")) /* check for forward reference */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3926 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3927 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3928 verify_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3929 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3930 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3931 if (found_tag && verify_tag) /* not external proc, so make tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3932 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3933 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3934 verify_tag = FALSE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3935 pfnote (namebuf, TRUE,
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3936 tline.buffer, save_len, save_lineno, save_lcno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3937 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3938 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3939 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3940 if (get_tagname) /* grab name of proc or fn */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3941 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3942 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3943 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3944
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3945 /* save all values for later tagging */
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
3946 grow_linebuffer (&tline, lb.len + 1);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3947 strcpy (tline.buffer, lb.buffer);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3948 save_lineno = lineno;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3949 save_lcno = linecharno;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3950
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3951 /* grab block name */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3952 for (cp = dbp + 1; *cp != '\0' && !endtoken (*cp); cp++)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3953 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3954 namebuf = savenstr (dbp, cp-dbp);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3955 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
3956 save_len = dbp - lb.buffer + 1;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3957 get_tagname = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3958 found_tag = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3959 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3960
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3961 /* and proceed to check for "extern" */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3962 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3963 else if (!incomment && !inquote && !found_tag)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3964 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3965 /* check for proc/fn keywords */
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3966 switch (lowcase (c))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3967 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3968 case 'p':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3969 if (tail ("rocedure")) /* c = 'p', dbp has advanced */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3970 get_tagname = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3971 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3972 case 'f':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3973 if (tail ("unction"))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3974 get_tagname = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3975 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3976 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3977 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3978 } /* while not eof */
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
3979
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3980 free (tline.buffer);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3981 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3982
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3983 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3984 * lisp tag functions
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3985 * look for (def or (DEF, quote or QUOTE
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3986 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3987 int
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3988 L_isdef (strp)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3989 register char *strp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3990 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3991 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
3992 && (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
3993 && (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
3994 }
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3995
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3996 int
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3997 L_isquote (strp)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3998 register char *strp;
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3999 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4000 return ((*++strp == 'q' || *strp == 'Q')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4001 && (*++strp == 'u' || *strp == 'U')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4002 && (*++strp == 'o' || *strp == 'O')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4003 && (*++strp == 't' || *strp == 'T')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4004 && (*++strp == 'e' || *strp == 'E')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4005 && isspace (*++strp));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4006 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4007
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4008 void
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4009 L_getit ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4010 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4011 register char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4012
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4013 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
4014 dbp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4015 else if (*dbp == '(')
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4016 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4017 if (L_isquote (dbp))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4018 dbp += 7; /* Skip "(quote " */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4019 else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4020 dbp += 1; /* Skip "(" before name in (defstruct (foo)) */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4021 dbp = skip_spaces (dbp);
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4022 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4023
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4024 for (cp = dbp /*+1*/;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4025 *cp != '\0' && *cp != '(' && !isspace(*cp) && *cp != ')';
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4026 cp++)
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4027 continue;
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4028 if (cp == dbp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4029 return;
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4030
20071
dd3a2332a66f (L_getit): Always make named tags so that Emacs
Karl Heuer <kwzh@gnu.org>
parents: 19185
diff changeset
4031 pfnote (savenstr (dbp, cp-dbp), TRUE,
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
4032 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4033 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4034
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4035 void
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4036 Lisp_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4037 FILE *inf;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4038 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4039 LOOP_ON_INPUT_LINES (inf, lb, dbp)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4040 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4041 if (dbp[0] == '(')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4042 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4043 if (L_isdef (dbp))
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4044 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4045 dbp = skip_non_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4046 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4047 L_getit ();
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4048 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4049 else
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4050 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4051 /* Check for (foo::defmumble name-defined ... */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4052 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4053 dbp++;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4054 while (*dbp != '\0' && !isspace (*dbp)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4055 && *dbp != ':' && *dbp != '(' && *dbp != ')');
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4056 if (*dbp == ':')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4057 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4058 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4059 dbp++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4060 while (*dbp == ':');
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4061
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4062 if (L_isdef (dbp - 1))
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4063 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4064 dbp = skip_non_spaces (dbp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4065 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4066 L_getit ();
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4067 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4068 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4069 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4070 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4071 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4072 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4073
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4074 /*
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4075 * Postscript tag functions
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4076 * Just look for lines where the first character is '/'
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
4077 * Richard Mlynarik <mly@adoc.xerox.com>
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4078 * Also look at "defineps" for PSWrap
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4079 * suggested by Masatake YAMATO <masata-y@is.aist-nara.ac.jp>
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4080 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4081 void
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4082 Postscript_functions (inf)
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4083 FILE *inf;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4084 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4085 register char *bp, *ep;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4086
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4087 LOOP_ON_INPUT_LINES (inf, lb, bp)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4088 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4089 if (bp[0] == '/')
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4090 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4091 for (ep = bp+1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4092 *ep != '\0' && *ep != ' ' && *ep != '{';
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4093 ep++)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4094 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4095 pfnote (savenstr (bp, ep-bp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4096 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4097 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4098 else if (strneq (bp, "defineps", 8))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4099 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4100 bp = skip_non_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4101 bp = skip_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4102 get_tag (bp);
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4103 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4104 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4105 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4106
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4107
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4108 /*
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4109 * Scheme tag functions
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4110 * look for (def... xyzzy
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4111 * look for (def... (xyzzy
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4112 * look for (def ... ((...(xyzzy ....
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4113 * look for (set! xyzzy
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4114 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4115
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4116 void get_scheme ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4117
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4118 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4119 Scheme_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4120 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4121 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4122 register char *bp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4123
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4124 LOOP_ON_INPUT_LINES (inf, lb, bp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4125 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4126 if (bp[0] == '('
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4127 && (bp[1] == 'D' || bp[1] == 'd')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4128 && (bp[2] == 'E' || bp[2] == 'e')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4129 && (bp[3] == 'F' || bp[3] == 'f'))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4130 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4131 bp = skip_non_spaces (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4132 /* Skip over open parens and white space */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4133 while (isspace (*bp) || *bp == '(')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4134 bp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4135 get_tag (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4136 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4137 if (bp[0] == '('
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4138 && (bp[1] == 'S' || bp[1] == 's')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4139 && (bp[2] == 'E' || bp[2] == 'e')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4140 && (bp[3] == 'T' || bp[3] == 't')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4141 && (bp[4] == '!' || bp[4] == '!')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4142 && (isspace (bp[5])))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4143 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4144 bp = skip_non_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4145 bp = skip_spaces (bp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4146 get_tag (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4147 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4148 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4149 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4150
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4151 /* Find tags in TeX and LaTeX input files. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4152
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4153 /* TEX_toktab is a table of TeX control sequences that define tags.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4154 Each TEX_tabent records one such control sequence.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4155 CONVERT THIS TO USE THE Stab TYPE!! */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4156 struct TEX_tabent
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4157 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4158 char *name;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4159 int len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4160 };
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4161
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4162 struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4163
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4164 /* Default set of control sequences to put into TEX_toktab.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4165 The value of environment var TEXTAGS is prepended to this. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4166
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4167 char *TEX_defenv = "\
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4168 :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
4169 :part:appendix:entry:index";
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4170
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4171 void TEX_mode ();
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4172 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
4173 int TEX_Token ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4174
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4175 char TEX_esc = '\\';
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4176 char TEX_opgrp = '{';
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4177 char TEX_clgrp = '}';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4178
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4179 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4180 * TeX/LaTeX scanning loop.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4181 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4182 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4183 TeX_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4184 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4185 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4186 char *cp, *lasthit;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4187 register int i;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4188
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4189 /* 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
4190 TEX_mode (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4191
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4192 /* Initialize token table once from environment. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4193 if (!TEX_toktab)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4194 TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4195
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4196 LOOP_ON_INPUT_LINES (inf, lb, cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4197 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4198 lasthit = cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4199 /* Look at each esc in line. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4200 while ((cp = etags_strchr (cp, TEX_esc)) != NULL)
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4201 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4202 if (*++cp == '\0')
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4203 break;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4204 linecharno += cp - lasthit;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4205 lasthit = cp;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4206 i = TEX_Token (lasthit);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4207 if (i >= 0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4208 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4209 /* We seem to include the TeX command in the tag name.
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4210 register char *p;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4211 for (p = lasthit + TEX_toktab[i].len;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4212 *p != '\0' && *p != TEX_clgrp;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4213 p++)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4214 continue; */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4215 pfnote (/*savenstr (lasthit, p-lasthit)*/ (char *)NULL, TRUE,
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4216 lb.buffer, lb.len, lineno, linecharno);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4217 break; /* We only tag a line once */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4218 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4219 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4220 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4221 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4222
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4223 #define TEX_LESC '\\'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4224 #define TEX_SESC '!'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4225 #define TEX_cmt '%'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4226
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4227 /* 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
4228 chars accordingly. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4229 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4230 TEX_mode (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4231 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4232 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4233 int c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4234
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4235 while ((c = getc (inf)) != EOF)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4236 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4237 /* Skip to next line if we hit the TeX comment char. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4238 if (c == TEX_cmt)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4239 while (c != '\n')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4240 c = getc (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4241 else if (c == TEX_LESC || c == TEX_SESC )
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4242 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4243 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4244
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4245 if (c == TEX_LESC)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4246 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4247 TEX_esc = TEX_LESC;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4248 TEX_opgrp = '{';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4249 TEX_clgrp = '}';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4250 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4251 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4252 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4253 TEX_esc = TEX_SESC;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4254 TEX_opgrp = '<';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4255 TEX_clgrp = '>';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4256 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4257 /* If the input file is compressed, inf is a pipe, and rewind may fail.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4258 No attempt is made to correct the situation. */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4259 rewind (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4260 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4261
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4262 /* 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
4263 Build token table. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4264 struct TEX_tabent *
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4265 TEX_decode_env (evarname, defenv)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4266 char *evarname;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4267 char *defenv;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4268 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4269 register char *env, *p;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4270
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4271 struct TEX_tabent *tab;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4272 int size, i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4273
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4274 /* Append default string to environment. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4275 env = getenv (evarname);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4276 if (!env)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4277 env = defenv;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4278 else
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4279 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4280 char *oldenv = env;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4281 env = concat (oldenv, defenv, "");
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4282 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4283
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4284 /* Allocate a token table */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4285 for (size = 1, p = env; p;)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4286 if ((p = etags_strchr (p, ':')) && *++p != '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4287 size++;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4288 /* Add 1 to leave room for null terminator. */
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4289 tab = xnew (size + 1, struct TEX_tabent);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4290
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4291 /* Unpack environment string into token table. Be careful about */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4292 /* zero-length strings (leading ':', "::" and trailing ':') */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4293 for (i = 0; *env;)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4294 {
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
4295 p = etags_strchr (env, ':');
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4296 if (!p) /* End of environment string. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4297 p = env + strlen (env);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4298 if (p - env > 0)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4299 { /* Only non-zero strings. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4300 tab[i].name = savenstr (env, p - env);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4301 tab[i].len = strlen (tab[i].name);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4302 i++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4303 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4304 if (*p)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4305 env = p + 1;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4306 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4307 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4308 tab[i].name = NULL; /* Mark end of table. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4309 tab[i].len = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4310 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4311 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4312 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4313 return tab;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4314 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4315
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4316 /* 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
4317 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
4318 Otherwise return -1.
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4319 Keep the capital `T' in `token' for dumb truncating compilers
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4320 (this distinguishes it from `TEX_toktab' */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4321 int
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4322 TEX_Token (cp)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4323 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4324 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4325 int i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4326
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4327 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
4328 if (strneq (TEX_toktab[i].name, cp, TEX_toktab[i].len))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4329 return i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4330 return -1;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4331 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4332
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4333 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4334 * 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
4335 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4336 * Assumes that the predicate starts at column 0.
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4337 * Only the first clause of a predicate is added.
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4338 */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4339 int prolog_pred ();
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4340 void prolog_skip_comment ();
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4341 int prolog_atom ();
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4342
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4343 void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4344 Prolog_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4345 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4346 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4347 char *cp, *last;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4348 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4349 int allocated;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4350
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4351 allocated = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4352 len = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4353 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4354
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4355 LOOP_ON_INPUT_LINES (inf, lb, cp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4356 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4357 if (cp[0] == '\0') /* Empty line */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4358 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4359 else if (isspace (cp[0])) /* Not a predicate */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4360 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4361 else if (cp[0] == '/' && cp[1] == '*') /* comment. */
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
4362 prolog_skip_comment (&lb, inf);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4363 else if ((len = prolog_pred (cp, last)) > 0)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4364 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4365 /* Predicate. Store the function name so that we only
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
4366 generate a tag for the first clause. */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4367 if (last == NULL)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4368 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
4369 else if (len + 1 > allocated)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4370 last = xrnew (last, len + 1, char);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4371 allocated = len + 1;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4372 strncpy (last, cp, len);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4373 last[len] = '\0';
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4374 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4375 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4376 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4377
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4378
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4379 void
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4380 prolog_skip_comment (plb, inf)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4381 linebuffer *plb;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4382 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4383 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4384 char *cp;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4385
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4386 do
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4387 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4388 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
4389 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
4390 return;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4391 lineno++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4392 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
4393 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4394 while (!feof(inf));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4395 }
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4396
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4397 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4398 * 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
4399 * <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
4400 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4401 * 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
4402 * 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
4403 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4404 * 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
4405 * was found.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4406 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4407 int
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4408 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
4409 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4410 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
4411 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4412 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4413 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4414
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4415 pos = prolog_atom (s, 0);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4416 if (pos < 1)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4417 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4418
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4419 len = pos;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4420 pos = skip_spaces (s + pos) - s;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4421
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4422 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
4423 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4424 if (s[pos] == '(')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4425 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4426
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4427 /* Save only the first clause. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4428 if (last == NULL
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4429 || len != (int)strlen (last)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4430 || !strneq (s, last, len))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4431 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4432 pfnote (savenstr (s, len), TRUE, s, pos, lineno, linecharno);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4433 return len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4434 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4435 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4436 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4437 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4438
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4439 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4440 * 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
4441 * 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
4442 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4443 * 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
4444 * - 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
4445 * - 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
4446 * Backslash quotes everything.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4447 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4448 int
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4449 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
4450 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4451 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4452 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4453 int origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4454
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4455 origpos = pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4456
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4457 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
4458 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4459 /* 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
4460 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4461 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
4462 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4463 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4464 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4465 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4466 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4467 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
4468 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4469 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4470
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4471 while (1)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4472 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4473 if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4474 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4475 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4476 if (s[pos] != '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4477 break;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4478 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
4479 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4480 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
4481 /* 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
4482 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4483 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
4484 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4485 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
4486 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4487 pos += 2;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4488 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4489 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4490 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4491 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4492 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4493 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4494 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4495 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4496 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4497
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4498 /*
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4499 * 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
4500 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4501 * 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
4502 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4503 * 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
4504 */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4505 int erlang_func ();
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4506 void erlang_attribute ();
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4507 int erlang_atom ();
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4508
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4509 void
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4510 Erlang_functions (inf)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4511 FILE *inf;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4512 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4513 char *cp, *last;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4514 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4515 int allocated;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4516
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4517 allocated = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4518 len = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4519 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4520
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4521 LOOP_ON_INPUT_LINES (inf, lb, cp)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4522 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4523 if (cp[0] == '\0') /* Empty line */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4524 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4525 else if (isspace (cp[0])) /* Not function nor attribute */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4526 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4527 else if (cp[0] == '%') /* comment */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4528 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4529 else if (cp[0] == '"') /* Sometimes, strings start in column one */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4530 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4531 else if (cp[0] == '-') /* attribute, e.g. "-define" */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4532 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4533 erlang_attribute (cp);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4534 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4535 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4536 else if ((len = erlang_func (cp, last)) > 0)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4537 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4538 /*
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4539 * 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
4540 * 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
4541 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4542 if (last == NULL)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4543 last = xnew (len + 1, char);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4544 else if (len + 1 > allocated)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4545 last = xrnew (last, len + 1, char);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4546 allocated = len + 1;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4547 strncpy (last, cp, len);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4548 last[len] = '\0';
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4549 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4550 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4551 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4552
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4553
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4554 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4555 * 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
4556 * <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
4557 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4558 * 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
4559 * 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
4560 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4561 * 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
4562 * was found.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4563 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4564 int
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4565 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
4566 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4567 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
4568 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4569 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4570 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4571
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4572 pos = erlang_atom (s, 0);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4573 if (pos < 1)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4574 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4575
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4576 len = pos;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4577 pos = skip_spaces (s + pos) - s;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4578
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4579 /* Save only the first clause. */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4580 if (s[pos++] == '('
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4581 && (last == NULL
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4582 || len != (int)strlen (last)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4583 || !strneq (s, last, len)))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4584 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4585 pfnote (savenstr (s, len), TRUE, s, pos, lineno, linecharno);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4586 return len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4587 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4588
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4589 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4590 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4591
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4592
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4593 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4594 * Handle attributes. Currently, tags are generated for defines
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4595 * and records.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4596 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4597 * 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
4598 * -define(foo, bar).
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4599 * -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
4600 * -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
4601 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4602 void
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4603 erlang_attribute (s)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4604 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4605 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4606 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4607 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4608
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4609 if (strneq (s, "-define", 7) || strneq (s, "-record", 7))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4610 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4611 pos = skip_spaces (s + 7) - s;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4612 if (s[pos++] == '(')
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4613 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4614 pos = skip_spaces (s + pos) - s;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4615 len = erlang_atom (s, pos);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4616 if (len != 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4617 pfnote (savenstr (& s[pos], len), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4618 s, pos + len, lineno, linecharno);
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4619 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4620 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4621 return;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4622 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4623
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4624
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4625 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4626 * 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
4627 * 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
4628 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4629 int
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4630 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
4631 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4632 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4633 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4634 int origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4635
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4636 origpos = pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4637
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4638 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
4639 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4640 /* 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
4641 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4642 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
4643 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4644 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4645 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4646 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
4647 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4648 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4649
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4650 while (1)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4651 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4652 if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4653 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4654 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4655 break;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4656 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4657 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
4658 /* 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
4659 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4660 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
4661 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4662 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
4663 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4664 pos += 2;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4665 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4666 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4667 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4668 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4669 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4670 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4671 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4672 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4673 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4674
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4675 #ifdef ETAGS_REGEXPS
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4676
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4677 /* 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
4678 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
4679 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
4680 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
4681 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
4682 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
4683 char *
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4684 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
4685 char *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4686 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4687 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
4688 char *copyto = name;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4689 bool quoted = FALSE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4690
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4691 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
4692 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4693 if (quoted)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4694 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4695 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
4696 *copyto++ = '\t';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4697 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
4698 *copyto++ = sep;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4699 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4700 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4701 /* 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
4702 *copyto++ = '\\';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4703 *copyto++ = *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4704 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4705 quoted = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4706 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4707 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
4708 quoted = TRUE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4709 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
4710 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4711 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4712 *copyto++ = *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4713 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4714
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4715 /* 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
4716 *copyto = '\0';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4717 return name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4718 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4719
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4720 /* Look at the argument of --regex or --no-regex and do the right
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4721 thing. Same for each line of a regexp file. */
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4722 void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4723 analyse_regex (regex_arg, ignore_case)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4724 char *regex_arg;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4725 bool ignore_case;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4726 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4727 if (regex_arg == NULL)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4728 free_patterns (); /* --no-regex: remove existing regexps */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4729
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4730 /* A real --regexp option or a line in a regexp file. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4731 switch (regex_arg[0])
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4732 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4733 /* Comments in regexp file or null arg to --regex. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4734 case '\0':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4735 case ' ':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4736 case '\t':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4737 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4738
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4739 /* Read a regex file. This is recursive and may result in a
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4740 loop, which will stop when the file descriptors are exhausted. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4741 case '@':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4742 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4743 FILE *regexfp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4744 linebuffer regexbuf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4745 char *regexfile = regex_arg + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4746
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4747 /* regexfile is a file containing regexps, one per line. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4748 regexfp = fopen (regexfile, "r");
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4749 if (regexfp == NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4750 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4751 pfatal (regexfile);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4752 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4753 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4754 initbuffer (&regexbuf);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4755 while (readline_internal (&regexbuf, regexfp) > 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4756 analyse_regex (regexbuf.buffer, ignore_case);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4757 free (regexbuf.buffer);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4758 fclose (regexfp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4759 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4760 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4761
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4762 /* Regexp to be used for a specific language only. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4763 case '{':
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4764 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4765 language *lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4766 char *lang_name = regex_arg + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4767 char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4768
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4769 for (cp = lang_name; *cp != '}'; cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4770 if (*cp == '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4771 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4772 error ("unterminated language name in regex: %s", regex_arg);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4773 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4774 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4775 *cp = '\0';
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4776 lang = get_language_from_name (lang_name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4777 if (lang == NULL)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4778 return;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4779 add_regex (cp + 1, ignore_case, lang);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4780 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4781 break;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4782
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4783 /* Regexp to be used for any language. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4784 default:
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4785 add_regex (regex_arg, ignore_case, NULL);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4786 break;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4787 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4788 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4789
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4790 /* 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
4791 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
4792 void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4793 add_regex (regexp_pattern, ignore_case, lang)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4794 char *regexp_pattern;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4795 bool ignore_case;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4796 language *lang;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4797 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4798 char *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4799 const char *err;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4800 struct re_pattern_buffer *patbuf;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4801 pattern *pp;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4802
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4803
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4804 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
4805 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4806 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
4807 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4808 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4809 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
4810 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
4811 {
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
4812 error ("null regexp", (char *)NULL);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4813 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4814 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4815 (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
4816
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4817 patbuf = xnew (1, struct re_pattern_buffer);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4818 /* Translation table to fold case if appropriate. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4819 patbuf->translate = (ignore_case) ? lc_trans : NULL;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4820 patbuf->fastmap = NULL;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4821 patbuf->buffer = NULL;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4822 patbuf->allocated = 0;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4823
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4824 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
4825 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
4826 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4827 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
4828 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4829 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4830
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4831 pp = p_head;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4832 p_head = xnew (1, pattern);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4833 p_head->regex = savestr (regexp_pattern);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4834 p_head->p_next = pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4835 p_head->language = lang;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4836 p_head->pattern = patbuf;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4837 p_head->name_pattern = savestr (name);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4838 p_head->error_signaled = FALSE;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4839 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4840
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4841 /*
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4842 * 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
4843 * arguments.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4844 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4845 char *
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4846 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
4847 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
4848 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
4849 {
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4850 char *result, *t;
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4851 int size, dig, diglen;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4852
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4853 result = NULL;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4854 size = strlen (out);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4855
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4856 /* Pass 1: figure out how much to allocate by finding all \N strings. */
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4857 if (out[size - 1] == '\\')
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4858 fatal ("pattern error in \"%s\"", out);
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4859 for (t = etags_strchr (out, '\\');
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4860 t != NULL;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4861 t = etags_strchr (t + 2, '\\'))
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4862 if (isdigit (t[1]))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4863 {
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4864 dig = t[1] - '0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4865 diglen = regs->end[dig] - regs->start[dig];
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4866 size += diglen - 2;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4867 }
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4868 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4869 size -= 1;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4870
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4871 /* 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
4872 result = xnew (size + 1, char);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4873
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4874 for (t = result; *out != '\0'; out++)
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4875 if (*out == '\\' && isdigit (*++out))
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4876 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4877 /* Using "dig2" satisfies my debugger. Bleah. */
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4878 dig = *out - '0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4879 diglen = regs->end[dig] - regs->start[dig];
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4880 strncpy (t, in + regs->start[dig], diglen);
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4881 t += diglen;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4882 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4883 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4884 *t++ = *out;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4885 *t = '\0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4886
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4887 if (DEBUG && (t > result + size || t - result != (int)strlen (result)))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
4888 abort ();
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4889
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4890 return result;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4891 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4892
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4893 /* Deallocate all patterns. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4894 void
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4895 free_patterns ()
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4896 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4897 pattern *pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4898 while (p_head != NULL)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4899 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4900 pp = p_head->p_next;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4901 free (p_head->regex);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4902 free (p_head->name_pattern);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4903 free (p_head);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4904 p_head = pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4905 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4906 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4907 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4908
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4909 void
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4910 get_tag (bp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4911 register char *bp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4912 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4913 register char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4914
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4915 if (*bp == '\0')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4916 return;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4917 /* Go till you get to white space or a syntactic break */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4918 for (cp = bp + 1;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4919 *cp != '\0' && *cp != '(' && *cp != ')' && !isspace (*cp);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4920 cp++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4921 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4922 pfnote (savenstr (bp, cp-bp), TRUE,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4923 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4924 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4925
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4926 #endif /* ETAGS_REGEXPS */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4927 /* Initialize a linebuffer for use */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4928 void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4929 initbuffer (lbp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4930 linebuffer *lbp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4931 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4932 lbp->size = 200;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4933 lbp->buffer = xnew (200, char);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4934 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4935
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4936 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4937 * Read a line of text from `stream' into `lbp', excluding the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4938 * newline or CR-NL, if any. Return the number of characters read from
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4939 * `stream', which is the length of the line including the newline.
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4940 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4941 * On DOS or Windows we do not count the CR character, if any, before the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4942 * NL, in the returned length; this mirrors the behavior of emacs on those
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4943 * platforms (for text files, it translates CR-NL to NL as it reads in the
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4944 * file).
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4945 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4946 long
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4947 readline_internal (lbp, stream)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4948 linebuffer *lbp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4949 register FILE *stream;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4950 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4951 char *buffer = lbp->buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4952 register char *p = lbp->buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4953 register char *pend;
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4954 int chars_deleted;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4955
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4956 pend = p + lbp->size; /* Separate to avoid 386/IX compiler bug. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4957
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4958 while (1)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4959 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4960 register int c = getc (stream);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4961 if (p == pend)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4962 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4963 /* We're at the end of linebuffer: expand it. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4964 lbp->size *= 2;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4965 buffer = xrnew (buffer, lbp->size, char);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4966 p += buffer - lbp->buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4967 pend = buffer + lbp->size;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4968 lbp->buffer = buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4969 }
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4970 if (c == EOF)
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4971 {
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4972 *p = '\0';
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4973 chars_deleted = 0;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4974 break;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4975 }
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4976 if (c == '\n')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4977 {
10990
c0ceaa45ded7 * etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents: 10801
diff changeset
4978 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
4979 {
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4980 p -= 1;
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
4981 #ifdef DOS_NT
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
4982 /* Assume CRLF->LF translation will be performed by Emacs
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
4983 when loading this file, so CRs won't appear in the buffer.
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
4984 It would be cleaner to compensate within Emacs;
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
4985 however, Emacs does not know how many CRs were deleted
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
4986 before any given point in the file. */
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
4987 chars_deleted = 1;
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
4988 #else
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4989 chars_deleted = 2;
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
4990 #endif
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4991 }
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4992 else
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4993 {
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4994 chars_deleted = 1;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4995 }
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
4996 *p = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4997 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4998 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4999 *p++ = c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5000 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5001 lbp->len = p - buffer;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5002
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5003 return lbp->len + chars_deleted;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5004 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5005
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5006 /*
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5007 * Like readline_internal, above, but in addition try to match the
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5008 * input line against relevant regular expressions.
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5009 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5010 long
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5011 readline (lbp, stream)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5012 linebuffer *lbp;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5013 FILE *stream;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5014 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5015 /* Read new line. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5016 long result = readline_internal (lbp, stream);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5017 #ifdef ETAGS_REGEXPS
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5018 int match;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5019 pattern *pp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5020
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5021 /* Match against relevant patterns. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5022 if (lbp->len > 0)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5023 for (pp = p_head; pp != NULL; pp = pp->p_next)
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5024 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5025 /* Only use generic regexps or those for the current language. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5026 if (pp->language != NULL && pp->language != curlang)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5027 continue;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5028
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5029 match = re_match (pp->pattern, lbp->buffer, lbp->len, 0, &pp->regs);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5030 switch (match)
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5031 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5032 case -2:
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5033 /* Some error. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5034 if (!pp->error_signaled)
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5035 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5036 error ("error while matching \"%s\"", pp->regex);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5037 pp->error_signaled = TRUE;
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5038 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5039 break;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5040 case -1:
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5041 /* No match. */
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5042 break;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5043 default:
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5044 /* Match occurred. Construct a tag. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5045 if (pp->name_pattern[0] != '\0')
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5046 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5047 /* Make a named tag. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5048 char *name = substitute (lbp->buffer,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5049 pp->name_pattern, &pp->regs);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5050 if (name != NULL)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5051 pfnote (name, TRUE, lbp->buffer, match, lineno, linecharno);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5052 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5053 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5054 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5055 /* Make an unnamed tag. */
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5056 pfnote ((char *)NULL, TRUE,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5057 lbp->buffer, match, lineno, linecharno);
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5058 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5059 break;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5060 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5061 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5062 #endif /* ETAGS_REGEXPS */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5063
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5064 return result;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5065 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5066
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5067 /*
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5068 * 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
5069 * 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
5070 */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5071 char *
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5072 savestr (cp)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5073 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5074 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5075 return savenstr (cp, strlen (cp));
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5076 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5077
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5078 /*
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5079 * 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
5080 * 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
5081 */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5082 char *
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5083 savenstr (cp, len)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5084 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5085 int len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5086 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5087 register char *dp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5088
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5089 dp = xnew (len + 1, char);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5090 strncpy (dp, cp, len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5091 dp[len] = '\0';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5092 return dp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5093 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5094
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5095 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5096 * Return the ptr in sp at which the character c last
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5097 * appears; NULL if not found
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5098 *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5099 * Identical to System V strrchr, included for portability.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5100 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5101 char *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5102 etags_strrchr (sp, c)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5103 register char *sp, c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5104 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5105 register char *r;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5106
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5107 r = NULL;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5108 do
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5109 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5110 if (*sp == c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5111 r = sp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5112 } 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
5113 return r;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5114 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5115
774
11867ad5bab4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
5116
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5117 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5118 * Return the ptr in sp at which the character c first
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5119 * appears; NULL if not found
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5120 *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5121 * Identical to System V strchr, included for portability.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5122 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5123 char *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5124 etags_strchr (sp, c)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5125 register char *sp, c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5126 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5127 do
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5128 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5129 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
5130 return sp;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5131 } while (*sp++);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5132 return NULL;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5133 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5134
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5135 /* Skip spaces, return new pointer. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5136 char *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5137 skip_spaces (cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5138 char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5139 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5140 while (isspace (*cp)) /* isspace('\0')==FALSE */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5141 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5142 return cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5143 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5144
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5145 /* Skip non spaces, return new pointer. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5146 char *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5147 skip_non_spaces (cp)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5148 char *cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5149 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5150 while (!iswhite (*cp)) /* iswhite('\0')==TRUE */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5151 cp++;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5152 return cp;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5153 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5154
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5155 /* Print error message and exit. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5156 void
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5157 fatal (s1, s2)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5158 char *s1, *s2;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5159 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5160 error (s1, s2);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5161 exit (BAD);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5162 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5163
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5164 void
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5165 pfatal (s1)
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5166 char *s1;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5167 {
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5168 perror (s1);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5169 exit (BAD);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5170 }
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5171
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5172 void
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5173 suggest_asking_for_help ()
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5174 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5175 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5176 progname,
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5177 #ifdef LONG_OPTIONS
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5178 "--help"
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5179 #else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5180 "-h"
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5181 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5182 );
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5183 exit (BAD);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5184 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5185
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5186 /* Print error message. `s1' is printf control string, `s2' is arg for it. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5187 void
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5188 error (s1, s2)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5189 char *s1, *s2;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5190 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5191 fprintf (stderr, "%s: ", progname);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5192 fprintf (stderr, s1, s2);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5193 fprintf (stderr, "\n");
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5194 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5195
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5196 /* Return a newly-allocated string whose contents
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5197 concatenate those of s1, s2, s3. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5198 char *
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5199 concat (s1, s2, s3)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5200 char *s1, *s2, *s3;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5201 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5202 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5203 char *result = xnew (len1 + len2 + len3 + 1, char);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5204
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5205 strcpy (result, s1);
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5206 strcpy (result + len1, s2);
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5207 strcpy (result + len1 + len2, s3);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5208 result[len1 + len2 + len3] = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5209
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5210 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5211 }
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5212
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5213 /* 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
5214 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
5215 char *
6fa038c33a0f [MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents: 7049
diff changeset
5216 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
5217 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5218 #ifdef HAVE_GETCWD
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5219 int bufsize = 200;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5220 char *path = xnew (bufsize, char);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5221
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5222 while (getcwd (path, bufsize) == NULL)
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5223 {
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
5224 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
5225 pfatal ("getcwd");
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
5226 bufsize *= 2;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5227 free (path);
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5228 path = xnew (bufsize, char);
8789
81a2817b99b2 (etags_getcwd): Use getcwd if available.
Karl Heuer <kwzh@gnu.org>
parents: 8180
diff changeset
5229 }
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5230
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5231 canonicalize_filename (path);
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5232 return path;
16394
675944d1abc9 (etags_getcwd) [WINDOWSNT]: Convert backslashes to slashes.
Richard M. Stallman <rms@gnu.org>
parents: 16373
diff changeset
5233
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5234 #else /* not HAVE_GETCWD */
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5235 #ifdef MSDOS
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5236 char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5237
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5238 getwd (path);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5239
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5240 for (p = path; *p != '\0'; p++)
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5241 if (*p == '\\')
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5242 *p = '/';
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5243 else
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5244 *p = lowcase (*p);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5245
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5246 return strdup (path);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5247 #else /* not MSDOS */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5248 linebuffer path;
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5249 FILE *pipe;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5250
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5251 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
5252 pipe = (FILE *) popen ("pwd 2>/dev/null", "r");
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5253 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
5254 pfatal ("pwd");
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5255 pclose (pipe);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5256
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5257 return path.buffer;
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5258 #endif /* not MSDOS */
11992
e550e0d13e83 * etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise
Francesco Potortì <pot@gnu.org>
parents: 11990
diff changeset
5259 #endif /* not HAVE_GETCWD */
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5260 }
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5261
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5262 /* Return a newly allocated string containing the file name of FILE
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5263 relative to the absolute directory DIR (which should end with a slash). */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5264 char *
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5265 relative_filename (file, dir)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5266 char *file, *dir;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5267 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5268 char *fp, *dp, *afn, *res;
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5269 int i;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5270
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
5271 /* Find the common root of file and dir (with a trailing slash). */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5272 afn = absolute_filename (file, cwd);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5273 fp = afn;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5274 dp = dir;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5275 while (*fp++ == *dp++)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5276 continue;
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5277 fp--, dp--; /* back to the first differing char */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5278 #ifdef DOS_NT
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5279 if (fp == afn && afn[0] != '/') /* cannot build a relative name */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5280 return afn;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5281 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5282 do /* look at the equal chars until '/' */
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
5283 fp--, dp--;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5284 while (*fp != '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5285
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5286 /* Build a sequence of "../" strings for the resulting relative file name. */
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5287 i = 0;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5288 while ((dp = etags_strchr (dp + 1, '/')) != NULL)
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5289 i += 1;
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5290 res = xnew (3*i + strlen (fp + 1) + 1, char);
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5291 res[0] = '\0';
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5292 while (i-- > 0)
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5293 strcat (res, "../");
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5294
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5295 /* Add the file name relative to the common root of file and dir. */
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5296 strcat (res, fp + 1);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5297 free (afn);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5298
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5299 return res;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5300 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5301
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5302 /* Return a newly allocated string containing the absolute file name
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5303 of FILE given DIR (which should end with a slash). */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5304 char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5305 absolute_filename (file, dir)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5306 char *file, *dir;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5307 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5308 char *slashp, *cp, *res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5309
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5310 if (filename_is_absolute (file))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5311 res = savestr (file);
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5312 #ifdef DOS_NT
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5313 /* We don't support non-absolute file names with a drive
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5314 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
5315 else if (file[1] == ':')
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5316 fatal ("%s: relative file names with drive letters not supported", file);
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5317 #endif
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5318 else
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5319 res = concat (dir, file, "");
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5320
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5321 /* Delete the "/dirname/.." and "/." substrings. */
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5322 slashp = etags_strchr (res, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5323 while (slashp != NULL && slashp[0] != '\0')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5324 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5325 if (slashp[1] == '.')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5326 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5327 if (slashp[2] == '.'
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5328 && (slashp[3] == '/' || slashp[3] == '\0'))
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5329 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5330 cp = slashp;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5331 do
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5332 cp--;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5333 while (cp >= res && !filename_is_absolute (cp));
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5334 if (cp < res)
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5335 cp = slashp; /* the absolute name begins with "/.." */
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5336 #ifdef DOS_NT
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5337 /* Under MSDOS and NT we get `d:/NAME' as absolute
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5338 file name, so the luser could say `d:/../NAME'.
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5339 We silently treat this as `d:/NAME'. */
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5340 else if (cp[0] != '/')
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5341 cp = slashp;
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5342 #endif
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5343 strcpy (cp, slashp + 3);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5344 slashp = cp;
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5345 continue;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5346 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5347 else if (slashp[2] == '/' || slashp[2] == '\0')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5348 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5349 strcpy (slashp, slashp + 2);
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5350 continue;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5351 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5352 }
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5353
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5354 slashp = etags_strchr (slashp + 1, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5355 }
24140
9e4d1d3eab09 (etags_getcwd, absolute_filename) [DOS_NT]: Canonicalize
Geoff Voelker <voelker@cs.washington.edu>
parents: 24059
diff changeset
5356
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5357 if (res[0] == '\0')
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5358 return savestr ("/");
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5359 else
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5360 return res;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5361 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5362
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5363 /* Return a newly allocated string containing the absolute
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5364 file name of dir where FILE resides given DIR (which should
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5365 end with a slash). */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5366 char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5367 absolute_dirname (file, dir)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5368 char *file, *dir;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5369 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5370 char *slashp, *res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5371 char save;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5372
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5373 canonicalize_filename (file);
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5374 slashp = etags_strrchr (file, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5375 if (slashp == NULL)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5376 return savestr (dir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5377 save = slashp[1];
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5378 slashp[1] = '\0';
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5379 res = absolute_filename (file, dir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5380 slashp[1] = save;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5381
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5382 return res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5383 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5384
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5385 /* Whether the argument string is an absolute file name. The argument
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5386 string must have been canonicalized with canonicalize_filename. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5387 bool
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5388 filename_is_absolute (fn)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5389 char *fn;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5390 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5391 return (fn[0] == '/'
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5392 #ifdef DOS_NT
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5393 || (isalpha(fn[0]) && fn[1] == ':' && fn[2] == '/')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5394 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5395 );
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5396 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5397
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5398 /* Translate backslashes into slashes. Works in place. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5399 void
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5400 canonicalize_filename (fn)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5401 register char *fn;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5402 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5403 #ifdef DOS_NT
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5404 /* Convert backslashes to slashes. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5405 for (; *fn != '\0'; fn++)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5406 if (*fn == '\\')
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5407 *fn = '/';
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5408 /* Canonicalize drive letter case. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5409 if (islower (path[0]))
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5410 path[0] = toupper (path[0]);
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5411 #else
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5412 /* No action. */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5413 fn = NULL; /* shut up the compiler */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5414 #endif
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5415 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5416
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5417 /* Increase the size of a linebuffer. */
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5418 void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5419 grow_linebuffer (lbp, toksize)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5420 linebuffer *lbp;
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5421 int toksize;
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5422 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5423 while (lbp->size < toksize)
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5424 lbp->size *= 2;
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5425 lbp->buffer = xrnew (lbp->buffer, lbp->size, char);
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5426 }
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5427
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5428 /* 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
5429 long *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5430 xmalloc (size)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
5431 unsigned int size;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5432 {
11673
46d2178719ad (C_entries): Cast result of xrealloc.
Richard M. Stallman <rms@gnu.org>
parents: 11231
diff changeset
5433 long *result = (long *) malloc (size);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5434 if (result == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5435 fatal ("virtual memory exhausted", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5436 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5437 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5438
11673
46d2178719ad (C_entries): Cast result of xrealloc.
Richard M. Stallman <rms@gnu.org>
parents: 11231
diff changeset
5439 long *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5440 xrealloc (ptr, size)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5441 char *ptr;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
5442 unsigned int size;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5443 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5444 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
5445 if (result == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5446 fatal ("virtual memory exhausted", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5447 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5448 }