annotate lib-src/etags.c @ 43723:5cd450d9f443

* etags.c: Honour #line directives. (no_line_directive): New global var; set it for old behaviour. (main): Remove some #ifdef in the getopt switch. (add_node, put_entries): Code added to merge different chunks of nodes referring to the same file. Currently the tags are just appended, without any check for duplicates. (Perl_functions): Do not special case ctags. (readline): Identify #line directives and do the right thing. (nocharno, invalidcharno): New global vars. (process_file): Reset nocharno. (readline): Set nocharno. (pfnote): Read nocharno and maybe put invalidcharno in node. (total_size_of_entries, put_entries): Use invalidcharno. * etags.c: Keep the whole tag table in memory, even in etags mode. (main): Call put_entries here even in CTAGS mode. (main, process_file): Check the return values of fclose and pclose. (process_file): Do not call put_entries after parsing each file. (process_file): Canonicalise file names even for ctags. (process_file): Set curfile here... (find_entries): ... not here any more. (add_node): In etags mode, build a linked list of entries (on right pointer) for each file, and link the first entry of each file on left nodes. (put_entries): Print here the name of the file. (put_entries): Print the entries starting from the first file. (number_len, total_size_of_entries): Define these only iin etags mode, make the second work only on the right nodes. * etags.c: Make all global variables static.
author Francesco Potortì <pot@gnu.org>
date Tue, 05 Mar 2002 11:28:26 +0000
parents 7d2776273a81
children 492830d6693c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35653
96f71478797d Add a coding: tag.
Eli Zaretskii <eliz@gnu.org>
parents: 35574
diff changeset
1 /* Tags file maker to go with GNU Emacs -*- coding: latin-1 -*-
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
2 Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2001
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?
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
27 * 1989 Sam Kendall added C++.
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
28 * 1992 Joseph B. Wells improved C and C++ parsing.
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
29 * 1993 Francesco Potort́ reorganised C and C++.
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
30 * 1994 Regexp tags by Tom Tromey.
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
31 * 2001 Nested classes by Francesco Potort́ (ideas by Mykola Dzyuba).
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
32 *
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
33 * Francesco Potort́ <pot@gnu.org> has maintained it since 1993.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 */
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
35
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
36 char pot_etags_version[] = "@(#) pot revision number is 14.39";
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
37
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
38 #define TRUE 1
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
39 #define FALSE 0
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
40
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
41 #ifdef DEBUG
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
42 # undef DEBUG
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
43 # define DEBUG TRUE
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
44 #else
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
45 # define DEBUG FALSE
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
46 # define NDEBUG /* disable assert */
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
47 #endif
10754
cd1c0b5e8634 * etags.c (C_entries): Initialise the new members of TOKEN.
Francesco Potortì <pot@gnu.org>
parents: 10623
diff changeset
48
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
49 #ifdef HAVE_CONFIG_H
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
50 # include <config.h>
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
51 /* 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
52 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
53 # 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
54 # 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
55 # define LONG_OPTIONS /* accept long options */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
56 # ifndef PTR /* for Xemacs */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
57 # define PTR void *
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
58 # endif
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
59 # ifndef __P /* for Xemacs */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
60 # define __P(args) args
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
61 # endif
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
62 #else
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
63 # if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
64 # define __P(args) args /* use prototypes */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
65 # define PTR void * /* for generic pointers */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
66 # else
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
67 # define __P(args) () /* no prototypes */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
68 # define const /* remove const for old compilers' sake */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
69 # define PTR long * /* don't use void* */
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
70 # endif
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
71 #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
72
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
73 #ifndef _GNU_SOURCE
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
74 # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
75 #endif
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
76
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
77 /* WIN32_NATIVE is for Xemacs.
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
78 MSDOS, WINDOWSNT, DOS_NT are for Emacs. */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
79 #ifdef WIN32_NATIVE
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
80 # undef MSDOS
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
81 # undef WINDOWSNT
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
82 # define WINDOWSNT
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
83 #endif /* WIN32_NATIVE */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
84
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
85 #ifdef MSDOS
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
86 # undef MSDOS
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
87 # define MSDOS TRUE
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
88 # include <fcntl.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
89 # 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
90 # 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
91 # 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
92 # 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
93 # 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
94 # endif
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
95 #else
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
96 # define MSDOS FALSE
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
97 #endif /* MSDOS */
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
98
9773
bd49556a7552 (main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 9635
diff changeset
99 #ifdef WINDOWSNT
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
100 # include <stdlib.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
101 # include <fcntl.h>
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
102 # include <string.h>
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
103 # include <direct.h>
14982
b470e33ce4a9 [WINDOWSNT]: Include io.h.
Richard M. Stallman <rms@gnu.org>
parents: 14924
diff changeset
104 # 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
105 # define MAXPATHLEN _MAX_PATH
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
106 # undef HAVE_NTGUI
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
107 # undef DOS_NT
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
108 # define DOS_NT
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
109 # 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
110 # 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
111 # endif /* undef HAVE_GETCWD */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
112 #else /* !WINDOWSNT */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
113 # ifdef STDC_HEADERS
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
114 # include <stdlib.h>
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
115 # include <string.h>
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
116 # else
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
117 extern char *getenv ();
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
118 # endif
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
119 #endif /* !WINDOWSNT */
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
120
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
121 #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
122 # 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
123 #else
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
124 # if defined (HAVE_GETCWD) && !defined (WINDOWSNT)
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
125 extern char *getcwd (char *buf, size_t size);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
126 # 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
127 #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
128
3921
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
129 #include <stdio.h>
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
130 #include <ctype.h>
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
131 #include <errno.h>
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
132 #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
133 extern int errno;
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
134 #endif
3921
e5e5b3634dd0 * etags.c: #include "config.h" and the alloca CPP tangle before
Jim Blandy <jimb@redhat.com>
parents: 3838
diff changeset
135 #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
136 #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
137
35758
aa069bbee4c8 Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents: 35741
diff changeset
138 #include <assert.h>
aa069bbee4c8 Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents: 35741
diff changeset
139 #ifdef NDEBUG
aa069bbee4c8 Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents: 35741
diff changeset
140 # undef assert /* some systems have a buggy assert.h */
aa069bbee4c8 Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents: 35741
diff changeset
141 # define assert(x) ((void) 0)
35741
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
142 #endif
e0acf4b43873 (assert) [__MINGW32__]: Redefine assert to work around a
Andrew Innes <andrewi@gnu.org>
parents: 35740
diff changeset
143
4804
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
144 #if !defined (S_ISREG) && defined (S_IFREG)
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
145 # 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
146 #endif
810826b6e19a * etags.c (process_file): dead code removed.
Francesco Potortì <pot@gnu.org>
parents: 4750
diff changeset
147
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
148 #ifdef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
149 # include <getopt.h>
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
150 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
151 # 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
152 extern char *optarg;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
153 extern int optind, opterr;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
154 #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
155
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
156 #ifdef ETAGS_REGEXPS
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
157 # ifndef HAVE_CONFIG_H /* this is a standalone compilation */
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
158 # ifdef __CYGWIN__ /* compiling on Cygwin */
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
159 !!! NOTICE !!!
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
160 the regex.h distributed with Cygwin is not compatible with etags, alas!
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
161 If you want regular expression support, you should delete this notice and
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
162 arrange to use the GNU regex.h and regex.c.
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
163 # endif
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
164 # endif
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
165 # 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
166 #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
167
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
168 /* 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
169 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
170 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
171 #ifdef CTAGS
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
172 # undef CTAGS
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
173 # define CTAGS TRUE
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
174 #else
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
175 # define CTAGS FALSE
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 #endif
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 /* Exit codes for success and failure. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 #ifdef VMS
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
180 # define GOOD 1
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
181 # define BAD 0
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 #else
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
183 # define GOOD 0
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
184 # define BAD 1
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 #endif
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
187 #define streq(s,t) (assert((s)!=NULL || (t)!=NULL), !strcmp (s, t))
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
188 #define strneq(s,t,n) (assert((s)!=NULL || (t)!=NULL), !strncmp (s, t, n))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
190 #define CHARS 256 /* 2^sizeof(char) */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
191 #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
192 #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
193 #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
194 #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
195 #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
196 #define endtoken(c) (_etk[CHAR(c)]) /* c ends tokens */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
198 #define ISALNUM(c) isalnum (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
199 #define ISALPHA(c) isalpha (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
200 #define ISDIGIT(c) isdigit (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
201 #define ISLOWER(c) islower (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
202
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
203 #define lowcase(c) tolower (CHAR(c))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
204 #define upcase(c) toupper (CHAR(c))
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
205
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
206
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
207 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
208 * 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
209 *
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
210 * SYNOPSIS: Type *xnew (int n, Type);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
211 * void xrnew (OldPointer, int n, Type);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
212 */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
213 #if DEBUG
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
214 # 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
215 # 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
216 (n) * sizeof (Type)))
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
217 # define xrnew(op,n,Type) ((op) = (Type *) trace_realloc (__FILE__, __LINE__, \
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
218 (char *) (op), (n) * sizeof (Type)))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
219 #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
220 # define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type)))
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
221 # define xrnew(op,n,Type) ((op) = (Type *) xrealloc ( \
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
222 (char *) (op), (n) * sizeof (Type)))
17477
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
223 #endif
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
225 #define bool int
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
226
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
227 typedef void Lang_function __P((FILE *));
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
228
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
229 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
230 {
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 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
232 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
233 } 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
234
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
235 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
236 {
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 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
238 Lang_function *function;
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
239 char **filenames;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
240 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
241 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
242 } language;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
243
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
244 typedef struct node_st
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
245 { /* sorting structure */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
246 char *name; /* function or type name */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
247 char *file; /* file name */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
248 bool is_func; /* use pattern or line no */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
249 bool been_warned; /* set if noticed dup */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
250 int lno; /* line number tag is on */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
251 long cno; /* character number line starts on */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
252 char *pat; /* search pattern */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
253 struct node_st *left, *right; /* left and right sons */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
254 } node;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
255
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
256 /*
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
257 * A `linebuffer' is a structure which holds a line of text.
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
258 * `readline_internal' reads a line from a stream into a linebuffer
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
259 * and works regardless of the length of the line.
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
260 * SIZE is the size of BUFFER, LEN is the length of the string in
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
261 * BUFFER after readline reads it.
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
262 */
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
263 typedef struct
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
264 {
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
265 long size;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
266 int len;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
267 char *buffer;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
268 } linebuffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
270 /* 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
271 Lang_function Ada_funcs;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
272 so let's write it this way */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
273 static void Ada_funcs __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
274 static void Asm_labels __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
275 static void C_entries __P((int c_ext, FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
276 static void default_C_entries __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
277 static void plain_C_entries __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
278 static void Cjava_entries __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
279 static void Cobol_paragraphs __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
280 static void Cplusplus_entries __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
281 static void Cstar_entries __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
282 static void Erlang_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
283 static void Fortran_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
284 static void Yacc_entries __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
285 static void Lisp_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
286 static void Makefile_targets __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
287 static void Pascal_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
288 static void Perl_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
289 static void PHP_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
290 static void Postscript_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
291 static void Prolog_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
292 static void Python_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
293 static void Scheme_functions __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
294 static void TeX_commands __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
295 static void Texinfo_nodes __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
296 static void just_read_file __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
297
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
298 static void print_language_names __P((void));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
299 static void print_version __P((void));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
300 static void print_help __P((void));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
301 int main __P((int, char **));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
302
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
303 static compressor *get_compressor_from_suffix __P((char *, char **));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
304 static language *get_language_from_langname __P((const char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
305 static language *get_language_from_interpreter __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
306 static language *get_language_from_filename __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
307 static long readline __P((linebuffer *, FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
308 static long readline_internal __P((linebuffer *, FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
309 static bool nocase_tail __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
310 static char *get_tag __P((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
311
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
312 #ifdef ETAGS_REGEXPS
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
313 static void analyse_regex __P((char *, bool));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
314 static void add_regex __P((char *, bool, language *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
315 static void free_patterns __P((void));
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
316 #endif /* ETAGS_REGEXPS */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
317 static void error __P((const char *, const char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
318 static void suggest_asking_for_help __P((void));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
319 void fatal __P((char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
320 static void pfatal __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
321 static void add_node __P((node *, node **));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
322
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
323 static void init __P((void));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
324 static void initbuffer __P((linebuffer *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
325 static void find_entries __P((char *, FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
326 static void free_tree __P((node *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
327 static void pfnote __P((char *, bool, char *, int, int, long));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
328 static void new_pfnote __P((char *, int, bool, char *, int, int, long));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
329 static void process_file __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
330 static void put_entries __P((node *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
331
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
332 static char *concat __P((char *, char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
333 static char *skip_spaces __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
334 static char *skip_non_spaces __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
335 static char *savenstr __P((char *, int));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
336 static char *savestr __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
337 static char *etags_strchr __P((const char *, int));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
338 static char *etags_strrchr __P((const char *, int));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
339 static char *etags_getcwd __P((void));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
340 static char *relative_filename __P((char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
341 static char *absolute_filename __P((char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
342 static char *absolute_dirname __P((char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
343 static bool filename_is_absolute __P((char *f));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
344 static void canonicalize_filename __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
345 static void linebuffer_setlen __P((linebuffer *, int));
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
346 static PTR xmalloc __P((unsigned int));
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
347 static PTR xrealloc __P((char *, unsigned int));
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
348
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
349
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
350 static char searchar = '/'; /* use /.../ searches */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
351
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
352 static char *tagfile; /* output file */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
353 static char *progname; /* name this program was invoked with */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
354 static char *cwd; /* current working directory */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
355 static char *tagfiledir; /* directory of tagfile */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
356 static FILE *tagf; /* ioptr for tags file */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
357
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
358 static char *curfile; /* current input file name */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
359 static language *curlang; /* current language */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
360
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
361 static int lineno; /* line number of current line */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
362 static long charno; /* current character number */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
363 static long linecharno; /* charno of start of current line */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
364 static char *dbp; /* pointer to start of current tag */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
365 static bool nocharno; /* only use line number when making tag */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
366 static const int invalidcharno = -1;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
367
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
368 static node *head; /* the head of the binary tree of tags */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
369
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
370 static linebuffer lb; /* the current line */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
371
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
372 /* boolean "functions" (see init) */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
373 static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
374 static char
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
375 /* white chars */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
376 *white = " \f\t\n\r\v",
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
377 /* not in a name */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
378 *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
379 /* 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
380 *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
381 /* token starting chars */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
382 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~@",
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
383 /* valid in-token chars */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
384 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789";
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
385
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
386 static bool append_to_tagfile; /* -a: append to tags */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
387 /* The following four default to TRUE for etags, but to FALSE for ctags. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
388 static bool typedefs; /* -t: create tags for C and Ada typedefs */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
389 static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 /* 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
391 /* member functions. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
392 static bool constantypedefs; /* -d: create tags for C #define, enum */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
393 /* constants and variables. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 /* -D: opposite of -d. Default under ctags. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
395 static bool declarations; /* --declarations: tag them and extern in C&Co*/
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
396 static bool globals; /* create tags for global variables */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
397 static bool no_line_directive; /* ignore #line directives */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
398 static bool members; /* create tags for C member variables */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
399 static bool update; /* -u: update tags */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
400 static bool vgrind_style; /* -v: create vgrind style index output */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
401 static bool no_warnings; /* -w: suppress warnings */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
402 static bool cxref_style; /* -x: create cxref style output */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
403 static bool cplusplus; /* .[hc] means C++, not C */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
404 static bool noindentypedefs; /* -I: ignore indentation in C */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
405 static bool packages_only; /* --packages-only: in Ada, only tag packages*/
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
406
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
407 #ifdef LONG_OPTIONS
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
408 static struct option longopts[] =
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
409 {
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
410 { "packages-only", no_argument, &packages_only, TRUE },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
411 { "append", no_argument, NULL, 'a' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
412 { "backward-search", no_argument, NULL, 'B' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
413 { "c++", no_argument, NULL, 'C' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
414 { "cxref", no_argument, NULL, 'x' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
415 { "defines", no_argument, NULL, 'd' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
416 { "declarations", no_argument, &declarations, TRUE },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
417 { "no-defines", no_argument, NULL, 'D' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
418 { "globals", no_argument, &globals, TRUE },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
419 { "no-globals", no_argument, &globals, FALSE },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
420 { "no-line-directive", no_argument, &no_line_directive, TRUE },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
421 { "help", no_argument, NULL, 'h' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
422 { "help", no_argument, NULL, 'H' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
423 { "ignore-indentation", no_argument, NULL, 'I' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
424 { "include", required_argument, NULL, 'i' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
425 { "language", required_argument, NULL, 'l' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
426 { "members", no_argument, &members, TRUE },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
427 { "no-members", no_argument, &members, FALSE },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
428 { "no-warn", no_argument, NULL, 'w' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
429 { "output", required_argument, NULL, 'o' },
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
430 #ifdef ETAGS_REGEXPS
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
431 { "regex", required_argument, NULL, 'r' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
432 { "no-regex", no_argument, NULL, 'R' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
433 { "ignore-case-regex", required_argument, NULL, '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
434 #endif /* ETAGS_REGEXPS */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
435 { "typedefs", no_argument, NULL, 't' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
436 { "typedefs-and-c++", no_argument, NULL, 'T' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
437 { "update", no_argument, NULL, 'u' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
438 { "version", no_argument, NULL, 'V' },
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
439 { "vgrind", no_argument, NULL, 'v' },
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
440 { NULL }
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
441 };
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
442 #endif /* LONG_OPTIONS */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
443
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
444 #ifdef ETAGS_REGEXPS
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
445 /* 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
446 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
447 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
448 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
449 struct pattern *p_next;
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
450 language *lang;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
451 char *regex;
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
452 struct re_pattern_buffer *pat;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
453 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
454 char *name_pattern;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
455 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
456 } 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
457
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
458 /* List of all regexps. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
459 static pattern *p_head = 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
460
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
461 /* 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
462 #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
463 /* Translation table for case-insensitive matching. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
464 static char lc_trans[CHAR_SET_SIZE];
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
465 #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
466
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
467 static compressor compressors[] =
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
468 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
469 { "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
470 { "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
471 { "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
472 { "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
473 { "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
474 { NULL }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
475 };
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
476
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
477 /*
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
478 * Language stuff.
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
479 */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
480
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
481 /* Non-NULL if language fixed. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
482 static language *forced_lang = 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
483
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
484 /* Ada code */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
485 static char *Ada_suffixes [] =
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
486 { "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
487
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
488 /* Assembly code */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
489 static char *Asm_suffixes [] =
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
490 { "a", /* Unix assembler */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
491 "asm", /* Microcontroller assembly */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
492 "def", /* BSO/Tasking definition includes */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
493 "inc", /* Microcontroller include files */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
494 "ins", /* Microcontroller include files */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
495 "s", "sa", /* Unix assembler */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
496 "S", /* cpp-processed Unix assembler */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
497 "src", /* BSO/Tasking C compiler output */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
498 NULL
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
499 };
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
500
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
501 /* Note that .c and .h can be considered C++, if the --c++ flag was
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
502 given, or if the `class' keyowrd is met inside the file.
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
503 That is why default_C_entries is called for these. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
504 static char *default_C_suffixes [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
505 { "c", "h", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
506
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
507 static char *Cplusplus_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
508 { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
509 "M", /* Objective C++ */
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
510 "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
511 NULL };
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
512
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
513 static char *Cjava_suffixes [] =
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
514 { "java", NULL };
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
515
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
516 static char *Cobol_suffixes [] =
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
517 { "COB", "cob", NULL };
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
518
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
519 static char *Cstar_suffixes [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
520 { "cs", "hs", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
521
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
522 static char *Erlang_suffixes [] =
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
523 { "erl", "hrl", NULL };
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
524
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
525 static char *Fortran_suffixes [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
526 { "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
527
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
528 static char *Lisp_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
529 { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
530
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
531 static char *Makefile_filenames [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
532 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
533
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
534 static char *Pascal_suffixes [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
535 { "p", "pas", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
536
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
537 static char *Perl_suffixes [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
538 { "pl", "pm", NULL };
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
539
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
540 static char *Perl_interpreters [] =
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
541 { "perl", "@PERL@", NULL };
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
542
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
543 static char *PHP_suffixes [] =
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
544 { "php", "php3", "php4", NULL };
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
545
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
546 static char *plain_C_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
547 { "lm", /* Objective lex file */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
548 "m", /* Objective C file */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
549 "pc", /* Pro*C file */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
550 NULL };
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
551
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
552 static 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
553 { "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
554
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
555 static char *Prolog_suffixes [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
556 { "prolog", NULL };
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
557
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
558 static char *Python_suffixes [] =
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
559 { "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
560
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
561 /* Can't do the `SCM' or `scm' prefix with a version number. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
562 static char *Scheme_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
563 { "oak", "sch", "scheme", "SCM", "scm", "SM", "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
564
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
565 static char *TeX_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
566 { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
567
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
568 static char *Texinfo_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
569 { "texi", "texinfo", "txi", NULL };
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
570
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
571 static char *Yacc_suffixes [] =
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
572 { "y", "y++", "ym", "yxx", "yy", 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
573
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
574 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
575 * 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
576 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
577 * 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
578 * 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
579 */
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
580
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
581 static language lang_names [] =
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
582 {
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
583 { "ada", Ada_funcs, NULL, Ada_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
584 { "asm", Asm_labels, NULL, Asm_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
585 { "c", default_C_entries, NULL, default_C_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
586 { "c++", Cplusplus_entries, NULL, Cplusplus_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
587 { "c*", Cstar_entries, NULL, Cstar_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
588 { "cobol", Cobol_paragraphs, NULL, Cobol_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
589 { "erlang", Erlang_functions, NULL, Erlang_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
590 { "fortran", Fortran_functions, NULL, Fortran_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
591 { "java", Cjava_entries, NULL, Cjava_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
592 { "lisp", Lisp_functions, NULL, Lisp_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
593 { "makefile", Makefile_targets, Makefile_filenames, NULL, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
594 { "pascal", Pascal_functions, NULL, Pascal_suffixes, NULL },
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
595 { "perl", Perl_functions, NULL, Perl_suffixes, Perl_interpreters },
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
596 { "php", PHP_functions, NULL, PHP_suffixes, NULL },
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
597 { "postscript", Postscript_functions, NULL, Postscript_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
598 { "proc", plain_C_entries, NULL, plain_C_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
599 { "prolog", Prolog_functions, NULL, Prolog_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
600 { "python", Python_functions, NULL, Python_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
601 { "scheme", Scheme_functions, NULL, Scheme_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
602 { "tex", TeX_commands, NULL, TeX_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
603 { "texinfo", Texinfo_nodes, NULL, Texinfo_suffixes, NULL },
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
604 { "yacc", Yacc_entries, NULL, Yacc_suffixes, NULL },
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
605 { "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
606 { "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
607 { 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
608 };
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
609
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
611 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
612 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
613 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
614 language *lang;
35302
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
615 char **name, **ext;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
616
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
617 puts ("\nThese are the currently supported languages, along with the\n\
35302
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
618 default file names and dot suffixes:");
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
619 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
620 {
35302
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
621 printf (" %-*s", 10, lang->name);
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
622 if (lang->filenames != NULL)
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
623 for (name = lang->filenames; *name != NULL; name++)
6a51ef53518f 2001-01-15 Francesco Potorti` <pot@pot.cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 35297
diff changeset
624 printf (" %s", *name);
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
625 if (lang->suffixes != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
626 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
627 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
628 puts ("");
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
629 }
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
630 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
631 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
632 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
633 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
634 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
635 Fortran is tried first; if no tags are found, C is tried next.\n\
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
636 When parsing any C file, a \"class\" keyword switches to C++.\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
637 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
638 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
639
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
640 #ifndef EMACS_NAME
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
641 # define EMACS_NAME "GNU Emacs"
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
642 #endif
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
643 #ifndef VERSION
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
644 # define VERSION "21"
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
645 #endif
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
646 static void
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
647 print_version ()
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
648 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
649 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
26083
134b57acef68 Add support for large files. Merge glibc 2.1.2.
Paul Eggert <eggert@twinsun.com>
parents: 24879
diff changeset
650 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
651 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
652
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
653 exit (GOOD);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
654 }
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
655
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
656 static void
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
657 print_help ()
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
658 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
659 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
660 \n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
661 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
662 #ifdef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
663 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
664 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
665 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
666 linked with GNU getopt.");
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
667 #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
668 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
669 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
670 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
671 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
672 puts ("\n");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
673
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
674 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
675 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
676
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
677 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
678 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
679
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
680 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
681 puts ("-B, --backward-search\n\
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
682 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
683 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
684
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
685 /* This option is mostly obsolete, because etags can now automatically
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
686 detect C++. Retained for backward compatibility and for debugging and
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
687 experimentation. In principle, we could want to tag as C++ even
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
688 before any "class" keyword.
4126
9a906e5f9b28 * etags.c (print_help): Break up the very long strings containing
Jim Blandy <jimb@redhat.com>
parents: 4052
diff changeset
689 puts ("-C, --c++\n\
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
690 Treat files whose name suffix defaults to C language as C++ files.");
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
691 */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
692
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
693 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
694 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
695 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
696 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
697 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
698 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
699 ("\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
700
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
701 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
702 puts ("-d, --defines\n\
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
703 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
704 else
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
705 puts ("-D, --no-defines\n\
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
706 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
707 This makes the tags file smaller.");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
708
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
709 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
710 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
711 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
712 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
713 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
714 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
715 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
716 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
717 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
718 }
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
719
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
720 if (CTAGS)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
721 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
722 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
723 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
724 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
725 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
726 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
727 puts ("--members\n\
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
728 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
729
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
730 #ifdef ETAGS_REGEXPS
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
731 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
732 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
733 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
734 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
735 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
736 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
737 For example Tcl named tags can be created with:\n\
37502
3b55af162cd3 (print_help): Enclose the regexp in the help text example in quotes.
Eli Zaretskii <eliz@gnu.org>
parents: 36361
diff changeset
738 --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
739 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
740 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
741 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
742 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
743 #endif /* ETAGS_REGEXPS */
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
744 puts ("-o FILE, --output=FILE\n\
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
745 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
746 puts ("-I, --ignore-indentation\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
747 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
748 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
749 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
750 definition in C and C++.");
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
751
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
752 if (CTAGS)
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
753 {
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
754 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
755 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
756 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
757 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
758 and C++ member functions.");
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
759 puts ("-u, --update\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
760 Update the tag entries for the given files, leaving tag\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
761 entries for other files in place. Currently, this is\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
762 implemented by deleting the existing entries for the given\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
763 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
764 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
765 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
766 puts ("-v, --vgrind\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
767 Generates an index of items intended for human consumption,\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
768 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
769 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
770 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
771 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
772 files.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
773 puts ("-x, --cxref\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
774 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
775 The output uses line numbers instead of page numbers, but\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
776 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
777 which you like.");
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
778 }
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
779
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
780 puts ("-V, --version\n\
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
781 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
782 -h, --help\n\
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
783 Print this help message.");
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
784
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
785 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
786
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
787 puts ("");
26323
98d99afb5ffb * etags.c (print_help): Change email address to send bugs to.
Gerd Moellmann <gerd@gnu.org>
parents: 26262
diff changeset
788 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
789
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
790 exit (GOOD);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
791 }
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
792
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
793
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
794 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
795 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
796 at_language,
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
797 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
798 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
799 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
800 };
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
801
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
802 /* 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
803 typedef struct
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 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
806 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
807 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
808 } argument;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
809
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
810 #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
811
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
812 #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
813
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
814 /* 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
815 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
816 #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
817 typedef struct {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
818 short curlen;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
819 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
820 } vspec;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
821
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 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
824 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
825 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
826 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
827 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
828 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
829 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
830 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
831 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
832
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
833 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
834 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
835 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
836 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
837 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
838
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
839 #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
840 #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
841 #define OUTSIZE MAX_FILE_SPEC_LEN
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
842 static short
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
843 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
844 vspec *out;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
845 char *in;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
846 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
847 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
848 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
849 static struct dsc$descriptor_s i;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
850 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
851 long status;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
852 short retval;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
853
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
854 if (pass1)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
855 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
856 pass1 = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
857 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
858 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
859 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
860 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
861 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
862 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
863 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
864 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
865 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
866 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
867 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
868 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
869 return 1;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
870 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
871 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
872 retval = 0;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
873 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
874 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
875 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
876 retval = -1;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
877 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
878 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
879 pass1 = TRUE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
880 return retval;
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
881 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
882
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
883 /*
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
884 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
885 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
886 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
887 static char *
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
888 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
889 char *arg;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
890 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
891 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
892 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
893
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
894 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
895 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
896 case 1:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
897 *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
898 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
899 case 0:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
900 *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
901 return NULL;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
902 default:
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
903 *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
904 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
905 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
906 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
907
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
908 #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
909 system (cmd)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
910 char *cmd;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
911 {
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
912 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
913 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
914 #endif
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
915
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
916 #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
917 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
918 char *s;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
919 {
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
920 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
921
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
922 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
923 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
924 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
925 *s = EOS;
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 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
928 else
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
929 *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
930 return start;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
931 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
932 #endif /* VMS */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
933
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
934
15683
5f9426e991a3 Declare main as int, not void.
Karl Heuer <kwzh@gnu.org>
parents: 15579
diff changeset
935 int
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 main (argc, argv)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 int argc;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938 char *argv[];
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 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
941 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
942 char **included_files;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943 char *this_file;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
944 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
945 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
946 linebuffer filename_lb;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 #ifdef VMS
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
948 bool got_err;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 #endif
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
950
9773
bd49556a7552 (main, etags_getcwd): Test DOS_NT instead of MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 9635
diff changeset
951 #ifdef DOS_NT
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
952 _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
953 #endif /* DOS_NT */
5448
18de002e47dd (main) [MSDOS]: Open all files as binary.
Richard M. Stallman <rms@gnu.org>
parents: 5044
diff changeset
954
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 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
956 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
957 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
958 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
959 file_count = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
961 /* 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
962 is small. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
963 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
964
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
965 #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
966 /* 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
967 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
968 /* 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
969 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
970 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
971 #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
972
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 * If etags, always find typedefs and structure tags. Why not?
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
975 * Also default 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
976 * global variables.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977 */
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
978 if (!CTAGS)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
979 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
980 typedefs = typedefs_or_cplusplus = constantypedefs = TRUE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
981 globals = TRUE;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
982 declarations = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
983 members = FALSE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
984 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
985
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
986 while (1)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
987 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
988 int opt;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
989 char *optstring;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
990
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
991 #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
992 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
993 #else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
994 optstring = "-aCdDf:Il:o:StTi:BuvxwVhH";
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
995 #endif /* ETAGS_REGEXPS */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
996
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
997 #ifndef LONG_OPTIONS
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
998 optstring = optstring + 1;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
999 #endif /* LONG_OPTIONS */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1000
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1001 opt = getopt_long (argc, argv, optstring, longopts, 0);
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1002 if (opt == EOF)
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1003 break;
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1004
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1005 switch (opt)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 {
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1007 case 0:
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1008 /* If getopt returns 0, then it has already processed a
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1009 long-named option. We should do nothing. */
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1010 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1012 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
1013 /* 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
1014 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
1015 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
1016 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1017 ++file_count;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1018 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1019
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1020 /* Common options. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1021 case 'a': append_to_tagfile = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1022 case 'C': cplusplus = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1023 case 'd': constantypedefs = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1024 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
1025 case 'f': /* for compatibility with old makefiles */
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1026 case 'o':
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1027 if (tagfile)
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1028 {
26507
aabdfbf65c68 1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26340
diff changeset
1029 error ("-o option may only be given once.", (char *)NULL);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1030 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1031 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1032 tagfile = optarg;
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1033 break;
10449
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
1034 case 'I':
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
1035 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
1036 noindentypedefs = TRUE;
2266157d9bcc * etags.c (longopts, print_help, main): Use -I as abbreviation
Francesco Potortì <pot@gnu.org>
parents: 10404
diff changeset
1037 break;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1038 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
1039 {
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1040 language *lang = get_language_from_langname (optarg);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1041 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
1042 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1043 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
1044 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
1045 ++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
1046 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1047 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1048 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1049 case 'r':
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1050 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
1051 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
1052 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1053 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1054 case 'R':
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1055 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
1056 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
1057 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1058 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
1059 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
1060 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
1061 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
1062 ++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
1063 break;
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1064 case 'V':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1065 print_version ();
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1066 break;
10047
9b284d98b102 * etags.c (print_help): print --regex usage for ctags also.
Francesco Potortì <pot@gnu.org>
parents: 9976
diff changeset
1067 case 'h':
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1068 case 'H':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1069 print_help ();
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1070 break;
8180
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
1071 case 't':
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1072 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
1073 break;
c98f9acb71e3 * etags.c (main): Don't barf on obsolete -t and -T switches.
Francesco Potortì <pot@gnu.org>
parents: 7776
diff changeset
1074 case 'T':
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1075 typedefs = typedefs_or_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
1076 break;
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1077 /* Etags options */
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1078 case 'i':
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1079 included_files[nincluded_files++] = optarg;
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1080 break;
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1081 /* Ctags options. */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1082 case 'B': searchar = '?'; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1083 case 'u': update = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1084 case 'v': vgrind_style = TRUE; /*FALLTHRU*/
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1085 case 'x': cxref_style = TRUE; break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1086 case 'w': no_warnings = TRUE; break;
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1087 default:
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1088 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1089 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1091
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1092 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
1093 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1094 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
1095 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
1096 ++current_arg;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1097 ++file_count;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1098 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1099
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1100 if (nincluded_files == 0 && file_count == 0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101 {
26507
aabdfbf65c68 1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26340
diff changeset
1102 error ("no input files specified.", (char *)NULL);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1103 suggest_asking_for_help ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1104 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1105
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1106 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
1107 tagfile = CTAGS ? "tags" : "TAGS";
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
1108 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
1109 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
1110 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1111 char *oldcwd = cwd;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1112 cwd = concat (oldcwd, "/", "");
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1113 free (oldcwd);
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
1114 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1115 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
1116 tagfiledir = cwd;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1117 else
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
1118 tagfiledir = absolute_dirname (tagfile, cwd);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1119
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1120 init (); /* set up boolean "functions" */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1121
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1122 initbuffer (&lb);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1123 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
1124
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1125 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1126 {
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1127 if (streq (tagfile, "-"))
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1128 {
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1129 tagf = stdout;
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1130 #ifdef DOS_NT
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1131 /* 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
1132 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
1133 if (!isatty (fileno (stdout)))
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1134 setmode (fileno (stdout), O_BINARY);
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1135 #endif /* DOS_NT */
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
1136 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 else
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1138 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
1139 if (tagf == NULL)
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
1140 pfatal (tagfile);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1141 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1142
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1143 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1144 * 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
1145 */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1146 for (i = 0; i < current_arg; ++i)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1147 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1148 switch (argbuffer[i].arg_type)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1149 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1150 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
1151 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
1152 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1153 #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
1154 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
1155 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
1156 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
1157 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
1158 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
1159 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1160 #endif
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1161 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
1162 #ifdef VMS
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1163 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
1164 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1165 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
1166 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1167 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
1168 argc--, argv++;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1169 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1170 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1171 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1172 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
1173 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1174 #else
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1175 this_file = argbuffer[i].what;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1176 #endif
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1177 /* 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
1178 (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
1179 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
1180 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
1181 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
1182 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1183 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
1184 #ifdef VMS
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1185 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1186 #endif
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1187 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1188 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
1189 }
10761
7aa80669e697 * etags.c (C_entries): Bug corrected in xrealloc of token_str.
Francesco Potortì <pot@gnu.org>
parents: 10754
diff changeset
1190
26262
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 #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
1192 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
1193 #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
1194
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1195 if (!CTAGS || cxref_style)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1196 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1197 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
1198 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
1199 head = NULL;
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1200 if (!CTAGS)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1201 while (nincluded_files-- > 0)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1202 fprintf (tagf, "\f\n%s,include\n", *included_files++);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1203
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1204 if (fclose (tagf) == EOF)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1205 pfatal (tagfile);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1206 exit (GOOD);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1207 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1208
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
1209 if (update)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1210 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1211 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
1212 for (i = 0; i < current_arg; ++i)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1213 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1214 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
1215 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1216 sprintf (cmd,
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1217 "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
1218 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
1219 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
1220 fatal ("failed to execute shell command", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1221 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1222 append_to_tagfile = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1223 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1224
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1225 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
1226 if (tagf == NULL)
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1227 pfatal (tagfile);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1228 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
1229 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
1230 head = NULL;
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1231 if (fclose (tagf) == EOF)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1232 pfatal (tagfile);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1233
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1234 if (update)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1235 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1236 char cmd[BUFSIZ];
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1237 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
1238 exit (system (cmd));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1239 }
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
1240 return GOOD;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1241 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1242
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1243
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1244
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1245 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1246 * 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
1247 * 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
1248 * 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
1249 * and EXTPTR is not significant.
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1250 * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998)
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1251 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1252 static compressor *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1253 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
1254 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
1255 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
1256 {
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 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
1258 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
1259
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1260 /* 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
1261 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
1262 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
1263 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
1264 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
1265 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
1266 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
1267 *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
1268 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
1269 /* 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
1270 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
1271 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
1272 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
1273 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1274 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
1275 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
1276 return compr;
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1277 if (!MSDOS)
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1278 break; /* do it only once: not really a loop */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1279 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
1280 *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
1281 } 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
1282 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
1283 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1284
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1285
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1286
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 /*
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 * 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
1289 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1290 static language *
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1291 get_language_from_langname (name)
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
1292 const char *name;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1293 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1294 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
1295
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1296 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
1297 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
1298 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
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 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
1301 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
1302 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
1303 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
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
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 return NULL;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1307 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1308
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1309
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1310 /*
26262
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 * 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
1312 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1313 static language *
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1314 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
1315 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
1316 {
26262
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 language *lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1318 char **iname;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1319
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1320 if (interpreter == NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1321 return NULL;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1322 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
1323 if (lang->interpreters != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1324 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
1325 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
1326 return lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1327
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1328 return NULL;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1329 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1330
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1331
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1332
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1333 /*
26262
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 * 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
1335 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1336 static language *
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1337 get_language_from_filename (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
1338 char *file;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1339 {
26262
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 language *lang;
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1341 char **name, **ext, *suffix;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1342
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1343 /* Try whole file name first. */
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1344 for (lang = lang_names; lang->name != NULL; lang++)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1345 if (lang->filenames != NULL)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1346 for (name = lang->filenames; *name != NULL; name++)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1347 if (streq (*name, file))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1348 return lang;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1349
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1350 /* If not found, try suffix after last dot. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1351 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
1352 if (suffix == NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1353 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
1354 suffix += 1;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1355 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
1356 if (lang->suffixes != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1357 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
1358 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
1359 return lang;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1360 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
1361 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1362
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1363
26262
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
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1365 /*
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1366 * This routine is called on each file argument.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1367 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1368 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1369 process_file (file)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1370 char *file;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1371 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1372 struct stat stat_buf;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1373 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
1374 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
1375 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
1376 char *ext, *real_name;
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1377 int retval;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
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
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 canonicalize_filename (file);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
1381 if (streq (file, tagfile) && !streq (tagfile, "-"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1382 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1383 error ("skipping inclusion of %s in self.", file);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1384 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1385 }
26262
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 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
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 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
1389 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
1390 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1391 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
1392 {
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 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
1394 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
1395 }
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
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 /* 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
1398 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
1399 {
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 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
1401 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1402 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
1403 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
1404 } 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
1405 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
1406 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
1407
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1408 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
1409 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
1410 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
1411 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
1412 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
1413 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
1414 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
1415 }
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
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1417 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
1418 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1419 /* 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
1420 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
1421 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
1422 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1423 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
1424 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
1425 }
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 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
1427 {
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 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
1429 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1430 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
1431 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
1432 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1433 if (MSDOS)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1434 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1435 char *suf = compressed_name + strlen (file);
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1436 size_t suflen = strlen (compr->suffix) + 1;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1437 for ( ; suf[1]; suf++, suflen--)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1438 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1439 memmove (suf, suf + 1, suflen);
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1440 if (stat (compressed_name, &stat_buf) == 0)
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1441 {
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1442 real_name = compressed_name;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1443 break;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1444 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1445 }
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1446 if (real_name != NULL)
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1447 break;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1448 } /* 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
1449 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
1450 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
1451 }
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 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
1453 {
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 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
1455 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
1456 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1457 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1458 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1459 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
1460 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1461 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
1462 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
1463 }
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 } /* 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
1465
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1466 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
1467 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1468 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
1469 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
1470 }
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 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
1472 {
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 char *cmd = concat (compr->command, " ", real_name);
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
1474 inf = (FILE *) popen (cmd, "r");
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1475 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
1476 }
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 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
1478 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
1479 if (inf == NULL)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1480 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1481 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
1482 goto exit;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1483 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1484
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1485 if (filename_is_absolute (uncompressed_name))
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1486 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1487 /* file is an absolute file name. Canonicalise it. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1488 curfile = absolute_filename (uncompressed_name, cwd);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1489 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1490 else
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1491 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1492 /* file is a file name relative to cwd. Make it relative
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1493 to the directory of the tags file. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1494 curfile = relative_filename (uncompressed_name, tagfiledir);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1495 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1496 nocharno = FALSE; /* use char position when making tags */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1497 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
1498
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1499 if (real_name == compressed_name)
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1500 retval = pclose (inf);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1501 else
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1502 retval = fclose (inf);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1503 if (retval < 0)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1504 pfatal (file);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1505
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1506 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
1507 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
1508 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
1509 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1510 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1511
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1512 /*
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3569
diff changeset
1513 * 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
1514 * by setting boolean flags dependent upon the corresponding character.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1515 * 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
1516 * all of the array "_wht" is set to FALSE, and then the elements
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1517 * subscripted by the chars in "white" are set to TRUE. Thus "_wht"
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1518 * of a char is TRUE if it is the string "white", else FALSE.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1519 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1520 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1521 init ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1522 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1523 register char *sp;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1524 register int i;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1525
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1526 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
1527 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
1528 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
1529 for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = TRUE;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1530 notinname('\0') = notinname('\n');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1531 for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = TRUE;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1532 begtoken('\0') = begtoken('\n');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1533 for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = TRUE;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1534 intoken('\0') = intoken('\n');
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1535 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
1536 endtoken('\0') = endtoken('\n');
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1537 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1538
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1539 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1540 * This routine opens the specified file and calls the function
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1541 * which finds the function and type definitions.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1542 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1543 static node *last_node = 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
1544
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1545 static void
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1546 find_entries (file, inf)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1547 char *file;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1548 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1549 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1550 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
1551 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
1552 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
1553
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1554 /* 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
1555 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
1556 if (lang != NULL && lang->function != NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1557 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1558 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
1559 lang->function (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1560 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1561 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1562
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1563 /* Try to guess the language given the file name. */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1564 lang = get_language_from_filename (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
1565 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
1566 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1567 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
1568 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
1569 return;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1570 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1571
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1572 /* 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
1573 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
1574 && lb.len >= 2
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1575 && lb.buffer[0] == '#'
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1576 && lb.buffer[1] == '!')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1577 {
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1578 char *lp;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1579
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1580 /* 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
1581 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
1582 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
1583 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
1584 if (lp != NULL)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1585 lp += 1;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1586 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
1587 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
1588 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
1589 *cp = '\0';
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1590
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1591 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
1592 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1593 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
1594 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
1595 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1596 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
1597 lang->function (inf);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1598 return;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1599 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1600 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1601 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1602 /* 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
1603 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
1604 which is unlikely. */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1605 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
1606
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1607 /* Try Fortran. */
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1608 old_last_node = last_node;
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1609 curlang = get_language_from_langname ("fortran");
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1610 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
1611
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
1612 /* 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
1613 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
1614 {
26262
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 /* 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
1616 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
1617 rewind (inf);
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
1618 curlang = get_language_from_langname (cplusplus ? "c++" : "c");
12344
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1619 default_C_entries (inf);
7e7941d8cceb * etags.c (find_entries): rewind before rereading the input file.
Francesco Potortì <pot@gnu.org>
parents: 12242
diff changeset
1620 }
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
1621 return;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1622 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1623
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1624
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1625 /* Record a tag. */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
1626 static void
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1627 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
1628 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
1629 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
1630 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
1631 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
1632 int lno; /* line number */
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1633 long cno; /* character number */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1634 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1635 register node *np;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1636
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1637 if (CTAGS && name == NULL)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1638 return;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1639
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1640 np = xnew (1, node);
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1641
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1642 /* 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
1643 if (CTAGS && !cxref_style && streq (name, "main"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1644 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1645 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
1646 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
1647 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
1648 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
1649 fp[0] = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1650 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1651 else
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
1652 np->name = name;
10623
8a73e71a55e3 * etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents: 10449
diff changeset
1653 np->been_warned = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1654 np->file = curfile;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1655 np->is_func = is_func;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1656 np->lno = lno;
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1657 if (nocharno)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1658 np->cno = invalidcharno;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1659 else
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1660 /* Our char numbers are 0-base, because of C language tradition?
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1661 ctags compatibility? old versions compatibility? I don't know.
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1662 Anyway, since emacs's are 1-base we expect etags.el to take care
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1663 of the difference. If we wanted to have 1-based numbers, we would
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1664 uncomment the +1 below. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1665 np->cno = cno /* + 1 */ ;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1666 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
1667 if (CTAGS && !cxref_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1668 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1669 if (strlen (linestart) < 50)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1670 np->pat = concat (linestart, "$", "");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1671 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1672 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
1673 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1674 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1675 np->pat = savenstr (linestart, linelen);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1676
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1677 add_node (np, &head);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1678 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1679
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1680 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1681 * TAGS format specification
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1682 * Idea by Sam Kendall <kendall@mv.mv.com> (1997)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1683 *
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1684 * 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
1685 * 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
1686 * 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
1687 * one character, substring;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1688 * 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
1689 * be one of the characters " \t(),;";
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1690 * 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
1691 * 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
1692 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1693 * The real implementation uses the notinname() macro, which recognises
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
1694 * characters slightly different from " \t\r\n(),;". See the 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
1695 * `nonam'.
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1696 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1697 #define traditional_tag_style TRUE
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
1698 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1699 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
1700 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
1701 int namelen; /* tag length */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1702 bool is_func; /* tag is a function */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1703 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
1704 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
1705 int lno; /* line number */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1706 long cno; /* character number */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1707 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1708 register char *cp;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1709 bool named;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1710
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1711 named = TRUE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1712 if (!CTAGS)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1713 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1714 for (cp = name; !notinname (*cp); cp++)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1715 continue;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1716 if (*cp == '\0') /* rule #1 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1717 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1718 cp = linestart + linelen - namelen;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1719 if (notinname (linestart[linelen-1]))
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1720 cp -= 1; /* rule #4 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1721 if (cp >= linestart /* rule #2 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1722 && (cp == linestart
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1723 || notinname (cp[-1])) /* rule #3 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1724 && strneq (name, cp, namelen)) /* rule #2 */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1725 named = FALSE; /* use unnamed tag */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1726 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1727 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1728
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1729 if (named)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1730 name = savenstr (name, namelen);
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1731 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1732 name = NULL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1733 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
1734 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1735
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1736 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1737 * free_tree ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1738 * recurse on left children, iterate on right children.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1739 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1740 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1741 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
1742 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1743 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1744 while (np)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1745 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1746 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
1747 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
1748 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
1749 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
1750 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
1751 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
1752 np = node_right;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1753 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1754 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1755
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1756 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1757 * add_node ()
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1758 * Adds a node to the tree of nodes. In etags mode, sort by file
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1759 * name. In ctags mode, sort by tag name. Make no attempt at
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1760 * balancing.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1761 *
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1762 * add_node is the only function allowed to add nodes, so it can
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1763 * maintain state.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1764 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1765 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1766 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
1767 node *np, **cur_node_p;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1768 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1769 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
1770 register node *cur_node = *cur_node_p;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1771
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1772 if (cur_node == NULL)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1773 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1774 *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
1775 last_node = np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1776 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1777 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1778
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1779 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1780 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1781 /* Etags Mode */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1782 assert (last_node != NULL);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1783 /* For each file name, tags are in a linked sublist on the right
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1784 pointer. The first tags of different files are a linked list
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1785 on the left pointer. last_node points to the end of the last
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1786 used sublist. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1787 if (last_node->file == np->file)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1788 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1789 /* Let's use the same sublist as the last added node. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1790 last_node->right = np;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1791 last_node = np;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1792 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1793 else if (streq (cur_node->file, np->file))
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1794 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1795 /* Scanning the list we found the head of a sublist which is
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1796 good for us. Let's scan this sublist. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1797 add_node (np, &cur_node->right);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1798 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1799 else
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1800 /* The head of this sublist is not good for us. Let's try the
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1801 next one. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1802 add_node (np, &cur_node->left);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1803 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1804 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1805 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1806 /* 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
1807 dif = strcmp (np->name, cur_node->name);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1808
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1809 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1810 * If this tag name matches an existing one, then
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1811 * do not add the node, but maybe print a warning.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1812 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1813 if (!dif)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1814 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1815 if (streq (np->file, cur_node->file))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1816 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1817 if (!no_warnings)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1818 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1819 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
1820 np->file, lineno, np->name);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1821 fprintf (stderr, "Second entry ignored\n");
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1822 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1823 }
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1824 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
1825 {
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1826 fprintf
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1827 (stderr,
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1828 "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
1829 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
1830 cur_node->been_warned = TRUE;
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
1831 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1832 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1833 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1834
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1835 /* 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
1836 add_node (np, dif < 0 ? &cur_node->left : &cur_node->right);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1837 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1838 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1839
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1840
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1841 #if !CTAGS
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1842 static int total_size_of_entries __P((node *));
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1843 static int number_len __P((long));
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1844
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1845 /* Length of a number's decimal representation. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1846 static int
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1847 number_len (num)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1848 long num;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1849 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1850 int len = 1;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1851 while ((num /= 10) > 0)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1852 len += 1;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1853 return len;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1854 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1855
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1856 /*
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1857 * Return total number of characters that put_entries will output for
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1858 * the nodes in the linked list at the right of the specified node.
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1859 * This count is irrelevant with etags.el since emacs 19.34 at least,
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1860 * but is still supplied for backward compatibility.
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1861 */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1862 static int
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1863 total_size_of_entries (np)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1864 register node *np;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1865 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1866 register int total = 0;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1867
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1868 for (; np != NULL; np = np->right)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1869 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1870 total += strlen (np->pat) + 1; /* pat\177 */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1871 if (np->name != NULL)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1872 total += strlen (np->name) + 1; /* name\001 */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1873 total += number_len ((long) np->lno) + 1; /* lno, */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1874 if (np->cno != invalidcharno) /* cno */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1875 total += number_len (np->cno);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1876 total += 1; /* newline */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1877 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1878
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1879 return total;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1880 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1881 #endif
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1882
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
1883 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1884 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
1885 register node *np;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1886 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
1887 register char *sp;
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1888 static char *file = NULL;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1889
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1890 if (np == NULL)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1891 return;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1892
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1893 /* Output subentries that precede this one */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1894 if (CTAGS)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1895 put_entries (np->left);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1896
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1897 /* Output this entry */
6530
12e47da67bb5 * etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
Francesco Potortì <pot@gnu.org>
parents: 6482
diff changeset
1898 if (!CTAGS)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1899 {
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1900 /* Etags mode */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1901 if (file != np->file
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1902 && (file == NULL || !streq (file, np->file)))
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1903 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1904 file = np->file;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1905 fprintf (tagf, "\f\n%s,%d\n",
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1906 file, total_size_of_entries (np));
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1907 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1908 fputs (np->pat, tagf);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1909 fputc ('\177', tagf);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1910 if (np->name != NULL)
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1911 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1912 fputs (np->name, tagf);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1913 fputc ('\001', tagf);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1914 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1915 fprintf (tagf, "%d,", np->lno);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1916 if (np->cno == invalidcharno)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1917 fputc ('\n', tagf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1918 else
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1919 fprintf (tagf, "%ld\n", np->cno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1920 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1921 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1922 {
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1923 /* 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
1924 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
1925 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
1926
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1927 if (cxref_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1928 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1929 if (vgrind_style)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1930 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
1931 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
1932 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1933 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
1934 np->name, np->lno, np->file, np->pat);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1935 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1936 else
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1937 {
26262
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 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
1939
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 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
1941 { /* a function */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1942 putc (searchar, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1943 putc ('^', tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1944
26262
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 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
1946 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1947 if (*sp == '\\' || *sp == searchar)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1948 putc ('\\', tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1949 putc (*sp, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1950 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1951 putc (searchar, tagf);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1952 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1953 else
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1954 { /* 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
1955 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
1956 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
1957 putc ('\n', tagf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1958 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1959 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1960
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1961
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1962 /* 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
1963 put_entries (np->right);
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1964 if (!CTAGS)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
1965 put_entries (np->left);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1966 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
1967
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1968
35740
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1969 /* C extensions. */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1970 #define C_EXT 0x00fff /* C extensions */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1971 #define C_PLAIN 0x00000 /* C */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1972 #define C_PLPL 0x00001 /* C++ */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1973 #define C_STAR 0x00003 /* C* */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1974 #define C_JAVA 0x00005 /* JAVA */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1975 #define C_AUTO 0x01000 /* C, but switch to C++ if `class' is met */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1976 #define YACC 0x10000 /* yacc file */
9a7c0217c7bd Comment updates to etags.c
Francesco Potortì <pot@gnu.org>
parents: 35665
diff changeset
1977
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1978 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1979 * The C symbol tables.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1980 */
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1981 enum sym_type
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
1982 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1983 st_none,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1984 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
1985 st_C_gnumacro,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1986 st_C_ignore,
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
1987 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
1988 st_C_operator,
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
1989 st_C_class, st_C_template,
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
1990 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
1991 };
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1992
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
1993 static unsigned int hash __P((const char *, unsigned int));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
1994 static struct C_stab_entry * in_word_set __P((const char *, unsigned int));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
1995 static enum sym_type C_symtype __P((char *, int, int));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
1996
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
1997 /* 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
1998 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
1999 %[
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2000 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
2001 %%
26262
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 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
2003 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
2004 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
2005 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
2006 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
2007 @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
2008 @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
2009 @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
2010 @end, 0, st_C_objend
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2011 import, C_JAVA, st_C_ignore
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2012 package, C_JAVA, st_C_ignore
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2013 friend, C_PLPL, st_C_ignore
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
2014 extends, C_JAVA, st_C_javastruct
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
2015 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
2016 interface, C_JAVA, st_C_struct
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2017 class, 0, st_C_class
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2018 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
2019 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
2020 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
2021 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
2022 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
2023 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
2024 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
2025 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
2026 operator, C_PLPL, st_C_operator
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2027 template, 0, st_C_template
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2028 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
2029 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
2030 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
2031 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
2032 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
2033 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
2034 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
2035 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
2036 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
2037 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
2038 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
2039 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
2040 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
2041 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
2042 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
2043 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
2044 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
2045 # 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
2046 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
2047 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
2048 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
2049 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
2050 # 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
2051 # 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
2052 #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
2053 #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
2054 %]
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2055 and replace lines between %< and %> with its output,
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2056 then make in_word_set and C_stab_entry static. */
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2057 /*%<*/
26262
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 /* 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
2059 /* 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
2060 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
2061
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2062 #define TOTAL_KEYWORDS 47
26262
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 #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
2064 #define MAX_WORD_LENGTH 15
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2065 #define MIN_HASH_VALUE 18
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2066 #define MAX_HASH_VALUE 138
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2067 /* maximum key range = 121, duplicates = 0 */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2068
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 #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
2070 __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
2071 #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
2072 static unsigned int
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2073 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
2074 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
2075 register unsigned int len;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2076 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2077 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
2078 {
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2079 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2080 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2081 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2082 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2083 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2084 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2085 139, 139, 139, 139, 63, 139, 139, 139, 33, 44,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2086 62, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2087 42, 139, 139, 12, 32, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2088 139, 139, 139, 139, 139, 139, 139, 34, 59, 37,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2089 24, 58, 33, 3, 139, 16, 139, 139, 42, 60,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2090 18, 11, 39, 139, 23, 57, 4, 63, 6, 20,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2091 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2092 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2093 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2094 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2095 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2096 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2097 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2098 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2099 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2100 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2101 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2102 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2103 139, 139, 139, 139, 139, 139, 139, 139, 139, 139,
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2104 139, 139, 139, 139, 139, 139
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2105 };
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2106 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
2107
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2108 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
2109 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2110 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
2111 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
2112 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
2113 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
2114 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
2115 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
2116 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
2117 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2118 return hval;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2119 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
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 #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
2122 __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
2123 #endif
35766
3584fc1b9b79 (in_word_set): Use `static' in definition (for pcc).
Dave Love <fx@gnu.org>
parents: 35758
diff changeset
2124 static struct C_stab_entry *
15579
690a439bcc0e * etags.c (C_stab_entry): New keywords for C++ namespace, bool,
Francesco Potortì <pot@gnu.org>
parents: 15407
diff changeset
2125 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
2126 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
2127 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
2128 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2129 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
2130 {
26262
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 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2132 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2133 {"if", 0, st_C_ignore},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2134 {""}, {""}, {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2135 {"int", 0, 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
2136 {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2137 {"void", 0, st_C_typespec},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2138 {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2139 {"interface", C_JAVA, st_C_struct},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2140 {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2141 {"SYSCALL", 0, st_C_gnumacro},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2142 {""},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2143 {"return", 0, st_C_ignore},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2144 {""}, {""}, {""}, {""}, {""}, {""}, {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2145 {"while", 0, st_C_ignore},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2146 {"auto", 0, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2147 {""}, {""}, {""}, {""}, {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2148 {"float", 0, st_C_typespec},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2149 {"typedef", 0, st_C_typedef},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2150 {"typename", C_PLPL, st_C_typespec},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2151 {""}, {""}, {""},
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2152 {"friend", C_PLPL, st_C_ignore},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2153 {"volatile", 0, st_C_typespec},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2154 {""}, {""},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2155 {"for", 0, st_C_ignore},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2156 {"const", 0, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2157 {"import", C_JAVA, st_C_ignore},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2158 {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2159 {"define", 0, st_C_define},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2160 {"long", 0, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2161 {"implements", C_JAVA, st_C_javastruct},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2162 {"signed", 0, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2163 {""},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2164 {"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
2165 {"extends", C_JAVA, st_C_javastruct},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2166 {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2167 {"mutable", C_PLPL, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2168 {"template", 0, st_C_template},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2169 {"short", 0, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2170 {"bool", C_PLPL, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2171 {"char", 0, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2172 {"class", 0, st_C_class},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2173 {"operator", C_PLPL, st_C_operator},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2174 {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2175 {"switch", 0, st_C_ignore},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2176 {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2177 {"ENTRY", 0, st_C_gnumacro},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2178 {""},
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2179 {"package", C_JAVA, st_C_ignore},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2180 {"union", 0, st_C_struct},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2181 {"@end", 0, st_C_objend},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2182 {"struct", 0, st_C_struct},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2183 {"namespace", C_PLPL, st_C_struct},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2184 {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2185 {"domain", C_STAR, st_C_struct},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2186 {"@interface", 0, st_C_objprot},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2187 {"PSEUDO", 0, st_C_gnumacro},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2188 {"double", 0, st_C_typespec},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2189 {""},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2190 {"@protocol", 0, st_C_objprot},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2191 {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2192 {"static", 0, 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
2193 {""}, {""},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2194 {"DEFUN", 0, st_C_gnumacro},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2195 {""}, {""}, {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2196 {"explicit", C_PLPL, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2197 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2198 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2199 {""},
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2200 {"enum", 0, 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
2201 {""}, {""},
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2202 {"unsigned", 0, st_C_typespec},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2203 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2204 {"@implementation",0, st_C_objimpl}
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2205 };
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2206
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2207 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
2208 {
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2209 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
2210
26262
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 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
2212 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2213 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
2214
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2215 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
2216 return &wordlist[key];
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2217 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2218 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2219 return 0;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2220 }
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2221 /*%>*/
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2222
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
2223 static enum sym_type
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
2224 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
2225 char *str;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2226 int len;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2227 int c_ext;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2228 {
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
2229 register struct C_stab_entry *se = in_word_set (str, len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2230
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2231 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
2232 return st_none;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2233 return se->type;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2234 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2235
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2236
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2237 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2238 * C functions and variables are recognized using a simple
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2239 * finite automaton. fvdef is its state variable.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2240 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2241 static enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2242 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2243 fvnone, /* nothing seen */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2244 fdefunkey, /* Emacs DEFUN keyword seen */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2245 fdefunname, /* Emacs DEFUN name seen */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2246 foperator, /* func: operator keyword seen (cplpl) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2247 fvnameseen, /* function or variable name seen */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2248 fstartlist, /* func: just after open parenthesis */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2249 finlist, /* func: in parameter list */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2250 flistseen, /* func: after parameter list */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2251 fignore, /* func: before open brace */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2252 vignore /* var-like: ignore until ';' */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2253 } fvdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2254
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2255 static bool fvextern; /* func or var: extern keyword seen; */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2256
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2257 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2258 * typedefs are recognized using a simple finite automaton.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2259 * typdef is its state variable.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2260 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2261 static enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2262 {
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
2263 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
2264 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
2265 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
2266 tinbody, /* inside typedef body */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2267 tend, /* just before typedef tag */
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2268 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
2269 } typdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2270
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2271 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2272 * struct-like structures (enum, struct and union) are recognized
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2273 * using another simple finite automaton. `structdef' is its state
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2274 * variable.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2275 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2276 static enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2277 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2278 snone, /* nothing seen yet,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2279 or in struct body if cblev > 0 */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2280 skeyseen, /* struct-like keyword seen */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2281 stagseen, /* struct-like tag seen */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2282 sintemplate, /* inside template (ignore) */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2283 scolonseen /* colon seen after struct-like tag */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2284 } structdef;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2285
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2286 /*
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2287 * 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
2288 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2289 static char *objtag = "<uninited>";
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2290
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2291 /*
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2292 * 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
2293 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2294 static enum
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2295 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2296 dnone, /* nothing seen */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2297 dsharpseen, /* '#' seen as first char on line */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2298 ddefineseen, /* '#' and 'define' seen */
5044
d3bd7baee39f (FUNCST, TYPEDST, STRUCTST, DEFINEST): Delete excess commas.
Richard M. Stallman <rms@gnu.org>
parents: 4937
diff changeset
2299 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
2300 } definedef;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2301
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2302 /*
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2303 * State machine for Objective C protocols and implementations.
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2304 * Idea by Tom R.Hageman <tom@basil.icce.rug.nl> (1995)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2305 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2306 static enum
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2307 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2308 onone, /* nothing seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2309 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
2310 oimplementation, /* @implementations seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2311 otagseen, /* class name seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2312 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
2313 ocatseen, /* category name seen */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2314 oinbody, /* in @implementation body */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2315 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
2316 omethodtag, /* after method name */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2317 omethodcolon, /* after method colon */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2318 omethodparm, /* after method parameter */
14230
6b836f84bccf (enum sym_type, anonymous enum): Delete final comma.
Karl Heuer <kwzh@gnu.org>
parents: 14186
diff changeset
2319 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
2320 } objdef;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2321
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2322
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2323 /*
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2324 * 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
2325 * 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
2326 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2327 static struct tok
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2328 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2329 bool valid;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2330 bool named;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2331 int offset;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2332 int length;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2333 int lineno;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2334 long linepos;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2335 char *line;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2336 } token; /* latest token read */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2337 static linebuffer token_name; /* its name */
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2338
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2339 /*
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2340 * Variables and functions for dealing with nested structures.
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2341 * Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2342 */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
2343 static void pushclass_above __P((int, char *, int));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
2344 static void popclass_above __P((int));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
2345 static void write_classname __P((linebuffer *, char *qualifier));
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2346
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2347 static struct {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2348 char **cname; /* nested class names */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2349 int *cblev; /* nested class curly brace level */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2350 int nl; /* class nesting level (elements used) */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2351 int size; /* length of the array */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2352 } cstack; /* stack for nested declaration tags */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2353 /* Current struct nesting depth (namespace, class, struct, union, enum). */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2354 #define nestlev (cstack.nl)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2355 /* After struct keyword or in struct body, not inside an nested function. */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2356 #define instruct (structdef == snone && nestlev > 0 \
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2357 && cblev == cstack.cblev[nestlev-1] + 1)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2358
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2359 static void
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2360 pushclass_above (cblev, str, len)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2361 int cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2362 char *str;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2363 int len;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2364 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2365 int nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2366
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2367 popclass_above (cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2368 nl = cstack.nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2369 if (nl >= cstack.size)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2370 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2371 int size = cstack.size *= 2;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2372 xrnew (cstack.cname, size, char *);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2373 xrnew (cstack.cblev, size, int);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2374 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2375 assert (nl == 0 || cstack.cblev[nl-1] < cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2376 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2377 cstack.cblev[nl] = cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2378 cstack.nl = nl + 1;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2379 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2380
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2381 static void
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2382 popclass_above (cblev)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2383 int cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2384 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2385 int nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2386
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2387 for (nl = cstack.nl - 1;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2388 nl >= 0 && cstack.cblev[nl] >= cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2389 nl--)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2390 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2391 if (cstack.cname[nl] != NULL)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2392 free (cstack.cname[nl]);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2393 cstack.nl = nl;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2394 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2395 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2396
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2397 static void
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2398 write_classname (cn, qualifier)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2399 linebuffer *cn;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2400 char *qualifier;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2401 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2402 int i, len;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2403 int qlen = strlen (qualifier);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2404
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2405 if (cstack.nl == 0 || cstack.cname[0] == NULL)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2406 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2407 len = 0;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2408 cn->len = 0;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2409 cn->buffer[0] = '\0';
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2410 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2411 else
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2412 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2413 len = strlen (cstack.cname[0]);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2414 linebuffer_setlen (cn, len);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2415 strcpy (cn->buffer, cstack.cname[0]);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2416 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2417 for (i = 1; i < cstack.nl; i++)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2418 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2419 char *s;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2420 int slen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2421
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2422 s = cstack.cname[i];
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2423 if (s == NULL)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2424 continue;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2425 slen = strlen (s);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2426 len += slen + qlen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2427 linebuffer_setlen (cn, len);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2428 strncat (cn->buffer, qualifier, qlen);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2429 strncat (cn->buffer, s, slen);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2430 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2431 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2432
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2433
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
2434 static bool consider_token __P((char *, int, int, int *, int, int, bool *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
2435 static void make_C_tag __P((bool));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
2436
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2437 /*
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2438 * consider_token ()
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2439 * 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
2440 * 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
2441 * 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
2442 *
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2443 * *IS_FUNC gets TRUE iff the token is a function or #define macro
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2444 * with args. C_EXTP points to which language we are looking at.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2445 *
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2446 * Globals
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2447 * fvdef IN OUT
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2448 * structdef IN OUT
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2449 * definedef IN OUT
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2450 * typdef IN OUT
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2451 * objdef IN OUT
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2452 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2453
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
2454 static bool
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2455 consider_token (str, len, c, c_extp, 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
2456 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
2457 register int len; /* IN: token length */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
2458 register int c; /* IN: first char after the token */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2459 int *c_extp; /* IN, OUT: C extensions mask */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2460 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
2461 int parlev; /* IN: parenthesis level */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2462 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
2463 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2464 /* When structdef is stagseen, scolonseen, or snone with cblev > 0,
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2465 structtype is the type of the preceding struct-like keyword, and
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2466 structcblev is the curly brace level where it has been seen. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2467 static enum sym_type structtype;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2468 static int structcblev;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2469 static enum sym_type toktype;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2470
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2471
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2472 toktype = C_symtype (str, len, *c_extp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2473
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2474 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2475 * Advance the definedef state machine.
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2476 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2477 switch (definedef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2478 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2479 case dnone:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2480 /* We're not on a preprocessor line. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2481 if (toktype == st_C_gnumacro)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2482 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2483 fvdef = fdefunkey;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2484 return FALSE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2485 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2486 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2487 case dsharpseen:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2488 if (toktype == st_C_define)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2489 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2490 definedef = ddefineseen;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2491 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2492 else
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2493 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2494 definedef = dignorerest;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2495 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2496 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2497 case ddefineseen:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2498 /*
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2499 * 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
2500 * and constantypedefs is FALSE.
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2501 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2502 definedef = dignorerest;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2503 *is_func_or_var = (c == '(');
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2504 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
2505 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2506 else
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2507 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2508 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
2509 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2510 default:
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2511 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
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 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2515 * Now typedefs
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2516 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2517 switch (typdef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2518 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2519 case tnone:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2520 if (toktype == st_C_typedef)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2521 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2522 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
2523 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
2524 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2525 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
2526 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2527 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2528 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
2529 case tkeyseen:
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2530 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2531 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2532 case st_none:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2533 case st_C_typespec:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2534 case st_C_class:
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2535 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2536 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
2537 typdef = ttypeseen;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2538 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2539 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2540 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2541 case ttypeseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2542 if (structdef == snone && fvdef == fvnone)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2543 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2544 fvdef = fvnameseen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2545 return TRUE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2546 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2547 break;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2548 case tend:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2549 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2550 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2551 case st_C_typespec:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2552 case st_C_class:
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2553 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2554 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
2555 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2556 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2557 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2558 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2559
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2560 /*
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2561 * 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
2562 * 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
2563 * 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
2564 */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2565 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2566 {
17785
5b92f8ba5c6d Added support for the Java language.
Francesco Potortì <pot@gnu.org>
parents: 17778
diff changeset
2567 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
2568 if (structdef == stagseen)
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2569 structdef = scolonseen;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
2570 return FALSE;
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2571 case st_C_template:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2572 case st_C_class:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2573 if (cblev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2574 && (*c_extp & C_AUTO) /* automatic detection of C++ language */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2575 && definedef == dnone && structdef == snone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2576 && typdef == tnone && fvdef == fvnone)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2577 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2578 if (toktype == st_C_template)
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2579 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2580 /* FALLTHRU */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2581 case st_C_struct:
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2582 case st_C_enum:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2583 if (parlev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2584 && fvdef != vignore
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2585 && (typdef == tkeyseen
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2586 || (typedefs_or_cplusplus && structdef == snone)))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2587 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2588 structdef = skeyseen;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2589 structtype = toktype;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2590 structcblev = cblev;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2591 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2592 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2593 }
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2594
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2595 if (structdef == skeyseen)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2596 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2597 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
2598 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2599 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2600
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2601 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
2602 definedef = dnone;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2603
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2604 /* 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
2605 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2606 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2607 case onone:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2608 switch (toktype)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2609 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2610 case st_C_objprot:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2611 objdef = oprotocol;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2612 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2613 case st_C_objimpl:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2614 objdef = oimplementation;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2615 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2616 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2617 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2618 case oimplementation:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2619 /* 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
2620 objtag = savenstr (str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2621 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2622 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2623 case oprotocol:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2624 /* 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
2625 objtag = savenstr (str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2626 objdef = otagseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2627 *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
2628 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2629 case oparenseen:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2630 objdef = ocatseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2631 *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
2632 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2633 case oinbody:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2634 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2635 case omethodsign:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2636 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2637 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2638 objdef = omethodtag;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2639 linebuffer_setlen (&token_name, len);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2640 strncpy (token_name.buffer, str, len);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2641 token_name.buffer[len] = '\0';
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2642 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2643 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2644 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2645 case omethodcolon:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2646 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2647 objdef = omethodparm;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2648 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2649 case omethodparm:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2650 if (parlev == 0)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2651 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2652 objdef = omethodtag;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2653 linebuffer_setlen (&token_name, 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
2654 strncat (token_name.buffer, str, len);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2655 return TRUE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2656 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2657 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2658 case oignore:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2659 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
2660 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2661 /* 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
2662 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
2663 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
2664 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
2665 class tags.
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2666 free (objtag); */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2667 objdef = onone;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2668 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2669 return FALSE;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2670 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2671
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2672 /* 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
2673 switch (toktype)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2674 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2675 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
2676 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
2677 /* FALLTHRU */
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2678 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
2679 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
2680 fvdef = fvnone; /* should be useless */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2681 return FALSE;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2682 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
2683 fvextern = FALSE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2684 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
2685 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
2686 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
2687 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
2688 *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
2689 return TRUE;
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
2690 case st_none:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2691 if (constantypedefs
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2692 && structdef == snone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2693 && structtype == st_C_enum && cblev > structcblev)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2694 return TRUE; /* enum constant */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2695 switch (fvdef)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2696 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2697 case fdefunkey:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2698 if (cblev > 0)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2699 break;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2700 fvdef = fdefunname; /* GNU macro */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2701 *is_func_or_var = TRUE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2702 return TRUE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2703 case fvnone:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2704 if ((strneq (str, "asm", 3) && endtoken (str[3]))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2705 || (strneq (str, "__asm__", 7) && endtoken (str[7])))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2706 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2707 fvdef = vignore;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2708 return FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2709 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2710 if ((*c_extp & C_PLPL) && strneq (str+len-10, "::operator", 10))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2711 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2712 fvdef = foperator;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2713 *is_func_or_var = TRUE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2714 return TRUE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2715 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2716 if (cblev > 0 && !instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2717 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2718 fvdef = fvnameseen; /* function or variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2719 *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
2720 return TRUE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2721 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2722 break;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2723 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2724
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
2725 return FALSE;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2726 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2727
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2728
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2729 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2730 * C_entries often keeps pointers to tokens or lines which are older than
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2731 * the line currently read. By keeping two line buffers, and switching
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2732 * them at end of line, it is possible to use those pointers.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2733 */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
2734 static struct
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2735 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2736 long linepos;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2737 linebuffer lb;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2738 } lbs[2];
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2739
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2740 #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
2741 #define switch_line_buffers() (curndx = 1 - curndx)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2742
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2743 #define curlb (lbs[curndx].lb)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2744 #define newlb (lbs[newndx].lb)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2745 #define curlinepos (lbs[curndx].linepos)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2746 #define newlinepos (lbs[newndx].linepos)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2747
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2748 #define CNL_SAVE_DEFINEDEF() \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2749 do { \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2750 curlinepos = charno; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2751 lineno++; \
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
2752 linecharno = charno; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2753 charno += readline (&curlb, inf); \
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2754 lp = curlb.buffer; \
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2755 quotednl = FALSE; \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2756 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
2757 } while (0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2758
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2759 #define CNL() \
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2760 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
2761 CNL_SAVE_DEFINEDEF(); \
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2762 if (savetoken.valid) \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2763 { \
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2764 token = savetoken; \
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2765 savetoken.valid = FALSE; \
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
2766 } \
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2767 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
2768 } while (0)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2769
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2770
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
2771 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2772 make_C_tag (isfun)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2773 bool isfun;
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2774 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2775 /* This function should never be called when token.valid is FALSE, but
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2776 we must protect against invalid input or internal errors. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2777 if (DEBUG || token.valid)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2778 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2779 if (traditional_tag_style)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2780 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2781 /* 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
2782 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
2783 char *name = NULL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2784
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2785 if (CTAGS || token.named)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2786 name = savestr (token_name.buffer);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2787 if (DEBUG && !token.valid)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2788 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2789 if (token.named)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2790 name = concat (name, "##invalid##", "");
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2791 else
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2792 name = savestr ("##invalid##");
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2793 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2794 pfnote (name, isfun, token.line,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2795 token.offset+token.length+1, token.lineno, token.linepos);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2796 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2797 else
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2798 new_pfnote (token_name.buffer, token_name.len, isfun, token.line,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2799 token.offset+token.length+1, token.lineno, token.linepos);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2800 token.valid = FALSE;
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2801 }
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2802 }
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
2803
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2804
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2805 /*
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2806 * C_entries ()
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2807 * This routine finds functions, variables, typedefs,
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2808 * #define's, enum constants and struct/union/enum definitions in
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2809 * C syntax and adds them to the list.
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2810 */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
2811 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
2812 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
2813 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
2814 FILE *inf; /* input file */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2815 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2816 register char c; /* latest char read; '\0' for end of line */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2817 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
2818 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
2819 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
2820 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
2821 char *qualifier; /* string used to qualify names */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2822 int qlen; /* length of qualifier */
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2823 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
2824 int parlev; /* current parenthesis level */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2825 int typdefcblev; /* cblev where a typedef struct body begun */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2826 bool incomm, inquote, inchar, quotednl, midtoken;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2827 bool cplpl, cjava;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2828 bool yacc_rules; /* in the rules part of a yacc file */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2829 struct tok savetoken; /* token saved during preprocessor handling */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2830
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2831
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2832 initbuffer (&token_name);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2833 initbuffer (&lbs[0].lb);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2834 initbuffer (&lbs[1].lb);
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2835 if (cstack.size == 0)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2836 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2837 cstack.size = (DEBUG) ? 1 : 4;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2838 cstack.nl = 0;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2839 cstack.cname = xnew (cstack.size, char *);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2840 cstack.cblev = xnew (cstack.size, int);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2841 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2842
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
2843 tokoff = toklen = typdefcblev = 0; /* keep compiler quiet */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2844 curndx = newndx = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2845 lineno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2846 charno = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2847 lp = curlb.buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2848 *lp = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2849
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2850 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
2851 structdef = snone; definedef = dnone; objdef = onone;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2852 yacc_rules = FALSE;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2853 midtoken = inquote = inchar = incomm = quotednl = FALSE;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2854 token.valid = savetoken.valid = FALSE;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2855 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
2856 parlev = 0;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2857 cplpl = (c_ext & C_PLPL) == C_PLPL;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2858 cjava = (c_ext & C_JAVA) == C_JAVA;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2859 if (cjava)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2860 { qualifier = "."; qlen = 1; }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2861 else
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2862 { qualifier = "::"; qlen = 2; }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2863
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2864
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2865 while (!feof (inf))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2866 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2867 c = *lp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2868 if (c == '\\')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2869 {
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 462
diff changeset
2870 /* 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
2871 '\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
2872 to read the next line. */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2873 if (*lp == '\0')
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2874 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2875 quotednl = TRUE;
2004
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2876 continue;
6469a137fea6 (C_entries): New local variable quotednl. Used for
Richard M. Stallman <rms@gnu.org>
parents: 1938
diff changeset
2877 }
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
2878 lp++;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2879 c = ' ';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2880 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2881 else if (incomm)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2882 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2883 switch (c)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2884 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2885 case '*':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2886 if (*lp == '/')
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2887 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2888 c = *lp++;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2889 incomm = FALSE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2890 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2891 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2892 case '\0':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2893 /* 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
2894 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
2895 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2896 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2897 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2898 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2899 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2900 else if (inquote)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2901 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2902 switch (c)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2903 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2904 case '"':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2905 inquote = FALSE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2906 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2907 case '\0':
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2908 /* 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
2909 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
2910 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
2911 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2912 break;
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 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2915 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2916 else if (inchar)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2917 {
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2918 switch (c)
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2919 {
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2920 case '\0':
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2921 /* 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
2922 CNL ();
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2923 /* FALLTHRU */
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2924 case '\'':
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2925 inchar = FALSE;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2926 break;
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
2927 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2928 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2929 }
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
2930 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2931 switch (c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2932 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2933 case '"':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2934 inquote = TRUE;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2935 switch (fvdef)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2936 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2937 case fdefunkey:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2938 case fstartlist:
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2939 case finlist:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2940 case fignore:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2941 case vignore:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2942 break;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
2943 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
2944 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
2945 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
2946 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2947 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2948 case '\'':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2949 inchar = TRUE;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2950 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
2951 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
2952 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
2953 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
2954 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2955 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2956 case '/':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2957 if (*lp == '*')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2958 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2959 lp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2960 incomm = TRUE;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2961 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2962 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2963 else if (/* cplpl && */ *lp == '/')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2964 {
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
2965 c = '\0';
727
540b047ece4d *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 621
diff changeset
2966 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2967 }
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
2968 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
2969 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2970 case '%':
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2971 if ((c_ext & YACC) && *lp == '%')
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2972 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
2973 /* Entering or exiting rules section in yacc file. */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2974 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
2975 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
2976 typdef = tnone; structdef = snone;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2977 midtoken = inquote = inchar = incomm = quotednl = FALSE;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2978 cblev = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2979 yacc_rules = !yacc_rules;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
2980 continue;
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
2981 }
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
2982 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
2983 break;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2984 case '#':
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2985 if (definedef == dnone)
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2986 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2987 char *cp;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
2988 bool cpptoken = TRUE;
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2989
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2990 /* 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
2991 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
2992 token. */
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2993 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
2994 if (!iswhite (*cp))
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2995 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2996 if (*cp == '*' && *(cp+1) == '/')
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2997 {
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2998 cp++;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
2999 cpptoken = TRUE;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3000 }
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3001 else
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3002 cpptoken = FALSE;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3003 }
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3004 if (cpptoken)
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3005 definedef = dsharpseen;
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3006 } /* if (definedef == dnone) */
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3007
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3008 continue;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3009 } /* switch (c) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3010
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3011
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3012 /* Consider token only if some involved conditions are satisfied. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3013 if (typdef != tignore
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3014 && definedef != dignorerest
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3015 && fvdef != finlist
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3016 && structdef != sintemplate
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3017 && (definedef != dnone
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3018 || structdef != scolonseen))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3019 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3020 if (midtoken)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3021 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3022 if (endtoken (c))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3023 {
26262
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 if (c == ':' && cplpl && *lp == ':' && begtoken (lp[1]))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3025 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3026 /*
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3027 * 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
3028 * 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
3029 * :: is not recognised.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3030 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3031 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
3032 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
3033 c = lp[-1];
35758
aa069bbee4c8 Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents: 35741
diff changeset
3034 goto still_in_token;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3035 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3036 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3037 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3038 bool funorvar = FALSE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3039
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3040 if (yacc_rules
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3041 || consider_token (newlb.buffer + tokoff, toklen, c,
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3042 &c_ext, cblev, parlev, &funorvar))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
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 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
3045 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3046 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
3047 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
3048 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
3049 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
3050 while (*lp != '\0'
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3051 && !iswhite (*lp) && *lp != '(')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3052 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
3053 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
3054 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
3055 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3056 token.named = FALSE;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3057 if ((c_ext & C_EXT) /* not pure C */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3058 && nestlev > 0 && definedef == dnone)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3059 /* in struct body */
4750
cdefe4f21650 Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents: 4696
diff changeset
3060 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3061 write_classname (&token_name, qualifier);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3062 linebuffer_setlen (&token_name,
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3063 token_name.len+qlen+toklen);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3064 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
3065 strncat (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3066 newlb.buffer + tokoff, toklen);
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3067 token.named = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3068 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3069 else if (objdef == ocatseen)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3070 /* Objective C category */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3071 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3072 int len = strlen (objtag) + 2 + toklen;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3073 linebuffer_setlen (&token_name, len);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3074 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
3075 strcat (token_name.buffer, "(");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3076 strncat (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3077 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
3078 strcat (token_name.buffer, ")");
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3079 token.named = TRUE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3080 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3081 else if (objdef == omethodtag
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3082 || objdef == omethodparm)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3083 /* Objective C method */
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3084 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3085 token.named = TRUE;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3086 }
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3087 else if (fvdef == fdefunname)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3088 /* GNU DEFUN and similar macros */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3089 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3090 bool defun = (newlb.buffer[tokoff] == 'F');
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3091 int off = tokoff;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3092 int len = toklen;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3093
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3094 /* Rewrite the tag so that emacs lisp DEFUNs
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3095 can be found by their elisp name */
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3096 if (defun)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3097 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3098 off += 1;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3099 len -= 1;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3100 }
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3101 len = toklen;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3102 linebuffer_setlen (&token_name, len);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3103 strncpy (token_name.buffer,
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3104 newlb.buffer + off, len);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3105 token_name.buffer[len] = '\0';
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3106 if (defun)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3107 while (--len >= 0)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3108 if (token_name.buffer[len] == '_')
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3109 token_name.buffer[len] = '-';
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3110 token.named = defun;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3111 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3112 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3113 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3114 linebuffer_setlen (&token_name, toklen);
10801
32f98b512dd9 * etags.c (C_entries): token_saved removed. Initialise tok.valid and
Francesco Potortì <pot@gnu.org>
parents: 10761
diff changeset
3115 strncpy (token_name.buffer,
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3116 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
3117 token_name.buffer[toklen] = '\0';
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3118 /* Name macros and members. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3119 token.named = (structdef == stagseen
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3120 || typdef == ttypeseen
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3121 || typdef == tend
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3122 || (funorvar
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3123 && definedef == dignorerest)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3124 || (funorvar
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3125 && definedef == dnone
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3126 && structdef == snone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3127 && cblev > 0));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3128 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3129 token.lineno = lineno;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3130 token.offset = tokoff;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3131 token.length = toklen;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3132 token.line = newlb.buffer;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3133 token.linepos = newlinepos;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3134 token.valid = TRUE;
4750
cdefe4f21650 Mon Sep 20 18:06:12 1993 Francesco Potorti` (pot at fly)
Francesco Potortì <pot@gnu.org>
parents: 4696
diff changeset
3135
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
3136 if (definedef == dnone
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3137 && (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
3138 || 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
3139 || structdef == stagseen
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3140 || typdef == tend
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3141 || typdef == ttypeseen
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3142 || objdef != onone))
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3143 {
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3144 if (current_lb_is_new)
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
3145 switch_line_buffers ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3146 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3147 else if (definedef != dnone
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3148 || fvdef == fdefunname
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3149 || instruct)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3150 make_C_tag (funorvar);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3151 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3152 midtoken = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3153 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3154 } /* if (endtoken (c)) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3155 else if (intoken (c))
35758
aa069bbee4c8 Work around small preprocessor bugs in sunos4 pcc and MinGW.
Francesco Potortì <pot@gnu.org>
parents: 35741
diff changeset
3156 still_in_token:
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3157 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3158 toklen++;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3159 continue;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3160 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3161 } /* if (midtoken) */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3162 else if (begtoken (c))
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3163 {
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
3164 switch (definedef)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3165 {
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 case dnone:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3167 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
3168 {
50db67ef8d64 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 case fstartlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3170 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
3171 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
3172 case flistseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3173 make_C_tag (TRUE); /* a function */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3174 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
3175 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3176 case fvnameseen:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3177 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
3178 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
3179 }
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3180 if (structdef == stagseen && !cjava)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3181 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3182 popclass_above (cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3183 structdef = snone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3184 }
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3185 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
3186 case dsharpseen:
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3187 savetoken = token;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3188 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3189 if (!yacc_rules || lp == newlb.buffer + 1)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3190 {
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3191 tokoff = lp - 1 - newlb.buffer;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3192 toklen = 1;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3193 midtoken = TRUE;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3194 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3195 continue;
10623
8a73e71a55e3 * etags.c (pfnote): Initialise been_warned in the node.
Francesco Potortì <pot@gnu.org>
parents: 10449
diff changeset
3196 } /* if (begtoken) */
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3197 } /* if must look at token */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3198
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3199
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3200 /* 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
3201 after having handled a token.*/
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3202 switch (c)
401
24b63d6679b6 *** empty log message ***
Roland McGrath <roland@gnu.org>
parents: 240
diff changeset
3203 {
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3204 case ':':
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3205 if (yacc_rules && token.offset == 0 && token.valid)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3206 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3207 make_C_tag (FALSE); /* a yacc function */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3208 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3209 }
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
3210 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
3211 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3212 switch (objdef)
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 case otagseen:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3215 objdef = oignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3216 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
3217 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3218 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3219 case omethodparm:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3220 objdef = omethodcolon;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3221 linebuffer_setlen (&token_name, token_name.len + 1);
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3222 strcat (token_name.buffer, ":");
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3223 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3224 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3225 if (structdef == stagseen)
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3226 structdef = scolonseen;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3227 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3228 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
3229 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
3230 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3231 switch (typdef)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3232 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3233 case tend:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3234 case ttypeseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3235 make_C_tag (FALSE); /* a typedef */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3236 typdef = tnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3237 fvdef = fvnone;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3238 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3239 case tnone:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3240 case tinbody:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3241 case tignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3242 switch (fvdef)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3243 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3244 case fignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3245 if (typdef == tignore)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3246 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3247 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3248 case fvnameseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3249 if ((globals && cblev == 0 && (!fvextern || declarations))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3250 || (members && instruct))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3251 make_C_tag (FALSE); /* a variable */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3252 fvextern = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3253 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3254 token.valid = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3255 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3256 case flistseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3257 if ((declarations && typdef == tnone && !instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3258 || (members && typdef != tignore && instruct))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3259 make_C_tag (TRUE); /* a function declaration */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3260 /* FALLTHRU */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3261 default:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3262 fvextern = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3263 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3264 if (declarations
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3265 && structdef == stagseen && (c_ext & C_PLPL))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3266 make_C_tag (FALSE); /* forward declaration */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3267 else
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3268 /* The following instruction invalidates the token.
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3269 Probably the token should be invalidated in all other
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3270 cases where some state machine is reset prematurely. */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3271 token.valid = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3272 } /* switch (fvdef) */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3273 /* FALLTHRU */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3274 default:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3275 if (!instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3276 typdef = tnone;
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3277 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3278 if (structdef == stagseen)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3279 structdef = snone;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3280 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3281 case ',':
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3282 if (definedef != dnone)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3283 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3284 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3285 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3286 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3287 case omethodparm:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3288 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
3289 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3290 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3291 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3292 switch (fvdef)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3293 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3294 case fdefunkey:
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3295 case foperator:
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3296 case fstartlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3297 case finlist:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3298 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3299 case vignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3300 break;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3301 case fdefunname:
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3302 fvdef = fignore;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3303 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3304 case fvnameseen: /* a variable */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3305 if ((globals && cblev == 0 && (!fvextern || declarations))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3306 || (members && instruct))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3307 make_C_tag (FALSE);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3308 break;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3309 case flistseen: /* a function */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3310 if ((declarations && typdef == tnone && !instruct)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3311 || (members && typdef != tignore && instruct))
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3312 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3313 make_C_tag (TRUE); /* a function declaration */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3314 fvdef = fvnameseen;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3315 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3316 else if (!declarations)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3317 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3318 token.valid = FALSE;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3319 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3320 default:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3321 fvdef = fvnone;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3322 }
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3323 if (structdef == stagseen)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3324 structdef = snone;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3325 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3326 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
3327 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
3328 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3329 if (structdef == stagseen)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3330 structdef = snone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3331 switch (typdef)
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3332 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3333 case ttypeseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3334 case tend:
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3335 typdef = tignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3336 make_C_tag (FALSE); /* a typedef */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3337 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3338 case tnone:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3339 case tinbody:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3340 switch (fvdef)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3341 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3342 case foperator:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3343 case finlist:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3344 case fignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3345 case vignore:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3346 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3347 case fvnameseen:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3348 if ((members && cblev == 1)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3349 || (globals && cblev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3350 && (!fvextern || declarations)))
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3351 make_C_tag (FALSE); /* a variable */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3352 /* FALLTHRU */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3353 default:
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3354 fvdef = fvnone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3355 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3356 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3357 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3358 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3359 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
3360 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
3361 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3362 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
3363 objdef = oparenseen;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3364 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
3365 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3366 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
3367 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
3368 && *lp != '*'
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3369 && !instruct)
9193
86fd33a4f327 * etags.c (C_entries): Recognise typedef of ANSI style functions.
Francesco Potortì <pot@gnu.org>
parents: 8789
diff changeset
3370 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3371 /* 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
3372 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
3373 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
3374 typdef = tignore;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3375 fvdef = fignore;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3376 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
3377 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3378 /* 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
3379 case foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3380 fvdef = fstartlist;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3381 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3382 case flistseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3383 fvdef = finlist;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3384 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
3385 }
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
3386 parlev++;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3387 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3388 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
3389 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
3390 break;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3391 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
3392 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3393 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
3394 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3395 }
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
3396 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
3397 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3398 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
3399 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3400 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
3401 case finlist:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3402 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
3403 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
3404 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3405 if (!instruct
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3406 && (typdef == tend
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3407 || typdef == ttypeseen))
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3408 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3409 typdef = tignore;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3410 make_C_tag (FALSE); /* a typedef */
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3411 }
4937
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3412 }
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3413 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
3414 parlev = 0;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3415 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3416 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
3417 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
3418 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
3419 if (typdef == ttypeseen)
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3420 {
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
3421 /* Whenever typdef is set to tinbody (currently only
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
3422 here), typdefcblev should be set to cblev. */
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
3423 typdef = tinbody;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3424 typdefcblev = cblev;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3425 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3426 switch (fvdef)
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3427 {
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3428 case flistseen:
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3429 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
3430 /* FALLTHRU */
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3431 case fignore:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3432 fvdef = fvnone;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
3433 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3434 case fvnone:
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3435 switch (objdef)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3436 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3437 case otagseen:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3438 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
3439 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3440 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3441 case omethodtag:
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3442 case omethodparm:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3443 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
3444 objdef = oinbody;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3445 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3446 default:
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
3447 /* Neutralize `extern "C" {' grot. */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3448 if (cblev == 0 && structdef == snone && nestlev == 0
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3449 && typdef == tnone)
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3450 cblev = -1;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3451 }
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3452 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3453 switch (structdef)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3454 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3455 case skeyseen: /* unnamed struct */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3456 pushclass_above (cblev, NULL, 0);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3457 structdef = snone;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3458 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3459 case stagseen: /* named struct or enum */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3460 case scolonseen: /* a class */
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3461 pushclass_above (cblev, token.line+token.offset, token.length);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3462 structdef = snone;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3463 make_C_tag (FALSE); /* a struct or enum */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3464 break;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3465 }
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3466 cblev++;
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
3467 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3468 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
3469 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
3470 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3471 if (fvdef == fstartlist)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3472 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
3473 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3474 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
3475 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
3476 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3477 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
3478 {
50db67ef8d64 Mon Nov 8 19:56:20 MET 1993 Tom Hageman (tom@basil.icce.rug.nl)
Francesco Potortì <pot@gnu.org>
parents: 4905
diff changeset
3479 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
3480 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
3481 }
4051
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3482 else if (cblev > 0)
73aa16fc728d (consider_token): was `==', now is `='.
Richard M. Stallman <rms@gnu.org>
parents: 3921
diff changeset
3483 cblev--;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3484 popclass_above (cblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3485 structdef = snone;
36361
e9d69d45eae4 When in autodetect mode, switch to C++ when the template keyword is met
Francesco Potortì <pot@gnu.org>
parents: 35775
diff changeset
3486 /* Only if typdef == tinbody is typdefcblev significant. */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3487 if (typdef == tinbody && cblev <= typdefcblev)
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3488 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3489 assert (cblev == typdefcblev);
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3490 typdef = tend;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3491 }
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3492 break;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3493 case '=':
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3494 if (definedef != dnone)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3495 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3496 switch (fvdef)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3497 {
26262
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 foperator:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3499 case finlist:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3500 case fignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3501 case vignore:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3502 break;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3503 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
3504 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
3505 || (globals && cblev == 0 && (!fvextern || declarations)))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3506 make_C_tag (FALSE); /* a variable */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3507 /* FALLTHRU */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3508 default:
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3509 fvdef = vignore;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3510 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3511 break;
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3512 case '<':
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3513 if (cplpl && structdef == stagseen)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3514 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3515 structdef = sintemplate;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3516 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3517 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3518 goto resetfvdef;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3519 case '>':
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3520 if (structdef == sintemplate)
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3521 {
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3522 structdef = stagseen;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3523 break;
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3524 }
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3525 goto resetfvdef;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3526 case '+':
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3527 case '-':
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3528 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
3529 {
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3530 objdef = omethodsign;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3531 break;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3532 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3533 /* FALLTHRU */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3534 resetfvdef:
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3535 case '#': case '~': case '&': case '%': case '/': case '|':
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3536 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
3537 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
3538 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
3539 /* 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
3540 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
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 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
3543 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
3544 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
3545 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
3546 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
3547 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
3548 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
3549 }
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
3550 break;
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3551 case '\0':
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3552 if (objdef == otagseen)
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3553 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3554 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
3555 objdef = oignore;
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
3556 }
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3557 /* 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
3558 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
3559 CNL_SAVE_DEFINEDEF ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3560 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
3561 CNL ();
2323
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3562 break;
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3563 } /* switch (c) */
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3564
626d9ac52bc9 (YACC): flag added to c_ext.
Richard M. Stallman <rms@gnu.org>
parents: 2004
diff changeset
3565 } /* while not eof */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3566
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3567 free (token_name.buffer);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3568 free (lbs[0].lb.buffer);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3569 free (lbs[1].lb.buffer);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3570 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3571
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3572 /*
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3573 * 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
3574 * 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
3575 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3576 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3577 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
3578 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3579 {
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3580 C_entries (cplusplus ? C_PLPL : C_AUTO, inf);
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3581 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3582
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
3583 /* Always do plain C. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3584 static void
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3585 plain_C_entries (inf)
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3586 FILE *inf;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3587 {
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3588 C_entries (0, inf);
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3589 }
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3590
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3591 /* Always do C++. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3592 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3593 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
3594 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3595 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3596 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
3597 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3598
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3599 /* Always do Java. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3600 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3601 Cjava_entries (inf)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
3602 FILE *inf;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3603 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3604 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
3605 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
3606
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3607 /* Always do C*. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3608 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3609 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
3610 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3611 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3612 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
3613 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3614
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3615 /* Always do Yacc. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3616 static void
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3617 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
3618 FILE *inf;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3619 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
3620 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
3621 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3622
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3623
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
3624 /* Useful macros. */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3625 #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
3626 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
3627 !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
3628 && (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
3629 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
3630 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
3631 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
3632 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
3633 )
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
3634 #define LOOKING_AT(cp, keyword) /* keyword is a constant string */ \
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3635 (strneq ((cp), keyword, sizeof(keyword)-1) /* cp points at keyword */ \
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3636 && notinname ((cp)[sizeof(keyword)-1]) /* end of keyword */ \
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3637 && ((cp) = skip_spaces((cp)+sizeof(keyword)-1))) /* skip spaces */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3638
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3639 /*
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3640 * 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
3641 * 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
3642 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3643 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3644 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
3645 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
3646 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3647 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
3648
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3649 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
3650 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
3651 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3652
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3653
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3654 /* Fortran parsing */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3655
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3656 static void F_takeprec __P((void));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3657 static void F_getit __P((FILE *));
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3658
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3659 static void
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3660 F_takeprec ()
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3661 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3662 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3663 if (*dbp != '*')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3664 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3665 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
3666 dbp = skip_spaces (dbp);
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3667 if (strneq (dbp, "(*)", 3))
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3668 {
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3669 dbp += 3;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3670 return;
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3671 }
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3672 if (!ISDIGIT (*dbp))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3673 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3674 --dbp; /* force failure */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3675 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3676 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3677 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3678 dbp++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3679 while (ISDIGIT (*dbp));
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3680 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3681
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3682 static void
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3683 F_getit (inf)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3684 FILE *inf;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3685 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3686 register char *cp;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3687
26262
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 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3689 if (*dbp == '\0')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3690 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3691 lineno++;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3692 linecharno = charno;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3693 charno += readline (&lb, inf);
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3694 dbp = lb.buffer;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3695 if (dbp[5] != '&')
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3696 return;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3697 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
3698 dbp = skip_spaces (dbp);
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3699 }
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3700 if (!ISALPHA (*dbp) && *dbp != '_' && *dbp != '$')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3701 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
3702 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
3703 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3704 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
3705 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
3706 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3707
26262
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
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3709 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3710 Fortran_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3711 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3712 {
26262
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 LOOP_ON_INPUT_LINES (inf, lb, dbp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3714 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3715 if (*dbp == '%')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3716 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
3717 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3718 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3719 continue;
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3720 switch (lowcase (*dbp))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3721 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3722 case 'i':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3723 if (nocase_tail ("integer"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3724 F_takeprec ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3725 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3726 case 'r':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3727 if (nocase_tail ("real"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3728 F_takeprec ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3729 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3730 case 'l':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3731 if (nocase_tail ("logical"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3732 F_takeprec ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3733 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3734 case 'c':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3735 if (nocase_tail ("complex") || nocase_tail ("character"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3736 F_takeprec ();
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3737 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3738 case 'd':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3739 if (nocase_tail ("double"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3740 {
26262
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 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3742 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3743 continue;
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3744 if (nocase_tail ("precision"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3745 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3746 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3747 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3748 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3749 }
26262
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 dbp = skip_spaces (dbp);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
3751 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3752 continue;
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
3753 switch (lowcase (*dbp))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3754 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3755 case 'f':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3756 if (nocase_tail ("function"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3757 F_getit (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3758 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3759 case 's':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3760 if (nocase_tail ("subroutine"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3761 F_getit (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3762 continue;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3763 case 'e':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3764 if (nocase_tail ("entry"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3765 F_getit (inf);
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
3766 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3767 case 'b':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3768 if (nocase_tail ("blockdata") || nocase_tail ("block data"))
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3769 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3770 dbp = skip_spaces (dbp);
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3771 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
3772 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
3773 lb.buffer, dbp - lb.buffer, lineno, linecharno);
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3774 else
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3775 F_getit (inf); /* look for name */
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3776 }
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
3777 continue;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3778 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3779 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3780 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3781
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3782
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3783 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3784 * Ada parsing
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3785 * Original code by
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3786 * Philippe Waroquiers <philippe.waroquiers@eurocontrol.be> (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
3787 */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3788
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3789 static void Ada_getit __P((FILE *, char *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3790
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3791 /* 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
3792 the real tag value necessary. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3793 static void
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3794 Ada_getit (inf, name_qualifier)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3795 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
3796 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
3797 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3798 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
3799 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
3800 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
3801
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3802 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
3803 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3804 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
3805 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
3806 || (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
3807 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3808 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
3809 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
3810 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
3811 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
3812 }
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3813 switch (lowcase(*dbp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3814 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3815 case 'b':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3816 if (nocase_tail ("body"))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3817 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3818 /* 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
3819 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
3820 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
3821 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
3822 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3823 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
3824 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
3825 /* Skipping type of task type or protected type ... */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3826 if (nocase_tail ("type"))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3827 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
3828 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
3829 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3830 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
3831 {
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 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
3833 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
3834 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
3835 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3836 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
3837 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3838 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
3839 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
3840 (*cp != '\0'
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3841 && (ISALPHA (*cp) || ISDIGIT (*cp) || *cp == '_' || *cp == '.'));
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3842 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
3843 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
3844 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
3845 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
3846 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3847 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
3848 *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
3849 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
3850 *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
3851 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
3852 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
3853 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
3854 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
3855 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3856 }
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
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3858 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3859 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
3860 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
3861 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3862 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
3863
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3864 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
3865 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3866 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
3867 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3868 /* 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
3869 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
3870 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3871 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
3872 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
3873 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3874 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
3875 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
3876 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
3877 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3878 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
3879 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3880 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
3881 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
3882 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3883 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3884
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3885 /* 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
3886 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
3887 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
3888
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3889 /* 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
3890 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
3891 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
3892 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3893 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
3894 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
3895 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
3896 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
3897 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3898
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3899 /* 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
3900 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
3901 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3902 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
3903 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
3904 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3905
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3906 /* We are at the beginning of a token. */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3907 switch (lowcase(*dbp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3908 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3909 case 'f':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3910 if (!packages_only && nocase_tail ("function"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3911 Ada_getit (inf, "/f");
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3912 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
3913 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
3914 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
3915 case 'p':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3916 if (!packages_only && nocase_tail ("procedure"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3917 Ada_getit (inf, "/p");
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3918 else if (nocase_tail ("package"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3919 Ada_getit (inf, "/s");
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3920 else if (nocase_tail ("protected")) /* protected type */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3921 Ada_getit (inf, "/t");
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3922 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
3923 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
3924 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
3925 case 't':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3926 if (!packages_only && nocase_tail ("task"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3927 Ada_getit (inf, "/k");
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3928 else if (typedefs && !packages_only && nocase_tail ("type"))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3929 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3930 Ada_getit (inf, "/t");
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3931 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
3932 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
3933 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3934 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
3935 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
3936 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
3937 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3938
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3939 /* 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
3940 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
3941 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
3942
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3943 } /* 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
3944 } /* 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
3945 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3946
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3947
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3948 /*
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3949 * Unix and microcontroller assembly tag handling
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3950 * Labels: /^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]/
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3951 * Idea by Bob Weiner, Motorola Inc. (1994)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3952 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3953 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3954 Asm_labels (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3955 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3956 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3957 register char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3958
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3959 LOOP_ON_INPUT_LINES (inf, lb, cp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3960 {
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3961 /* 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
3962 following identifier. */
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3963 if (ISALPHA (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3964 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3965 /* Read past label. */
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3966 cp++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
3967 while (ISALNUM (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3968 cp++;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
3969 if (*cp == ':' || iswhite (*cp))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3970 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3971 /* 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
3972 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
3973 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
3974 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
3975 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3976 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3977 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3978
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3979
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3980 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
3981 * Perl support
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3982 * Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3983 * Perl variable names: /^(my|local).../
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3984 * Original code by Bart Robinson <lomew@cs.utah.edu> (1995)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3985 * Additions by Michael Ernst <mernst@alum.mit.edu> (1997)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3986 * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001)
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3987 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
3988 static void
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3989 Perl_functions (inf)
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3990 FILE *inf;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3991 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3992 char *package = savestr ("main"); /* current package name */
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3993 register char *cp;
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
3994
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
3995 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
3996 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3997 skip_spaces(cp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3998
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
3999 if (LOOKING_AT (cp, "package"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4000 {
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4001 free (package);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4002 package = get_tag (cp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4003 if (package == NULL) /* can't parse package name */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4004 package = savestr ("");
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4005 else
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4006 package = savestr(package); /* make a copy */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4007 }
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4008 else if (LOOKING_AT (cp, "sub"))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4009 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4010 char *name, *fullname, *pos;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4011 char *sp = cp;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4012
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4013 while (!notinname (*cp))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4014 cp++;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4015 if (cp == sp)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4016 continue;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4017 name = savenstr (sp, cp-sp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4018 if ((pos = etags_strchr (name, ':')) != NULL && pos[1] == ':')
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4019 fullname = name;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4020 else
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4021 fullname = concat (package, "::", name);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4022 pfnote (fullname, TRUE,
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4023 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4024 if (name != fullname)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4025 free (name);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4026 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4027 else if (globals /* only if tagging global vars is enabled */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4028 && (LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local")))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4029 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4030 /* 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
4031 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
4032
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4033 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
4034 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4035 char* varstart = ++cp;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4036 while (ISALNUM (*cp) || *cp == '_')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4037 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
4038 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
4039 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4040 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
4041 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4042 /* 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
4043 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
4044 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
4045 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
4046 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4047
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4048 /* 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
4049 doesn't mention (and so depend upon) the following char. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
4050 pfnote (varname, FALSE,
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
4051 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4052 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4053 }
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 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4055
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4056
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4057 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4058 * Python support
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4059 * Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4060 * Idea by Eric S. Raymond <esr@thyrsus.com> (1997)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4061 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4062 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4063 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
4064 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
4065 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4066 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
4067
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4068 LOOP_ON_INPUT_LINES (inf, lb, cp)
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4069 if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class"))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4070 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4071 while (!notinname (*cp) && *cp != ':')
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4072 cp++;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4073 pfnote (NULL, TRUE,
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4074 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4075 }
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4076 }
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4077
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4078
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4079 /*
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4080 * PHP support
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4081 * Look for:
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4082 * - /^[ \t]*function[ \t\n]+[^ \t\n(]+/
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4083 * - /^[ \t]*class[ \t\n]+[^ \t\n]+/
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4084 * - /^[ \t]*define\(\"[^\"]+/
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4085 * Only with --members:
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4086 * - /^[ \t]*var[ \t\n]+\$[^ \t\n=;]/
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4087 * Idea by Diez B. Roggisch (2001)
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4088 */
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4089 static void
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4090 PHP_functions (inf)
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4091 FILE *inf;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4092 {
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4093 register char *cp;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4094 bool search_identifier = FALSE;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4095
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4096 LOOP_ON_INPUT_LINES (inf, lb, cp)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4097 {
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4098 cp = skip_spaces (cp);
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4099 if (search_identifier
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4100 && *cp != '\0')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4101 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4102 while (!notinname (*cp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4103 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
4104 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
4105 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4106 search_identifier = FALSE;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4107 }
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4108 else if (LOOKING_AT (cp, "function"))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4109 {
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4110 if(*cp == '&')
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4111 cp = skip_spaces (cp+1);
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4112 if(*cp != '\0')
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4113 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4114 while (!notinname (*cp))
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4115 cp++;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4116 pfnote (NULL, TRUE,
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4117 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4118 }
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4119 else
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4120 search_identifier = TRUE;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4121 }
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4122 else if (LOOKING_AT (cp, "class"))
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4123 {
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4124 if (*cp != '\0')
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4125 {
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4126 while (*cp != '\0' && !iswhite (*cp))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4127 cp++;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4128 pfnote (NULL, FALSE,
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4129 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4130 }
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4131 else
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4132 search_identifier = TRUE;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4133 }
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4134 else if (strneq (cp, "define", 6)
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4135 && (cp = skip_spaces (cp+6))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4136 && *cp++ == '('
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4137 && (*cp == '"' || *cp == '\''))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4138 {
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4139 char quote = *cp++;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4140 while (*cp != quote && *cp != '\0')
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4141 cp++;
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4142 pfnote (NULL, FALSE,
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4143 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4144 }
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4145 else if (members
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4146 && LOOKING_AT (cp, "var")
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4147 && *cp == '$')
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4148 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4149 while (!notinname(*cp))
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4150 cp++;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4151 pfnote (NULL, FALSE,
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4152 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
4153 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4154 }
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4155 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4156
13404
9d6c77b66cfb * etags.c (get_lang_from_name, get_lang_from_interpreter,
Francesco Potortì <pot@gnu.org>
parents: 13380
diff changeset
4157
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4158 /*
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4159 * Cobol tag functions
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4160 * 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
4161 * i.e. anything that starts in column 8 is one word and ends in a full stop.
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4162 * Idea by Corny de Souza (1993)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4163 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4164 static void
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4165 Cobol_paragraphs (inf)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4166 FILE *inf;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4167 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4168 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
4169
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4170 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
4171 {
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4172 if (lb.len < 9)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4173 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
4174 bp += 8;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4175
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4176 /* If eoln, compiler option or comment ignore whole line. */
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4177 if (bp[-1] != ' ' || !ISALNUM (bp[0]))
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4178 continue;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4179
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4180 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
4181 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
4182 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
4183 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
4184 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
4185 }
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4186 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4187
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4188
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4189 /*
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4190 * Makefile support
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4191 * Idea by Assar Westerlund <assar@sics.se> (2001)
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4192 */
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4193 static void
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4194 Makefile_targets (inf)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4195 FILE *inf;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4196 {
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4197 register char *bp;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4198
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4199 LOOP_ON_INPUT_LINES (inf, lb, bp)
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4200 {
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4201 if (*bp == '\t' || *bp == '#')
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4202 continue;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4203 while (*bp != '\0' && *bp != '=' && *bp != ':')
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4204 bp++;
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4205 if (*bp == ':')
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4206 pfnote (savenstr (lb.buffer, bp - lb.buffer), TRUE,
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4207 lb.buffer, bp - lb.buffer + 1, lineno, linecharno);
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4208 }
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4209 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4210
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4211
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4212 /*
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4213 * Pascal parsing
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4214 * Original code by Mosur K. Mohan (1989)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4215 *
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4216 * 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
4217 * 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
4218 * "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
4219 * the tag is skipped.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4220 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4221 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4222 Pascal_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4223 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4224 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4225 linebuffer tline; /* mostly copied from C_entries */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4226 long save_lcno;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4227 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
4228 char c, *cp, *namebuf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4229
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4230 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
4231 incomment, /* point is inside a comment */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4232 inquote, /* point is inside '..' string */
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4233 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
4234 keyword, so next item = potential tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4235 found_tag, /* point is after a potential tag */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4236 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
4237 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
4238 next token will determine whether this
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4239 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
4240 whether it is a real tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4241
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4242 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
4243 namebuf = NULL; /* keep compiler quiet */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4244 lineno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4245 charno = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4246 dbp = lb.buffer;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4247 *dbp = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4248 initbuffer (&tline);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4249
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4250 incomment = inquote = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4251 found_tag = FALSE; /* have a proc name; check if extern */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4252 get_tagname = FALSE; /* have found "procedure" keyword */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4253 inparms = FALSE; /* found '(' after "proc" */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4254 verify_tag = FALSE; /* check if "extern" is ahead */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4255
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4256
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 while (!feof (inf)) /* long main loop to get next char */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4258 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4259 c = *dbp++;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4260 if (c == '\0') /* if end of line */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4261 {
15243
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
4262 lineno++;
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
4263 linecharno = charno;
c024dca549c5 * etags.c (CNL_SAVE_DEFINEDEF): Set linecharno for use by readline.
Francesco Potortì <pot@gnu.org>
parents: 14982
diff changeset
4264 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
4265 dbp = lb.buffer;
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4266 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4267 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
4268 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
4269 || get_tagname))
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4270 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
4271 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
4272 the procedure or function */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4273 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4274 if (incomment)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4275 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4276 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
4277 incomment = FALSE;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4278 else if (c == '*' && *dbp == ')') /* within (* *) comments */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4279 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4280 dbp++;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4281 incomment = FALSE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4282 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4283 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4284 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4285 else if (inquote)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4286 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4287 if (c == '\'')
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4288 inquote = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4289 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4290 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4291 else
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4292 switch (c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4293 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4294 case '\'':
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4295 inquote = TRUE; /* found first quote */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4296 continue;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4297 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
4298 incomment = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4299 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4300 case '(':
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4301 if (*dbp == '*') /* found open (* comment */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4302 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4303 incomment = TRUE;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4304 dbp++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4305 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4306 else if (found_tag) /* found '(' after tag, i.e., parm-list */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4307 inparms = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4308 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4309 case ')': /* end of parms list */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4310 if (inparms)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4311 inparms = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4312 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4313 case ';':
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4314 if (found_tag && !inparms) /* end of proc or fn stmt */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4315 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4316 verify_tag = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4317 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4318 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4319 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4320 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4321 if (found_tag && verify_tag && (*dbp != ' '))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4322 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4323 /* 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
4324 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4325 continue;
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4326 if (lowcase (*dbp == 'e'))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4327 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4328 if (nocase_tail ("extern")) /* superfluous, really! */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4329 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4330 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4331 verify_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4332 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4333 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4334 else if (lowcase (*dbp) == 'f')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4335 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4336 if (nocase_tail ("forward")) /* check for forward reference */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4337 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4338 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4339 verify_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4340 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4341 }
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4342 if (found_tag && verify_tag) /* not external proc, so make tag */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4343 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4344 found_tag = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4345 verify_tag = FALSE;
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
4346 pfnote (namebuf, TRUE,
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4347 tline.buffer, save_len, save_lineno, save_lcno);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4348 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4349 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4350 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4351 if (get_tagname) /* grab name of proc or fn */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4352 {
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4353 if (*dbp == '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4354 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4355
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4356 /* save all values for later tagging */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4357 linebuffer_setlen (&tline, lb.len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4358 strcpy (tline.buffer, lb.buffer);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4359 save_lineno = lineno;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4360 save_lcno = linecharno;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4361
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4362 /* grab block name */
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4363 for (cp = dbp + 1; *cp != '\0' && !endtoken (*cp); cp++)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4364 continue;
20788
2bf465c6cc6b (getit, Cobol_paragraphs, Pascal_functions,
Richard M. Stallman <rms@gnu.org>
parents: 20071
diff changeset
4365 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
4366 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
4367 save_len = dbp - lb.buffer + 1;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4368 get_tagname = FALSE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4369 found_tag = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4370 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4371
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4372 /* and proceed to check for "extern" */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4373 }
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4374 else if (!incomment && !inquote && !found_tag)
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 /* check for proc/fn keywords */
12398
ccfd646cfad9 * etags.c (plain_C_entries): new function.
Francesco Potortì <pot@gnu.org>
parents: 12344
diff changeset
4377 switch (lowcase (c))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4378 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4379 case 'p':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4380 if (nocase_tail ("rocedure")) /* c = 'p', dbp has advanced */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4381 get_tagname = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4382 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4383 case 'f':
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4384 if (nocase_tail ("unction"))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4385 get_tagname = TRUE;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4386 continue;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4387 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4388 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4389 } /* while not eof */
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4390
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
4391 free (tline.buffer);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4392 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4393
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4394
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4395 /*
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4396 * Lisp tag functions
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
4397 * look for (def or (DEF, quote or QUOTE
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4398 */
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4399
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4400 static void L_getit __P((void));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4401
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4402 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4403 L_getit ()
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4404 {
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4405 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
4406 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
4407 else if (*dbp == '(')
4663
5f0ff5c890a8 * etags.c (L_isdef, L_isquote, L_getit): small optimisations.
Francesco Potortì <pot@gnu.org>
parents: 4406
diff changeset
4408 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4409 dbp++;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4410 /* Try to skip "(quote " */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4411 if (!LOOKING_AT (dbp, "quote") && !LOOKING_AT (dbp, "QUOTE"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4412 /* Ok, then skip "(" before name in (defstruct (foo)) */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4413 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
4414 }
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4415 get_tag (dbp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4416 }
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4417
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4418 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4419 Lisp_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4420 FILE *inf;
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4421 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4422 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
4423 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4424 if (dbp[0] != '(')
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4425 continue;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4426
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4427 if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4428 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4429 dbp = skip_non_spaces (dbp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4430 dbp = skip_spaces (dbp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4431 L_getit ();
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4432 }
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4433 else
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4434 {
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4435 /* Check for (foo::defmumble name-defined ... */
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4436 do
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4437 dbp++;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4438 while (!notinname (*dbp) && *dbp != ':');
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4439 if (*dbp == ':')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4440 {
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4441 do
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4442 dbp++;
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4443 while (*dbp == ':');
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4444
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4445 if (strneq (dbp, "def", 3) || strneq (dbp, "DEF", 3))
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4446 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4447 dbp = skip_non_spaces (dbp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4448 dbp = skip_spaces (dbp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4449 L_getit ();
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4450 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4451 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4452 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4453 }
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4454 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4455
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4456
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4457 /*
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4458 * Postscript tag functions
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4459 * Just look for lines where the first character is '/'
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4460 * Also look at "defineps" for PSWrap
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4461 * Ideas by:
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4462 * Richard Mlynarik <mly@adoc.xerox.com> (1997)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4463 * Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4464 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4465 static void
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4466 Postscript_functions (inf)
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4467 FILE *inf;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4468 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4469 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
4470
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 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
4472 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4473 if (bp[0] == '/')
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4474 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4475 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
4476 *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
4477 ep++)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4478 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
4479 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
4480 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
4481 }
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4482 else if (LOOKING_AT (bp, "defineps"))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4483 get_tag (bp);
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4484 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4485 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4486
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4487
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4488 /*
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4489 * Scheme tag functions
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4490 * look for (def... xyzzy
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4491 * (def... (xyzzy
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4492 * (def ... ((...(xyzzy ....
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4493 * (set! xyzzy
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4494 * Original code by Ken Haase (1985?)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4495 */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4496
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4497 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4498 Scheme_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4499 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4500 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4501 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
4502
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4503 LOOP_ON_INPUT_LINES (inf, lb, bp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4504 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4505 if (strneq (bp, "(def", 4) || strneq (bp, "(DEF", 4))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4506 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4507 bp = skip_non_spaces (bp+4);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4508 /* Skip over open parens and white space */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4509 while (notinname (*bp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4510 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
4511 get_tag (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4512 }
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4513 if (LOOKING_AT (bp, "(SET!") || LOOKING_AT (bp, "(set!"))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4514 get_tag (bp);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4515 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4516 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4517
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4518
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4519 /* Find tags in TeX and LaTeX input files. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4520
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4521 /* TEX_toktab is a table of TeX control sequences that define tags.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4522 Each TEX_tabent records one such control sequence.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4523 CONVERT THIS TO USE THE Stab TYPE!! */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4524 struct TEX_tabent
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4525 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4526 char *name;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4527 int len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4528 };
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4529
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
4530 static struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4531
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4532 /* Default set of control sequences to put into TEX_toktab.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4533 The value of environment var TEXTAGS is prepended to this. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4534
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
4535 static char *TEX_defenv = "\
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
4536 :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
4537 :part:appendix:entry:index";
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4538
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4539 static void TEX_mode __P((FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4540 static struct TEX_tabent *TEX_decode_env __P((char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4541 static int TEX_Token __P((char *));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4542
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
4543 static char TEX_esc = '\\';
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
4544 static char TEX_opgrp = '{';
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
4545 static char TEX_clgrp = '}';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4546
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4547 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4548 * TeX/LaTeX scanning loop.
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4549 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4550 static void
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4551 TeX_commands (inf)
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4552 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4553 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4554 char *cp, *lasthit;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4555 register int i;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4556
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4557 /* 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
4558 TEX_mode (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4559
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4560 /* Initialize token table once from environment. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4561 if (!TEX_toktab)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4562 TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4563
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4564 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
4565 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4566 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
4567 /* 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
4568 while ((cp = etags_strchr (cp, TEX_esc)) != NULL)
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4569 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4570 if (*++cp == '\0')
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4571 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
4572 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
4573 lasthit = cp;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4574 i = TEX_Token (lasthit);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4575 if (i >= 0)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4576 {
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4577 /* 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
4578 register char *p;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4579 for (p = lasthit + TEX_toktab[i].len;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4580 *p != '\0' && *p != TEX_clgrp;
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4581 p++)
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4582 continue; */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4583 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
4584 lb.buffer, lb.len, lineno, linecharno);
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4585 break; /* We only tag a line once */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4586 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4587 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4588 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4589 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4590
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4591 #define TEX_LESC '\\'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4592 #define TEX_SESC '!'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4593 #define TEX_cmt '%'
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4594
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4595 /* 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
4596 chars accordingly. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4597 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4598 TEX_mode (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4599 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4600 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4601 int c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4602
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4603 while ((c = getc (inf)) != EOF)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4604 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4605 /* Skip to next line if we hit the TeX comment char. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4606 if (c == TEX_cmt)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4607 while (c != '\n')
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4608 c = getc (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4609 else if (c == TEX_LESC || c == TEX_SESC )
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4610 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4611 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4612
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4613 if (c == TEX_LESC)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4614 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4615 TEX_esc = TEX_LESC;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4616 TEX_opgrp = '{';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4617 TEX_clgrp = '}';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4618 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4619 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4620 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4621 TEX_esc = TEX_SESC;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4622 TEX_opgrp = '<';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4623 TEX_clgrp = '>';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4624 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4625 /* 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
4626 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
4627 rewind (inf);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4628 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4629
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
4630 /* 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
4631 Build token table. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4632 static struct TEX_tabent *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4633 TEX_decode_env (evarname, defenv)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4634 char *evarname;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4635 char *defenv;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4636 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4637 register char *env, *p;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4638
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4639 struct TEX_tabent *tab;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4640 int size, i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4641
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4642 /* Append default string to environment. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4643 env = getenv (evarname);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4644 if (!env)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4645 env = defenv;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4646 else
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4647 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4648 char *oldenv = env;
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4649 env = concat (oldenv, defenv, "");
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
4650 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4651
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4652 /* Allocate a token table */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4653 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
4654 if ((p = etags_strchr (p, ':')) && *++p != '\0')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4655 size++;
1026
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4656 /* Add 1 to leave room for null terminator. */
cc96e2df9b71 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 774
diff changeset
4657 tab = xnew (size + 1, struct TEX_tabent);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4658
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4659 /* Unpack environment string into token table. Be careful about */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4660 /* zero-length strings (leading ':', "::" and trailing ':') */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4661 for (i = 0; *env;)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4662 {
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
4663 p = etags_strchr (env, ':');
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4664 if (!p) /* End of environment string. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4665 p = env + strlen (env);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4666 if (p - env > 0)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4667 { /* Only non-zero strings. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4668 tab[i].name = savenstr (env, p - env);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4669 tab[i].len = strlen (tab[i].name);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4670 i++;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4671 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4672 if (*p)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4673 env = p + 1;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4674 else
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4675 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4676 tab[i].name = NULL; /* Mark end of table. */
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4677 tab[i].len = 0;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4678 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4679 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4680 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4681 return tab;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4682 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4683
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4684 /* 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
4685 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
4686 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
4687 Keep the capital `T' in `token' for dumb truncating compilers
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4688 (this distinguishes it from `TEX_toktab' */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4689 static int
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4690 TEX_Token (cp)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4691 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4692 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4693 int i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4694
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4695 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
4696 if (strneq (TEX_toktab[i].name, cp, TEX_toktab[i].len))
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4697 return i;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4698 return -1;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4699 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4700
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4701
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4702 /* Texinfo support. Dave Love, Mar. 2000. */
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4703 static void
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
4704 Texinfo_nodes (inf)
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4705 FILE * inf;
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4706 {
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4707 char *cp, *start;
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4708 LOOP_ON_INPUT_LINES (inf, lb, cp)
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4709 if (LOOKING_AT (cp, "@node"))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4710 {
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4711 start = cp;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4712 while (*cp != '\0' && *cp != ',')
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4713 cp++;
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4714 pfnote (savenstr (start, cp - start), TRUE,
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4715 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4716 }
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4717 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4718
28663
75826102199c (Texinfo_functions): New function.
Dave Love <fx@gnu.org>
parents: 27948
diff changeset
4719
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4720 /*
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4721 * Prolog support
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4722 *
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4723 * Assumes that the predicate or rule starts at column 0.
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4724 * Only the first clause of a predicate or rule is added.
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4725 * Original code by Sunichirou Sugou (1989)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4726 * Rewritten by Anders Lindgren (1996)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4727 */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4728 static int prolog_pr __P((char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4729 static void prolog_skip_comment __P((linebuffer *, FILE *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4730 static int prolog_atom __P((char *, int));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4731
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4732 static void
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4733 Prolog_functions (inf)
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4734 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4735 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4736 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
4737 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4738 int allocated;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4739
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4740 allocated = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4741 len = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4742 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4743
26262
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 LOOP_ON_INPUT_LINES (inf, lb, cp)
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4745 {
26262
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 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
4747 continue;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4748 else if (iswhite (cp[0])) /* Not a predicate */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4749 continue;
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4750 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
4751 prolog_skip_comment (&lb, inf);
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4752 else if ((len = prolog_pr (cp, last)) > 0)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4753 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4754 /* Predicate or rule. Store the function name so that we
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4755 only generate a tag for the first clause. */
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4756 if (last == NULL)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4757 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
4758 else if (len + 1 > allocated)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4759 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
4760 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
4761 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
4762 last[len] = '\0';
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4763 }
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4764 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4765 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4766
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4767
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4768 static void
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4769 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
4770 linebuffer *plb;
6756
8086a2590e2f * etags.c (outf, outfiledir): renamed to tagf, tagfiledir.
Francesco Potortì <pot@gnu.org>
parents: 6592
diff changeset
4771 FILE *inf;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4772 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4773 char *cp;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4774
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4775 do
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4776 {
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4777 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
4778 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
4779 return;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4780 lineno++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4781 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
4782 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
4783 while (!feof(inf));
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4784 }
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4785
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4786 /*
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4787 * A predicate or rule definition is added if it matches:
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4788 * <beginning of line><Prolog Atom><whitespace>(
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4789 * or <beginning of line><Prolog Atom><whitespace>:-
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4790 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4791 * 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
4792 * 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
4793 *
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4794 * Return the size of the name of the predicate or rule, or 0 if no
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4795 * header was found.
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4796 */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
4797 static int
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4798 prolog_pr (s, last)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4799 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4800 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
4801 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4802 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4803 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4804
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4805 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
4806 if (pos < 1)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4807 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4808
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4809 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
4810 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
4811
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4812 if ((s[pos] == '.'
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4813 || (s[pos] == '(' && (pos += 1))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4814 || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2)))
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4815 && (last == NULL /* save only the first clause */
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4816 || len != strlen (last)
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4817 || !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
4818 {
26262
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 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
4820 return len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4821 }
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4822 else
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
4823 return 0;
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4824 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4825
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4826 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4827 * 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
4828 * 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
4829 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4830 * 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
4831 * - 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
4832 * - 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
4833 * Backslash quotes everything.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4834 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4835 static int
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4836 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
4837 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4838 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4839 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4840 int origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4841
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4842 origpos = pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4843
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4844 if (ISLOWER(s[pos]) || (s[pos] == '_'))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4845 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4846 /* 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
4847 pos++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
4848 while (ISALNUM(s[pos]) || (s[pos] == '_'))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4849 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4850 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4851 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4852 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4853 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4854 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
4855 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4856 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4857
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4858 while (1)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4859 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4860 if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4861 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4862 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4863 if (s[pos] != '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4864 break;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4865 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
4866 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4867 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
4868 /* 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
4869 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4870 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
4871 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4872 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
4873 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4874 pos += 2;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4875 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4876 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4877 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4878 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4879 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4880 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4881 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4882 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4883 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4884
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4885
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4886 /*
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4887 * Support for Erlang
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4888 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4889 * 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
4890 * Assumes that Erlang functions start at column 0.
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4891 * Original code by Anders Lindgren (1996)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4892 */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4893 static int erlang_func __P((char *, char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4894 static void erlang_attribute __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4895 static int erlang_atom __P((char *, int));
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4896
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4897 static void
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4898 Erlang_functions (inf)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4899 FILE *inf;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4900 {
26262
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 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
4902 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4903 int allocated;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4904
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4905 allocated = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4906 len = 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4907 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
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 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
4910 {
26262
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 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
4912 continue;
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
4913 else if (iswhite (cp[0])) /* Not function nor attribute */
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4914 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
4915 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
4916 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
4917 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
4918 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
4919 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
4920 {
26262
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 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
4922 last = NULL;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4923 }
26262
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 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
4925 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4926 /*
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4927 * 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
4928 * 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
4929 */
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4930 if (last == NULL)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4931 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
4932 else if (len + 1 > allocated)
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
4933 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
4934 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
4935 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
4936 last[len] = '\0';
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4937 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4938 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4939 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4940
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4941
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4942 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4943 * 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
4944 * <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
4945 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4946 * 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
4947 * 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
4948 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4949 * 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
4950 * was found.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4951 */
27658
5980f19581dc (pfnote, new_pfnote, C_entries, prolog_pred, erlang_func): Add
Dave Love <fx@gnu.org>
parents: 27595
diff changeset
4952 static int
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4953 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
4954 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4955 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
4956 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4957 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4958 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4959
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4960 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
4961 if (pos < 1)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4962 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4963
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4964 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
4965 pos = skip_spaces (s + pos) - s;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4966
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4967 /* Save only the first clause. */
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4968 if (s[pos++] == '('
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4969 && (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
4970 || len != (int)strlen (last)
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4971 || !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
4972 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4973 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
4974 return len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4975 }
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
4976
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4977 return 0;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4978 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4979
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4980
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4981 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4982 * 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
4983 * and records.
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4984 *
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4985 * 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
4986 * -define(foo, bar).
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4987 * -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
4988 * -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
4989 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
4990 static void
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4991 erlang_attribute (s)
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4992 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4993 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4994 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4995 int len;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4996
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
4997 if (LOOKING_AT (s, "-define") || LOOKING_AT (s, "-record"))
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
4998 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
4999 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
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 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
5002 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
5003 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
5004 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
5005 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
5006 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5007 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5008 return;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5009 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5010
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5011
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5012 /*
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5013 * 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
5014 * 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
5015 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5016 static int
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5017 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
5018 char *s;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5019 int pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5020 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5021 int origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5022
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5023 origpos = pos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5024
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5025 if (ISALPHA (s[pos]) || s[pos] == '_')
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5026 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5027 /* 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
5028 pos++;
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5029 while (ISALNUM (s[pos]) || s[pos] == '_')
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5030 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5031 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5032 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5033 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
5034 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5035 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5036
26262
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 while (1)
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5038 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5039 if (s[pos] == '\'')
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5040 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5041 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5042 break;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5043 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5044 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
5045 /* 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
5046 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5047 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
5048 {
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5049 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
5050 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5051 pos += 2;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5052 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5053 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5054 pos++;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5055 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5056 return pos - origpos;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5057 }
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5058 else
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5059 return -1;
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5060 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5061
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5062
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5063 #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
5064
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5065 static char *scan_separators __P((char *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5066 static void analyse_regex __P((char *, bool));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5067 static void add_regex __P((char *, bool, language *));
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5068 static char *substitute __P((char *, char *, struct re_registers *));
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5069
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5070 /* 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
5071 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
5072 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
5073 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
5074 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
5075 terminates name string. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5076 static char *
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5077 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
5078 char *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5079 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5080 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
5081 char *copyto = name;
18042
c378dd0b8de7 Various cleanups on TeX, Erlang, Prolog, C.
Francesco Potortì <pot@gnu.org>
parents: 17785
diff changeset
5082 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
5083
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5084 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
5085 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5086 if (quoted)
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5087 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5088 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
5089 *copyto++ = '\t';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5090 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
5091 *copyto++ = sep;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5092 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5093 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5094 /* 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
5095 *copyto++ = '\\';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5096 *copyto++ = *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5097 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5098 quoted = FALSE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5099 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5100 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
5101 quoted = TRUE;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5102 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
5103 break;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5104 else
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5105 *copyto++ = *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5106 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5107
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5108 /* 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
5109 *copyto = '\0';
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5110 return name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5111 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5112
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5113 /* 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
5114 thing. Same for each line of a regexp file. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5115 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5116 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
5117 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
5118 bool ignore_case;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5119 {
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5120 if (regex_arg == NULL)
39317
a7f40b000353 * etags.c (analyse_regex): If regex_arg is NULL, return
Francesco Potortì <pot@gnu.org>
parents: 37719
diff changeset
5121 {
a7f40b000353 * etags.c (analyse_regex): If regex_arg is NULL, return
Francesco Potortì <pot@gnu.org>
parents: 37719
diff changeset
5122 free_patterns (); /* --no-regex: remove existing regexps */
a7f40b000353 * etags.c (analyse_regex): If regex_arg is NULL, return
Francesco Potortì <pot@gnu.org>
parents: 37719
diff changeset
5123 return;
a7f40b000353 * etags.c (analyse_regex): If regex_arg is NULL, return
Francesco Potortì <pot@gnu.org>
parents: 37719
diff changeset
5124 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5125
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5126 /* 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
5127 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
5128 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5129 /* 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
5130 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
5131 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
5132 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
5133 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
5134
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 /* 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
5136 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
5137 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
5138 {
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 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
5140 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
5141 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
5142
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 /* 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
5144 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
5145 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
5146 {
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 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
5148 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
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 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
5151 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
5152 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
5153 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
5154 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
5155 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5156 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
5157
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5158 /* 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
5159 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
5160 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5161 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
5162 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
5163 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
5164
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5165 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
5166 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
5167 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5168 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
5169 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
5170 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5171 *cp = '\0';
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
5172 lang = get_language_from_langname (lang_name);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5173 if (lang == NULL)
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5174 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
5175 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
5176 }
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 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
5178
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 /* 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
5180 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
5181 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
5182 break;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5183 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5184 }
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5185
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5186 /* 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
5187 expression, into a real regular expression by compiling it. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5188 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5189 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
5190 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
5191 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
5192 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
5193 {
37719
9c4fdf982ba2 (add_regex): Reset the whole newly allocated pattern buffer instead of
Francesco Potortì <pot@gnu.org>
parents: 37502
diff changeset
5194 static struct re_pattern_buffer zeropattern;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5195 char *name;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5196 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
5197 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
5198 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
5199
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5200
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5201 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
5202 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5203 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
5204 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5205 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5206 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
5207 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
5208 {
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5209 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
5210 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5211 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5212 (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
5213
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5214 patbuf = xnew (1, struct re_pattern_buffer);
37719
9c4fdf982ba2 (add_regex): Reset the whole newly allocated pattern buffer instead of
Francesco Potortì <pot@gnu.org>
parents: 37502
diff changeset
5215 *patbuf = zeropattern;
9c4fdf982ba2 (add_regex): Reset the whole newly allocated pattern buffer instead of
Francesco Potortì <pot@gnu.org>
parents: 37502
diff changeset
5216 if (ignore_case)
9c4fdf982ba2 (add_regex): Reset the whole newly allocated pattern buffer instead of
Francesco Potortì <pot@gnu.org>
parents: 37502
diff changeset
5217 patbuf->translate = lc_trans; /* translation table to fold case */
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5218
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5219 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
5220 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
5221 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5222 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
5223 return;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5224 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5225
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5226 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
5227 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
5228 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
5229 p_head->p_next = pp;
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5230 p_head->lang = lang;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5231 p_head->pat = 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
5232 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
5233 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
5234 }
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5235
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5236 /*
13380
12bfc1ecec61 * etags.c (lowcase): Use the standard tolower function.
Francesco Potortì <pot@gnu.org>
parents: 12879
diff changeset
5237 * 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
5238 * arguments.
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5239 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5240 static char *
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5241 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
5242 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
5243 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
5244 {
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
5245 char *result, *t;
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5246 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
5247
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5248 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
5249 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
5250
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5251 /* 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
5252 if (out[size - 1] == '\\')
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5253 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
5254 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
5255 t != NULL;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5256 t = etags_strchr (t + 2, '\\'))
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5257 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
5258 {
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5259 dig = t[1] - '0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5260 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
5261 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
5262 }
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5263 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5264 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
5265
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5266 /* 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
5267 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
5268
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5269 for (t = result; *out != '\0'; out++)
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5270 if (*out == '\\' && ISDIGIT (*++out))
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5271 {
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5272 dig = *out - '0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5273 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
5274 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
5275 t += diglen;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5276 }
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5277 else
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5278 *t++ = *out;
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5279 *t = '\0';
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5280
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5281 assert (t <= result + size && t - result == (int)strlen (result));
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5282
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5283 return result;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5284 }
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5285
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5286 /* Deallocate all patterns. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5287 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5288 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
5289 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5290 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
5291 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
5292 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5293 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
5294 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
5295 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
5296 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
5297 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
5298 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5299 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
5300 }
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
5301 #endif /* ETAGS_REGEXPS */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5302
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5303
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5304 static bool
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5305 nocase_tail (cp)
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5306 char *cp;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5307 {
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5308 register int len = 0;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5309
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5310 while (*cp != '\0' && lowcase (*cp) == lowcase (dbp[len]))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5311 cp++, len++;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5312 if (*cp == '\0' && !intoken (dbp[len]))
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5313 {
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5314 dbp += len;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5315 return TRUE;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5316 }
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5317 return FALSE;
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5318 }
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5319
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5320 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5321 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
5322 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
5323 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5324 register char *cp, *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
5325
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5326 if (*bp == '\0')
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5327 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
5328 /* Go till you get to white space or a syntactic break */
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5329 for (cp = bp + 1; !notinname (*cp); cp++)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5330 continue;
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5331 name = savenstr (bp, cp-bp);
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5332 pfnote (name, 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
5333 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5334 return 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
5335 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5336
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5337 /* Initialize a linebuffer for use */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5338 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5339 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
5340 linebuffer *lbp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5341 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5342 lbp->size = (DEBUG) ? 3 : 200;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5343 lbp->buffer = xnew (lbp->size, char);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5344 lbp->buffer[0] = '\0';
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5345 lbp->len = 0;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5346 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5347
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5348 /*
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5349 * 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
5350 * 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
5351 * `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
5352 *
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5353 * 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
5354 * 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
5355 * 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
5356 * file).
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5357 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5358 static long
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5359 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
5360 linebuffer *lbp;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5361 register FILE *stream;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5362 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5363 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
5364 register char *p = lbp->buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5365 register char *pend;
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5366 int chars_deleted;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5367
26262
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 pend = p + lbp->size; /* Separate to avoid 386/IX compiler bug. */
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5369
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5370 while (1)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5371 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5372 register int c = getc (stream);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5373 if (p == pend)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5374 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5375 /* 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
5376 lbp->size *= 2;
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5377 xrnew (buffer, lbp->size, char);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5378 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
5379 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
5380 lbp->buffer = buffer;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5381 }
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5382 if (c == EOF)
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5383 {
14859
efa1bc6b7b17 * etags.c (just_read_file): Reset lineno and charno on entry.
Francesco Potortì <pot@gnu.org>
parents: 14230
diff changeset
5384 *p = '\0';
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5385 chars_deleted = 0;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5386 break;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5387 }
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5388 if (c == '\n')
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5389 {
10990
c0ceaa45ded7 * etags.c (process_file): free (filename) after using it.
Francesco Potortì <pot@gnu.org>
parents: 10801
diff changeset
5390 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
5391 {
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5392 p -= 1;
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
5393 #ifdef DOS_NT
16373
d50369f4bb41 * etags.c (print_version): Print copyright info.
Francesco Potortì <pot@gnu.org>
parents: 16086
diff changeset
5394 /* 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
5395 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
5396 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
5397 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
5398 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
5399 chars_deleted = 1;
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
5400 #else
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5401 chars_deleted = 2;
15772
eb1cef7102e3 (readline_internal) [DOS_NT]: Don't include CRs when
Richard M. Stallman <rms@gnu.org>
parents: 15683
diff changeset
5402 #endif
10376
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5403 }
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5404 else
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5405 {
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5406 chars_deleted = 1;
b1c4515958b6 * etags.c (Lang_function): Use void instead to declare the
Francesco Potortì <pot@gnu.org>
parents: 10355
diff changeset
5407 }
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5408 *p = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5409 break;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5410 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5411 *p++ = c;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5412 }
26262
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 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
5414
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 return lbp->len + chars_deleted;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5416 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5417
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5418 /*
17602
39b58a508be6 * etags.c [TeX_named_tokens]: Set to FALSE if undefined.
Francesco Potortì <pot@gnu.org>
parents: 17477
diff changeset
5419 * 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
5420 * 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
5421 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5422 static long
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5423 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
5424 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
5425 FILE *stream;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5426 {
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5427 /* 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
5428 long result = readline_internal (lbp, stream);
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5429
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5430 if (!no_line_directive
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5431 && result > 12 && strneq (lbp->buffer, "#line ", 6))
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5432 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5433 int start, lno;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5434
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5435 if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 1)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5436 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5437 char *endp = lbp->buffer + start;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5438
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5439 while ((endp = etags_strchr (endp, '"')) != NULL
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5440 && endp[-1] == '\\')
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5441 endp++;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5442 if (endp != NULL)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5443 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5444 int len = endp - (lbp->buffer + start);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5445
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5446 if (!strneq (curfile, lbp->buffer + start, len))
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5447 curfile = savenstr (lbp->buffer + start, len);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5448 lineno = lno;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5449 nocharno = TRUE; /* do not use char position for tags */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5450 return readline (lbp, stream);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5451 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5452 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5453 }
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5454 #ifdef ETAGS_REGEXPS
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5455 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5456 int match;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5457 pattern *pp;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5458
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5459 /* Match against relevant patterns. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5460 if (lbp->len > 0)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5461 for (pp = p_head; pp != NULL; pp = pp->p_next)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5462 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5463 /* Only use generic regexps or those for the current language. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5464 if (pp->lang != NULL && pp->lang != curlang)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5465 continue;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5466
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5467 match = re_match (pp->pat, lbp->buffer, lbp->len, 0, &pp->regs);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5468 switch (match)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5469 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5470 case -2:
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5471 /* Some error. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5472 if (!pp->error_signaled)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5473 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5474 error ("error while matching \"%s\"", pp->regex);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5475 pp->error_signaled = TRUE;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5476 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5477 break;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5478 case -1:
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5479 /* No match. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5480 break;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5481 default:
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5482 /* Match occurred. Construct a tag. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5483 if (pp->name_pattern[0] != '\0')
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5484 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5485 /* Make a named tag. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5486 char *name = substitute (lbp->buffer,
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5487 pp->name_pattern, &pp->regs);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5488 if (name != NULL)
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5489 pfnote (name, TRUE, lbp->buffer, match, lineno, linecharno);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5490 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5491 else
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5492 {
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5493 /* Make an unnamed tag. */
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5494 pfnote ((char *)NULL, TRUE,
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5495 lbp->buffer, match, lineno, linecharno);
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5496 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5497 break;
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5498 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5499 }
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5500 }
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5501 #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
5502
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5503 return result;
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5504 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5505
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5506
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5507 /*
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5508 * 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
5509 * 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
5510 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5511 static char *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5512 savestr (cp)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5513 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5514 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5515 return savenstr (cp, strlen (cp));
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5516 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5517
10404
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5518 /*
631f1dac6f7a Global polishing, some bugs corrected, dynamic allocation used instead
Francesco Potortì <pot@gnu.org>
parents: 10378
diff changeset
5519 * 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
5520 * 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
5521 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5522 static char *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5523 savenstr (cp, len)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5524 char *cp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5525 int len;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5526 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5527 register char *dp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5528
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5529 dp = xnew (len + 1, char);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5530 strncpy (dp, cp, len);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5531 dp[len] = '\0';
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5532 return dp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5533 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5534
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5535 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5536 * Return the ptr in sp at which the character c last
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5537 * appears; NULL if not found
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5538 *
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5539 * Identical to POSIX strrchr, included for portability.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5540 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5541 static char *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5542 etags_strrchr (sp, c)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5543 register const char *sp;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5544 register int c;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5545 {
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5546 register const char *r;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5547
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5548 r = NULL;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5549 do
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5550 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5551 if (*sp == c)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5552 r = sp;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5553 } while (*sp++);
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5554 return (char *)r;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5555 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5556
774
11867ad5bab4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
5557
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5558 /*
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5559 * Return the ptr in sp at which the character c first
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5560 * appears; NULL if not found
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5561 *
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5562 * Identical to POSIX strchr, included for portability.
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5563 */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5564 static char *
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5565 etags_strchr (sp, c)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5566 register const char *sp;
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5567 register int c;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5568 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5569 do
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5570 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5571 if (*sp == c)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5572 return (char *)sp;
9976
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5573 } while (*sp++);
2869e501c2de * etags.c [ETAGS_REGEXP]: All the new code that deals with regexps
Francesco Potortì <pot@gnu.org>
parents: 9975
diff changeset
5574 return NULL;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5575 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5576
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5577 /* Skip spaces, return new pointer. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5578 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5579 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
5580 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
5581 {
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5582 while (iswhite (*cp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5583 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
5584 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
5585 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5586
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5587 /* Skip non spaces, return new pointer. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5588 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5589 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
5590 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
5591 {
27661
c8b3e7e83e09 2000-02-10 Francesco Potorti` <pot@gnu.org>
Francesco Potortì <pot@gnu.org>
parents: 27658
diff changeset
5592 while (*cp != '\0' && !iswhite (*cp))
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5593 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
5594 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
5595 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5596
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5597 /* Print error message and exit. */
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5598 void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5599 fatal (s1, s2)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5600 char *s1, *s2;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5601 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5602 error (s1, s2);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5603 exit (BAD);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5604 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5605
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5606 static void
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5607 pfatal (s1)
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5608 char *s1;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5609 {
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5610 perror (s1);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5611 exit (BAD);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5612 }
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5613
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5614 static void
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5615 suggest_asking_for_help ()
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5616 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5617 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
5618 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
5619 #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
5620 "--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
5621 #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
5622 "-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
5623 #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
5624 );
13696
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5625 exit (BAD);
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5626 }
f89aa5a5c485 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
Francesco Potortì <pot@gnu.org>
parents: 13404
diff changeset
5627
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5628 /* Print error message. `s1' is printf control string, `s2' is arg for it. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5629 static void
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5630 error (s1, s2)
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5631 const char *s1, *s2;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5632 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5633 fprintf (stderr, "%s: ", progname);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5634 fprintf (stderr, s1, s2);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5635 fprintf (stderr, "\n");
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5636 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5637
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5638 /* Return a newly-allocated string whose contents
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5639 concatenate those of s1, s2, s3. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5640 static char *
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5641 concat (s1, s2, s3)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5642 char *s1, *s2, *s3;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5643 {
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5644 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5645 char *result = xnew (len1 + len2 + len3 + 1, char);
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5646
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5647 strcpy (result, s1);
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5648 strcpy (result + len1, s2);
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5649 strcpy (result + len1 + len2, s3);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5650 result[len1 + len2 + len3] = '\0';
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5651
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5652 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5653 }
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5654
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5655
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5656 /* 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
5657 guess the buffer size in advance. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5658 static char *
7227
6fa038c33a0f [MSDOS]: #include <sys/param.h> for the following.
Richard M. Stallman <rms@gnu.org>
parents: 7049
diff changeset
5659 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
5660 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5661 #ifdef HAVE_GETCWD
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5662 int bufsize = 200;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5663 char *path = xnew (bufsize, char);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5664
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5665 while (getcwd (path, bufsize) == NULL)
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5666 {
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
5667 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
5668 pfatal ("getcwd");
9975
e21b0674f37c * etags.c (<errno.h>): #include added.
Francesco Potortì <pot@gnu.org>
parents: 9773
diff changeset
5669 bufsize *= 2;
17778
c3ff4c535c9c * etags.c: (Cplusplus_suffixes): .pdb is Postscript with C syntax.
Francesco Potortì <pot@gnu.org>
parents: 17602
diff changeset
5670 free (path);
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5671 path = xnew (bufsize, char);
8789
81a2817b99b2 (etags_getcwd): Use getcwd if available.
Karl Heuer <kwzh@gnu.org>
parents: 8180
diff changeset
5672 }
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5673
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5674 canonicalize_filename (path);
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5675 return path;
16394
675944d1abc9 (etags_getcwd) [WINDOWSNT]: Convert backslashes to slashes.
Richard M. Stallman <rms@gnu.org>
parents: 16373
diff changeset
5676
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5677 #else /* not HAVE_GETCWD */
35665
2ce207b252dc Many changes to the parsing capabilities of etags.
Francesco Potortì <pot@gnu.org>
parents: 35653
diff changeset
5678 #if MSDOS
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5679
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5680 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
5681
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5682 getwd (path);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5683
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5684 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
5685 if (*p == '\\')
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5686 *p = '/';
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5687 else
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5688 *p = lowcase (*p);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5689
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5690 return strdup (path);
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5691 #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
5692 linebuffer path;
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5693 FILE *pipe;
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5694
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5695 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
5696 pipe = (FILE *) popen ("pwd 2>/dev/null", "r");
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5697 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
5698 pfatal ("pwd");
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5699 pclose (pipe);
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5700
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5701 return path.buffer;
16086
33519c691e63 (etags_getcwd): Use getcwd if available even if MSDOS.
Richard M. Stallman <rms@gnu.org>
parents: 15772
diff changeset
5702 #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
5703 #endif /* not HAVE_GETCWD */
10378
fb23ac6e6199 * etags.c (pfatal): New function.
Francesco Potortì <pot@gnu.org>
parents: 10376
diff changeset
5704 }
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5705
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5706 /* 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
5707 relative to the absolute directory DIR (which should end with a slash). */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5708 static char *
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5709 relative_filename (file, dir)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5710 char *file, *dir;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5711 {
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5712 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
5713 int i;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5714
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
5715 /* 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
5716 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
5717 fp = afn;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5718 dp = dir;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5719 while (*fp++ == *dp++)
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5720 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
5721 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
5722 #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
5723 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
5724 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
5725 #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
5726 do /* look at the equal chars until '/' */
16540
bf7e776e40f6 * etags.c (relative_filename): Bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 16394
diff changeset
5727 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
5728 while (*fp != '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5729
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
5730 /* 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
5731 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
5732 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
5733 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
5734 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
5735 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
5736 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
5737 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
5738
1b5cc3740793 Tue Apr 15 16:09:15 1997 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 17168
diff changeset
5739 /* 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
5740 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
5741 free (afn);
12879
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5742
3b90cbba7dad * etags.c (Pascal_functions): Close comment bug corrected.
Francesco Potortì <pot@gnu.org>
parents: 12398
diff changeset
5743 return res;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5744 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5745
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5746 /* 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
5747 of FILE given DIR (which should end with a slash). */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5748 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5749 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
5750 char *file, *dir;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5751 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5752 char *slashp, *cp, *res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5753
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5754 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
5755 res = savestr (file);
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5756 #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
5757 /* 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
5758 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
5759 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
5760 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
5761 #endif
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5762 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
5763 res = concat (dir, file, "");
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5764
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5765 /* Delete the "/dirname/.." and "/." substrings. */
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5766 slashp = etags_strchr (res, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5767 while (slashp != NULL && slashp[0] != '\0')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5768 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5769 if (slashp[1] == '.')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5770 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5771 if (slashp[2] == '.'
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5772 && (slashp[3] == '/' || slashp[3] == '\0'))
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5773 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5774 cp = slashp;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5775 do
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5776 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
5777 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
5778 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
5779 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
5780 #ifdef DOS_NT
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5781 /* 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
5782 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
5783 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
5784 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
5785 cp = slashp;
14920
b909bb3e64c9 (absolutefn) [DOS_NT]: Support Novell drives whose drive
Richard M. Stallman <rms@gnu.org>
parents: 14859
diff changeset
5786 #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
5787 strcpy (cp, slashp + 3);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5788 slashp = cp;
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5789 continue;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5790 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5791 else if (slashp[2] == '/' || slashp[2] == '\0')
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5792 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5793 strcpy (slashp, slashp + 2);
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5794 continue;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5795 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5796 }
7776
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5797
f91e2cf8770b * etags.c (absolute_filename): Remove infinite loop bug when
Francesco Potortì <pot@gnu.org>
parents: 7775
diff changeset
5798 slashp = etags_strchr (slashp + 1, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5799 }
24140
9e4d1d3eab09 (etags_getcwd, absolute_filename) [DOS_NT]: Canonicalize
Geoff Voelker <voelker@cs.washington.edu>
parents: 24059
diff changeset
5800
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
5801 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
5802 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
5803 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
5804 return res;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5805 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5806
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5807 /* 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
5808 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
5809 end with a slash). */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5810 static char *
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5811 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
5812 char *file, *dir;
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5813 {
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5814 char *slashp, *res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5815 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
5816
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5817 canonicalize_filename (file);
6592
9a76406c9f98 * etags.c (main): use etags_getcwd for compatibility.
Francesco Potortì <pot@gnu.org>
parents: 6530
diff changeset
5818 slashp = etags_strrchr (file, '/');
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5819 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
5820 return savestr (dir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5821 save = slashp[1];
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5822 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
5823 res = absolute_filename (file, dir);
6482
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5824 slashp[1] = save;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5825
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5826 return res;
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5827 }
91112dd5c9f5 * etags.c (cwd, outfiledir): vars added.
Francesco Potortì <pot@gnu.org>
parents: 5976
diff changeset
5828
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5829 /* 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
5830 string must have been canonicalized with canonicalize_filename. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5831 static bool
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5832 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
5833 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
5834 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5835 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
5836 #ifdef DOS_NT
34608
9286b7ab7104 (ISALNUM, ISALPHA, ISDIGIT, ISLOWER): New macros.
Gerd Moellmann <gerd@gnu.org>
parents: 30969
diff changeset
5837 || (ISALPHA(fn[0]) && fn[1] == ':' && fn[2] == '/')
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5838 #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
5839 );
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5840 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5841
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5842 /* Translate backslashes into slashes. Works in place. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5843 static void
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5844 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
5845 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
5846 {
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5847 #ifdef DOS_NT
26507
aabdfbf65c68 1999-11-19 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26340
diff changeset
5848 /* Canonicalize drive letter case. */
35297
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
5849 if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0]))
e268b7b500f0 Changes for makefile support in etags.
Francesco Potortì <pot@gnu.org>
parents: 34635
diff changeset
5850 fn[0] = upcase (fn[0]);
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5851 /* 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
5852 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
5853 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
5854 *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
5855 #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
5856 /* 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
5857 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
5858 #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
5859 }
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5860
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5861 /* Set the minimum size of a string contained in a linebuffer. */
27595
25ed45af9355 2000-01-31 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 26507
diff changeset
5862 static void
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5863 linebuffer_setlen (lbp, toksize)
26262
c416a18b0a5d Checked in at last a lot of improvementes and bug fixes. The oldest dating
Francesco Potortì <pot@gnu.org>
parents: 26083
diff changeset
5864 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
5865 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
5866 {
35574
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5867 while (lbp->size <= toksize)
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5868 {
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5869 lbp->size *= 2;
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5870 xrnew (lbp->buffer, lbp->size, char);
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5871 }
ede82ab0ae24 Many small improvements in tagging accuracy and capability,
Francesco Potortì <pot@gnu.org>
parents: 35302
diff changeset
5872 lbp->len = toksize;
16573
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5873 }
4ed8667d6bd9 Wed Nov 13 17:51:29 1996 Francesco Potorti` <F.Potorti@cnuce.cnr.it>
Francesco Potortì <pot@gnu.org>
parents: 16540
diff changeset
5874
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5875 /* Like malloc but get fatal error if memory is exhausted. */
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5876 static PTR
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5877 xmalloc (size)
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
5878 unsigned int size;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5879 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5880 PTR result = (PTR) malloc (size);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5881 if (result == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5882 fatal ("virtual memory exhausted", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5883 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5884 }
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5885
43723
5cd450d9f443 * etags.c: Honour #line directives.
Francesco Potortì <pot@gnu.org>
parents: 42345
diff changeset
5886 static PTR
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5887 xrealloc (ptr, size)
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5888 char *ptr;
5580
517d8eb361f8 * etags.c (stab_entry, stab_create, stab_find, stab_search,
Francesco Potortì <pot@gnu.org>
parents: 5448
diff changeset
5889 unsigned int size;
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5890 {
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5891 PTR result = (PTR) realloc (ptr, size);
5940
e663f6626075 * etags.c (absolute_pathnames, cwd): added global vars.
Francesco Potortì <pot@gnu.org>
parents: 5580
diff changeset
5892 if (result == NULL)
16607
16b8d910795f * etags.c (C_entries): Test tok.valid. This handles some
Francesco Potortì <pot@gnu.org>
parents: 16573
diff changeset
5893 fatal ("virtual memory exhausted", (char *)NULL);
240
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5894 return result;
939deddfb6b2 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5895 }
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5896
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5897 /*
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5898 * Local Variables:
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5899 * c-indentation-style: gnu
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5900 * indent-tabs-mode: t
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5901 * tab-width: 8
42345
7d2776273a81 support for Perl packages
Francesco Potortì <pot@gnu.org>
parents: 42042
diff changeset
5902 * c-font-lock-extra-types: ("FILE" "bool" "language" "linebuffer")
42042
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5903 * End:
481d38f6aec2 * etags.c (PHP_functions): New function by Diez B. Roggisch,
Francesco Potortì <pot@gnu.org>
parents: 39317
diff changeset
5904 */