ctags.rb 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Rakefile +23 -0
- data/ctags.rb.gemspec +23 -0
- data/ext/.gitignore +3 -0
- data/ext/extconf.rb +15 -0
- data/ext/vendor/exuberant-ctags/.gitignore +6 -0
- data/ext/vendor/exuberant-ctags/.indent.pro +31 -0
- data/ext/vendor/exuberant-ctags/COPYING +340 -0
- data/ext/vendor/exuberant-ctags/EXTENDING.html +386 -0
- data/ext/vendor/exuberant-ctags/FAQ +371 -0
- data/ext/vendor/exuberant-ctags/INSTALL +215 -0
- data/ext/vendor/exuberant-ctags/INSTALL.oth +73 -0
- data/ext/vendor/exuberant-ctags/MAINTAINERS +88 -0
- data/ext/vendor/exuberant-ctags/Makefile.in +222 -0
- data/ext/vendor/exuberant-ctags/NEWS +871 -0
- data/ext/vendor/exuberant-ctags/README +73 -0
- data/ext/vendor/exuberant-ctags/ant.c +42 -0
- data/ext/vendor/exuberant-ctags/argproc.c +505 -0
- data/ext/vendor/exuberant-ctags/args.c +274 -0
- data/ext/vendor/exuberant-ctags/args.h +63 -0
- data/ext/vendor/exuberant-ctags/asm.c +387 -0
- data/ext/vendor/exuberant-ctags/asp.c +328 -0
- data/ext/vendor/exuberant-ctags/awk.c +81 -0
- data/ext/vendor/exuberant-ctags/basic.c +203 -0
- data/ext/vendor/exuberant-ctags/beta.c +321 -0
- data/ext/vendor/exuberant-ctags/c.c +2932 -0
- data/ext/vendor/exuberant-ctags/cobol.c +50 -0
- data/ext/vendor/exuberant-ctags/config.h.in +277 -0
- data/ext/vendor/exuberant-ctags/configure +7704 -0
- data/ext/vendor/exuberant-ctags/configure.ac +532 -0
- data/ext/vendor/exuberant-ctags/ctags.1 +1186 -0
- data/ext/vendor/exuberant-ctags/ctags.h +28 -0
- data/ext/vendor/exuberant-ctags/ctags.html +2087 -0
- data/ext/vendor/exuberant-ctags/ctags.spec +40 -0
- data/ext/vendor/exuberant-ctags/debug.c +113 -0
- data/ext/vendor/exuberant-ctags/debug.h +70 -0
- data/ext/vendor/exuberant-ctags/descrip.mms +68 -0
- data/ext/vendor/exuberant-ctags/dosbatch.c +42 -0
- data/ext/vendor/exuberant-ctags/e_amiga.h +24 -0
- data/ext/vendor/exuberant-ctags/e_djgpp.h +47 -0
- data/ext/vendor/exuberant-ctags/e_mac.h +143 -0
- data/ext/vendor/exuberant-ctags/e_msoft.h +76 -0
- data/ext/vendor/exuberant-ctags/e_os2.h +37 -0
- data/ext/vendor/exuberant-ctags/e_qdos.h +34 -0
- data/ext/vendor/exuberant-ctags/e_riscos.h +58 -0
- data/ext/vendor/exuberant-ctags/e_vms.h +31 -0
- data/ext/vendor/exuberant-ctags/eiffel.c +1352 -0
- data/ext/vendor/exuberant-ctags/entry.c +847 -0
- data/ext/vendor/exuberant-ctags/entry.h +103 -0
- data/ext/vendor/exuberant-ctags/erlang.c +189 -0
- data/ext/vendor/exuberant-ctags/flex.c +2243 -0
- data/ext/vendor/exuberant-ctags/fortran.c +2197 -0
- data/ext/vendor/exuberant-ctags/general.h +127 -0
- data/ext/vendor/exuberant-ctags/get.c +669 -0
- data/ext/vendor/exuberant-ctags/get.h +50 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/all-wcprops +47 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/entries +112 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/README.txt.svn-base +5 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regcomp.c.svn-base +3818 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.c.svn-base +74 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex.h.svn-base +575 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.c.svn-base +1713 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regex_internal.h.svn-base +773 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/.svn/text-base/regexec.c.svn-base +4338 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/README.txt +5 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regcomp.c +3818 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex.c +74 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex.h +575 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex_internal.c +1713 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regex_internal.h +773 -0
- data/ext/vendor/exuberant-ctags/gnu_regex/regexec.c +4338 -0
- data/ext/vendor/exuberant-ctags/html.c +49 -0
- data/ext/vendor/exuberant-ctags/jscript.c +1572 -0
- data/ext/vendor/exuberant-ctags/keyword.c +258 -0
- data/ext/vendor/exuberant-ctags/keyword.h +34 -0
- data/ext/vendor/exuberant-ctags/lisp.c +139 -0
- data/ext/vendor/exuberant-ctags/lregex.c +704 -0
- data/ext/vendor/exuberant-ctags/lua.c +133 -0
- data/ext/vendor/exuberant-ctags/mac.c +273 -0
- data/ext/vendor/exuberant-ctags/magic.diff +21 -0
- data/ext/vendor/exuberant-ctags/main.c +584 -0
- data/ext/vendor/exuberant-ctags/main.h +32 -0
- data/ext/vendor/exuberant-ctags/maintainer.mak +476 -0
- data/ext/vendor/exuberant-ctags/make.c +217 -0
- data/ext/vendor/exuberant-ctags/matlab.c +44 -0
- data/ext/vendor/exuberant-ctags/mk_bc3.mak +46 -0
- data/ext/vendor/exuberant-ctags/mk_bc5.mak +49 -0
- data/ext/vendor/exuberant-ctags/mk_djg.mak +18 -0
- data/ext/vendor/exuberant-ctags/mk_manx.mak +65 -0
- data/ext/vendor/exuberant-ctags/mk_mingw.mak +31 -0
- data/ext/vendor/exuberant-ctags/mk_mpw.mak +130 -0
- data/ext/vendor/exuberant-ctags/mk_mvc.mak +40 -0
- data/ext/vendor/exuberant-ctags/mk_os2.mak +104 -0
- data/ext/vendor/exuberant-ctags/mk_qdos.mak +100 -0
- data/ext/vendor/exuberant-ctags/mk_sas.mak +63 -0
- data/ext/vendor/exuberant-ctags/mkinstalldirs +40 -0
- data/ext/vendor/exuberant-ctags/ocaml.c +1842 -0
- data/ext/vendor/exuberant-ctags/options.c +1842 -0
- data/ext/vendor/exuberant-ctags/options.h +155 -0
- data/ext/vendor/exuberant-ctags/parse.c +677 -0
- data/ext/vendor/exuberant-ctags/parse.h +129 -0
- data/ext/vendor/exuberant-ctags/parsers.h +63 -0
- data/ext/vendor/exuberant-ctags/pascal.c +267 -0
- data/ext/vendor/exuberant-ctags/perl.c +382 -0
- data/ext/vendor/exuberant-ctags/php.c +237 -0
- data/ext/vendor/exuberant-ctags/python.c +771 -0
- data/ext/vendor/exuberant-ctags/qdos.c +106 -0
- data/ext/vendor/exuberant-ctags/read.c +569 -0
- data/ext/vendor/exuberant-ctags/read.h +116 -0
- data/ext/vendor/exuberant-ctags/readtags.c +959 -0
- data/ext/vendor/exuberant-ctags/readtags.h +252 -0
- data/ext/vendor/exuberant-ctags/rexx.c +39 -0
- data/ext/vendor/exuberant-ctags/routines.c +891 -0
- data/ext/vendor/exuberant-ctags/routines.h +134 -0
- data/ext/vendor/exuberant-ctags/ruby.c +408 -0
- data/ext/vendor/exuberant-ctags/scheme.c +111 -0
- data/ext/vendor/exuberant-ctags/sh.c +115 -0
- data/ext/vendor/exuberant-ctags/slang.c +41 -0
- data/ext/vendor/exuberant-ctags/sml.c +212 -0
- data/ext/vendor/exuberant-ctags/sort.c +230 -0
- data/ext/vendor/exuberant-ctags/sort.h +32 -0
- data/ext/vendor/exuberant-ctags/source.mak +122 -0
- data/ext/vendor/exuberant-ctags/sql.c +2112 -0
- data/ext/vendor/exuberant-ctags/strlist.c +281 -0
- data/ext/vendor/exuberant-ctags/strlist.h +54 -0
- data/ext/vendor/exuberant-ctags/tcl.c +116 -0
- data/ext/vendor/exuberant-ctags/tex.c +524 -0
- data/ext/vendor/exuberant-ctags/verilog.c +340 -0
- data/ext/vendor/exuberant-ctags/vhdl.c +835 -0
- data/ext/vendor/exuberant-ctags/vim.c +636 -0
- data/ext/vendor/exuberant-ctags/vstring.c +232 -0
- data/ext/vendor/exuberant-ctags/vstring.h +85 -0
- data/ext/vendor/exuberant-ctags/yacc.c +40 -0
- data/lib/ctags/exuberant.rb +45 -0
- data/lib/ctags/version.rb +3 -0
- data/lib/ctags.rb +6 -0
- data/test/test_ctags.rb +24 -0
- metadata +233 -0
@@ -0,0 +1,371 @@
|
|
1
|
+
Frequently Asked Questions
|
2
|
+
==========================
|
3
|
+
|
4
|
+
* 1. Why do you call it "Exuberant Ctags"?
|
5
|
+
* 2. Why doesn't my editor work with these tag files?
|
6
|
+
* 3. What are these strange bits of text beginning with ;"?
|
7
|
+
* 4. Why doesn't XEmacs' Speedbar module work with Exuberant Ctags?
|
8
|
+
* 5. Why doesn't Xemacs correctly locate the tag in the source file?
|
9
|
+
* 6. Why doesn't NEdit correctly locate the tag in the source file?
|
10
|
+
* 7. Why can't I jump to "class::member"?
|
11
|
+
* 8. How can I avoid having to specify my favorite option every time?
|
12
|
+
* 9. Why do I end up on the wrong line when I jump to a tag?
|
13
|
+
* 10. How do I jump to the tag I want instead of the wrong one by the
|
14
|
+
same name?
|
15
|
+
* 11. What is "Vim"?
|
16
|
+
* 12. How can I locate all references to a specific function or variable?
|
17
|
+
* 13. Why does appending tags to a tag file tag so long?
|
18
|
+
* 14. How do I get regex support for Win32?
|
19
|
+
* 15. How should I set up tag files for a multi-level directory hierarchy?
|
20
|
+
|
21
|
+
----------------------------------------------------------------------
|
22
|
+
1. Why do you call it "Exuberant Ctags"?
|
23
|
+
|
24
|
+
Because one of the meanings of the word "exuberant" is:
|
25
|
+
|
26
|
+
exuberant : produced in extreme abundance : PLENTIFUL syn see PROFUSE
|
27
|
+
|
28
|
+
Compare the tag file produced by Exuberant Ctags with that produced by any
|
29
|
+
other ctags and you will see how appropriate the name is.
|
30
|
+
|
31
|
+
----------------------------------------------------------------------
|
32
|
+
2. Why doesn't my editor work with these tag files?
|
33
|
+
|
34
|
+
3. What are these strange bits of text beginning with ;" which follow
|
35
|
+
many of the lines in the tag file?
|
36
|
+
|
37
|
+
These are "extension flags". They are added in order to provide extra
|
38
|
+
information about the tag that may be utilized by the editor in order to
|
39
|
+
more intelligently handle tags. They are appended to the EX command part of
|
40
|
+
the tag line in a manner that provides backwards compatibility with existing
|
41
|
+
implementations of the Vi editor. The semicolon is an EX command separator
|
42
|
+
and the double quote begins an EX comment. Thus, the extension flags appear
|
43
|
+
as an EX comment and should be ignored by the editor when it processes the
|
44
|
+
EX command.
|
45
|
+
|
46
|
+
Some non-vi editors, however, implement only the bare minimum of EX commands
|
47
|
+
in order to process the search command or line number in the third field of
|
48
|
+
the tag file. If you encounter this problem, use the option "--format=1" to
|
49
|
+
generate a tag file without these extensions (remember that you can set the
|
50
|
+
CTAGS environment variable to any default arguments you wish to supply). Then
|
51
|
+
ask the supplier of your editor to implement handling of this feature of EX
|
52
|
+
commands.
|
53
|
+
|
54
|
+
----------------------------------------------------------------------
|
55
|
+
4. Why doesn't XEmacs' Speedbar module work with Exuberant Ctags?
|
56
|
+
|
57
|
+
The default command line switches used by XEmacs for "etags" are not
|
58
|
+
compatible with Exuberant Ctags options. By default, Exuberant Ctags installs
|
59
|
+
a symbolic link, "etags", pointing to the ctags executable. When Exuberant
|
60
|
+
Ctags is started with the name "etags", it produces Emacs-style tag files by
|
61
|
+
default.
|
62
|
+
|
63
|
+
To fix this, add the following lines to your .emacs file, replacing the path
|
64
|
+
to "etags" with the path where the symbolic link was installed.
|
65
|
+
|
66
|
+
(autoload 'speedbar "speedbar")
|
67
|
+
(setq speedbar-fetch-etags-command "/usr/local/bin/etags"
|
68
|
+
speedbar-fetch-etags-arguments '("-f" "-"))
|
69
|
+
|
70
|
+
----------------------------------------------------------------------
|
71
|
+
5. Why doesn't Xemacs correctly locate the tag in the source file?
|
72
|
+
|
73
|
+
This has been observed with version 20.3. It seems that when Xemacs searches
|
74
|
+
for a tag, it searches using the tag name instead of the search string located
|
75
|
+
in the TAGS file. This is a bug in Xemacs and does not occur in the GNU
|
76
|
+
version of Emacs.
|
77
|
+
|
78
|
+
----------------------------------------------------------------------
|
79
|
+
6. Why doesn't NEdit correctly locate the tag in the source file?
|
80
|
+
|
81
|
+
Versions of NEdit prior to 5.1 did not support the extended tag file format
|
82
|
+
generated by Exuberant Ctags by default. Either upgrade to version 5.1 or
|
83
|
+
specify the option "--format=1" when running ctags to output the old tag file
|
84
|
+
format.
|
85
|
+
|
86
|
+
----------------------------------------------------------------------
|
87
|
+
7. Why can't I jump to "class::member"?
|
88
|
+
|
89
|
+
Because, by default, ctags only generates tags for the separate identifiers
|
90
|
+
found in the source files. If you specify the --extra=+q option, then
|
91
|
+
ctags will also generate a second, class-qualified tag for each class member
|
92
|
+
(data and function/method) in the form class::member for C++, and in the form
|
93
|
+
class.method for Eiffel and Java.
|
94
|
+
|
95
|
+
----------------------------------------------------------------------
|
96
|
+
8. How can I avoid having to specify my favorite option every time?
|
97
|
+
|
98
|
+
Either by setting the environment variable CTAGS to your custom
|
99
|
+
options, or putting them into a .ctags file in your home directory.
|
100
|
+
|
101
|
+
----------------------------------------------------------------------
|
102
|
+
9. Why do I end up on the wrong line when I jump to a tag?
|
103
|
+
|
104
|
+
By default, ctags encodes the line number in the file where macro (#define)
|
105
|
+
tags are found. This was done to remain compatible with the original UNIX
|
106
|
+
version of ctags. If you change the file containing the tag without
|
107
|
+
rebuilding the tag file, the location of tag in the tag file may no longer
|
108
|
+
match the current location.
|
109
|
+
|
110
|
+
In order to avoid this problem, you can specify the option "--excmd=p",
|
111
|
+
which causes ctags to use a search pattern to locate macro tags. I have
|
112
|
+
never uncovered the reason why the original UNIX ctags used line numbers
|
113
|
+
exclusively for macro tags, but have so far resisted changing the default
|
114
|
+
behaviour of Exuberant Ctags to behave differently.
|
115
|
+
|
116
|
+
----------------------------------------------------------------------
|
117
|
+
10. How do I jump to the tag I want instead of the wrong one by the
|
118
|
+
same name?
|
119
|
+
|
120
|
+
A tag file is simple a list of tag names and where to find them. If there
|
121
|
+
are duplicate entries, you often end up going to the wrong one because the
|
122
|
+
tag file is sorted and your editor locates the first one in the tag file.
|
123
|
+
|
124
|
+
Standard Vi provides no facilities to alter this behavior. However, Vim
|
125
|
+
has some nice features to minimize this problem, primarly by examining all
|
126
|
+
matches and choosing the best one under the circumstances. Vim also provides
|
127
|
+
commands which allow for selection of the desired matching tag.
|
128
|
+
|
129
|
+
----------------------------------------------------------------------
|
130
|
+
11. What is "Vim"?
|
131
|
+
|
132
|
+
Vim is a vi-compatible editor available as source and compilable for any
|
133
|
+
platform. Yeah, I know the first reaction is to shy away from this. But you
|
134
|
+
will never regret getting it, and you will become greatly attached to its
|
135
|
+
features, which you can learn gradually. I would be willing to say that it
|
136
|
+
is the best vi-clone available within 4 light-years of Alpha Centauri. It
|
137
|
+
works (nearly) exactly like standard vi, but provides some incredibly useful
|
138
|
+
extensions (some of which I have participated in designing with the author).
|
139
|
+
Most Linux distributions have adopted Vim as its standard vi.
|
140
|
+
|
141
|
+
----------------------------------------------------------------------
|
142
|
+
12. How can I locate all references to a specific function or variable?
|
143
|
+
|
144
|
+
There are several packages already available which provide this capability.
|
145
|
+
Namely, these are: GLOBAL source code tag system, GNU id-utils, cscope,
|
146
|
+
and cflow. As of this writing, they can be found in the following locations:
|
147
|
+
|
148
|
+
GLOBAL: http://www.gnu.org/software/global
|
149
|
+
id-utils: http://www.gnu.org/software/idutils/idutils.html
|
150
|
+
cscope: http://cscope.sourceforge.net
|
151
|
+
cflow: ftp://www.ibiblio.org/pub/Linux/devel/lang/c
|
152
|
+
|
153
|
+
----------------------------------------------------------------------
|
154
|
+
13. Why does appending tags to a tag file tag so long?
|
155
|
+
|
156
|
+
Sometimes, in an attempt to build a global tag file for all source files in
|
157
|
+
a large source tree of many directories, someone will make an attempt to run
|
158
|
+
ctags in append (-a) mode on every directory in the hierarchy. Each time
|
159
|
+
ctags is invoked, its default behavior is to sort the tag file once the tags
|
160
|
+
for that execution have been added. As the cumulative tag file grows, the sort
|
161
|
+
time increases arithmetically.
|
162
|
+
|
163
|
+
The best way to avoid this problem (and the most efficient) is to make
|
164
|
+
use of the --recurse (or -R) option of ctags by executing the following
|
165
|
+
command in the root of the directory hierarchy (thus running ctags only once):
|
166
|
+
|
167
|
+
ctags -R
|
168
|
+
|
169
|
+
If you really insist on running ctags separately on each directory, you can
|
170
|
+
avoid the sort pass each time by specifying the option "--sort=no". Once the
|
171
|
+
tag file is completely built, use the sort command to manually sort the
|
172
|
+
final tag file, or let the final invocation of ctags sort the file.
|
173
|
+
|
174
|
+
----------------------------------------------------------------------
|
175
|
+
14. How do I get regex support for Win32?
|
176
|
+
|
177
|
+
You need to download the GNU regex package for Win32 from the following
|
178
|
+
location:
|
179
|
+
|
180
|
+
http://people.delphiforums.com/gjc/gnu_regex.html
|
181
|
+
|
182
|
+
Then point the makefile macro, REGEX_DIR, found in mk_mvc.mak and mk_bc5.mak,
|
183
|
+
to the directory created by extracting this archive.
|
184
|
+
|
185
|
+
----------------------------------------------------------------------
|
186
|
+
15. How should I set up tag files for a multi-level directory hierarchy?
|
187
|
+
|
188
|
+
There are a few ways of approaching this:
|
189
|
+
|
190
|
+
1. A local tag file in each directory containing only the tags for source
|
191
|
+
files in that directory.
|
192
|
+
|
193
|
+
2. One single big, global tag file present in the root directory of your
|
194
|
+
hierarchy, containing all tags present in all source files in the
|
195
|
+
hierarchy.
|
196
|
+
|
197
|
+
3. A local tag file in each directory containing only the tags for source
|
198
|
+
files in that directory, in addition to one single global tag file
|
199
|
+
present in the root directory of your hierarchy, containing all
|
200
|
+
non-static tags present in all source files in the hierarchy.
|
201
|
+
|
202
|
+
4. A local tag file in each directory of the hierarchy, each one
|
203
|
+
containing all tags present in source files in that directory and all
|
204
|
+
non-static tags in every directory below it (note that this implies
|
205
|
+
also having one big tag file in the root directory of the hierarchy).
|
206
|
+
|
207
|
+
Each of these approaches has its own set of advantages and disadvantages,
|
208
|
+
depending upon your particular conditions. Which approach is deemed best
|
209
|
+
depends upon the following factors:
|
210
|
+
|
211
|
+
A. The ability of your editor to use multiple tag files.
|
212
|
+
|
213
|
+
If your editor cannot make use of multiple tag files (original vi
|
214
|
+
implementations could not), then one large tag file is the only way to
|
215
|
+
go if you ever desire to jump to tags located in other directories. If
|
216
|
+
you never need to jump to tags in another directory (i.e. the source
|
217
|
+
in each directory is entirely self-contained), then a local tag file
|
218
|
+
in each directory will fit your needs.
|
219
|
+
|
220
|
+
B. The time is takes for your editor to look up a tag in the tag file.
|
221
|
+
|
222
|
+
The significance of this factor depends upon the size of your source
|
223
|
+
tree and on whether the source files are located on a local or remote
|
224
|
+
file system. For source and tag files located on a local file system,
|
225
|
+
looking up a tag is not as big a hit as one might first imagine, since
|
226
|
+
vi implementations typically perform a binary search on a sorted tag
|
227
|
+
file. This may or may not be true for the editor you use. For files
|
228
|
+
located on a remote file system, reading a large file is an expensive
|
229
|
+
operation.
|
230
|
+
|
231
|
+
C. Whether or not you expect the source code to change and the time it
|
232
|
+
takes to rebuild a tag file to account for changes to the source code.
|
233
|
+
|
234
|
+
While Exuberant Ctags is particularly fast in scanning source code
|
235
|
+
(around 1-2 MB/sec), a large project may still result in objectionable
|
236
|
+
delays if one wishes to keep their tag file(s) up to date on a
|
237
|
+
frequent basis, or if the files are located on a remote file system.
|
238
|
+
|
239
|
+
D. The presence of duplicate tags in the source code and the ability to
|
240
|
+
handle them.
|
241
|
+
|
242
|
+
The impact of this factor is influenced by the following three issues:
|
243
|
+
|
244
|
+
1. How common are duplicate tags in your project?
|
245
|
+
|
246
|
+
2. Does your editor provide any facilities for dealing with duplicate
|
247
|
+
tags?
|
248
|
+
|
249
|
+
While standard vi does not, many modern vi implementations, such
|
250
|
+
as Vim have good facilities for selecting the desired match from
|
251
|
+
the list of duplicates. If your editor does not support duplicate
|
252
|
+
tags, then it will typically send you to only one of them, whether
|
253
|
+
or not that is the one you wanted (and not even notifying you that
|
254
|
+
there are other potential matches).
|
255
|
+
|
256
|
+
3. What is the significance of duplicate tags?
|
257
|
+
|
258
|
+
For example, if you have two tags of the same name from entirely
|
259
|
+
isolated software components, jumping first to the match found
|
260
|
+
in component B while working in component A may be entirely
|
261
|
+
misleading, distracting or inconvenient (to keep having to choose
|
262
|
+
which one if your editor provides you with a list of matches).
|
263
|
+
However, if you have two tags of the same name for parallel builds
|
264
|
+
(say two initialization routines for different hosts), you may
|
265
|
+
always want to specify which one you want.
|
266
|
+
|
267
|
+
Of the approaches listed above, I tend to favor Approach 3. My editor of
|
268
|
+
choice is Vim, which provides a rich set of features for handling multiple
|
269
|
+
tag files, which partly influences my choice. If you are working with
|
270
|
+
source files on a remote file system, then I would recommend either
|
271
|
+
Approach 3 or Approach 4, depending upon the hit when reading the global
|
272
|
+
tag file.
|
273
|
+
|
274
|
+
The advantages of Approach 3 are many (assuming that your editor has
|
275
|
+
the ability to support both multiple tag files and duplicate tags). All
|
276
|
+
lookups of tag located in the currect directory are fast and the local
|
277
|
+
tag file can be quickly and easily regenerated in one second or less
|
278
|
+
(I have even mapped a keystroke to do this easily). A lookup of a
|
279
|
+
(necessarily non-static) tag found in another directory fails a lookup in
|
280
|
+
the local tag file, but is found in the global tag file, which satisfies
|
281
|
+
all cross-directory lookups. The global tag file can be automatically
|
282
|
+
regenerated periodically with a cron job (and perhaps the local tag files
|
283
|
+
also).
|
284
|
+
|
285
|
+
Now I give an example of how you would implement Approach 3. Means of
|
286
|
+
implementing the other approaches can be performed in a similar manner.
|
287
|
+
|
288
|
+
Here is a visual representation of an example directory hierarchy:
|
289
|
+
|
290
|
+
project
|
291
|
+
`-----misccomp
|
292
|
+
| `...
|
293
|
+
`-----sysint
|
294
|
+
`-----client
|
295
|
+
| `-----hdrs
|
296
|
+
| `-----lib
|
297
|
+
| `-----src
|
298
|
+
| `-----test
|
299
|
+
`-----common
|
300
|
+
| `-----hdrs
|
301
|
+
| `-----lib
|
302
|
+
| `-----src
|
303
|
+
| `-----test
|
304
|
+
`-----server
|
305
|
+
`-----hdrs
|
306
|
+
`-----lib
|
307
|
+
`-----src
|
308
|
+
`-----test
|
309
|
+
|
310
|
+
Here is a recommended solution (conceptually) to build the tag files:
|
311
|
+
|
312
|
+
1. Within each of the leaf nodes (i.e. hdrs, lib, src, test) build a tag
|
313
|
+
file using "ctags *.[ch]". This can be easily be done for the whole
|
314
|
+
hierarchy by making a shell script, call it "dirtags", containing the
|
315
|
+
following lines:
|
316
|
+
|
317
|
+
#!/bin/sh
|
318
|
+
cd $1
|
319
|
+
ctags *
|
320
|
+
|
321
|
+
Now execute the following command:
|
322
|
+
|
323
|
+
find * -type d -exec dirtags {} \;
|
324
|
+
|
325
|
+
These tag files are trivial (and extremely quick) to rebuild while
|
326
|
+
making changes within a directory. The following Vim key mapping is
|
327
|
+
quite useful to rebuild the tag file in the directory of the current
|
328
|
+
source file:
|
329
|
+
|
330
|
+
:nmap ,t :!(cd %:p:h;ctags *.[ch])&<CR><CR>
|
331
|
+
|
332
|
+
2. Build the global tag file:
|
333
|
+
|
334
|
+
cd ~/project
|
335
|
+
ctags --file-scope=no -R
|
336
|
+
|
337
|
+
thus constructing a tag file containing only non-static tags for all
|
338
|
+
source files in all descendent directories.
|
339
|
+
|
340
|
+
3. Configure your editor to read the local tag file first, then consult
|
341
|
+
the global tag file when not found in the local tag file. In Vim,
|
342
|
+
this is done as follows:
|
343
|
+
|
344
|
+
:set tags=./tags,tags,~/project/tags
|
345
|
+
|
346
|
+
If you wish to implement Approach 4, you would need to replace the
|
347
|
+
"dirtags" script of step 1 with the following:
|
348
|
+
|
349
|
+
#!/bin/sh
|
350
|
+
cd $1
|
351
|
+
ctags *
|
352
|
+
# Now append the non-static tags from descendent directories
|
353
|
+
find * -type d -prune -print | ctags -aR --file-scope=no -L-
|
354
|
+
|
355
|
+
And replace the configuration of step 3 with this:
|
356
|
+
|
357
|
+
:set tags=./tags,./../tags,./../../tags,./../../../tags,tags
|
358
|
+
|
359
|
+
As a caveat, it should be noted that step 2 builds a global tag file whose
|
360
|
+
file names will be relative to the directory in which the global tag file
|
361
|
+
is being built. This takes advantage of the Vim 'tagrelative' option,
|
362
|
+
which causes the path to be interpreted a relative to the location of the
|
363
|
+
tag file instead of the current directory. For standard vi, which always
|
364
|
+
interprets the paths as relative to the current directory, we need to
|
365
|
+
build the global tag file with absolute path names. This can be
|
366
|
+
accomplished by replacing step 2 with the following:
|
367
|
+
|
368
|
+
cd ~/project
|
369
|
+
ctags --file-scope=no -R `pwd`
|
370
|
+
|
371
|
+
--
|
@@ -0,0 +1,215 @@
|
|
1
|
+
Custom Installation
|
2
|
+
===================
|
3
|
+
|
4
|
+
These installation instructions are for Unix or Unix-like platforms (or at
|
5
|
+
least, those platforms which are able to run a Bourne shell script). If you
|
6
|
+
are attempting to install Exuberant Ctags on some other platform, see the file
|
7
|
+
INSTALL.oth.
|
8
|
+
|
9
|
+
If you are not familiar with using the configure scripts generated by GNU
|
10
|
+
autoconf, read the "Basic Installation" section below; then return here.
|
11
|
+
The configure script in this package supports the following custom options:
|
12
|
+
|
13
|
+
--disable-etags By default, "make install" will install one
|
14
|
+
binary, "ctags", one man page, "ctags.1", and
|
15
|
+
create links to these two files by the names
|
16
|
+
"etags" and "etags.1". If you do not want to
|
17
|
+
install the "etags" links, use this option.
|
18
|
+
|
19
|
+
--disable-extended-format Ctags now appends "extension flags" to the
|
20
|
+
end of each tag entry in a manner which is
|
21
|
+
backwards with original Vi implementation
|
22
|
+
(they are placed into an EX comment). This
|
23
|
+
can be disabled via use of the ctags --format
|
24
|
+
option. This configure option changes the
|
25
|
+
default behavior of ctags to disable use of
|
26
|
+
these extension flags (i.e. use the original
|
27
|
+
tag file format).
|
28
|
+
|
29
|
+
--disable-external-sort Use this option to force use of an internal
|
30
|
+
sort algorithm. On UNIX-like systems, ctags
|
31
|
+
uses the sort utility of the operating system
|
32
|
+
by default because it is more memory efficient.
|
33
|
+
|
34
|
+
--enable-custom-config=FILE Defines a custom option configuration file to
|
35
|
+
establish site-wide defaults. Ctags will read
|
36
|
+
the following files at startup for options:
|
37
|
+
/etc/ctags.conf, /usr/local/etc/ctags.conf,
|
38
|
+
$HOME/.ctags, and .ctags. If you need a
|
39
|
+
different file, set this option to the full
|
40
|
+
path name of the file you want to be read, and
|
41
|
+
it will be read immediately before reading
|
42
|
+
$HOME/.ctags.
|
43
|
+
|
44
|
+
--enable-macro-patterns By default, line numbers are used in the tag
|
45
|
+
file for #define objects, in order to remain
|
46
|
+
compatible with the original UNIX ctags. This
|
47
|
+
option will make the default use patterns.
|
48
|
+
|
49
|
+
--enable-maintainer-mode Creates a special GNU-specific version of the
|
50
|
+
makefile which is used to maintain Exuberant
|
51
|
+
Ctags.
|
52
|
+
|
53
|
+
--enable-tmpdir=DIR When the library function mkstemp() is
|
54
|
+
available, this option allows specifying the
|
55
|
+
default directory to use for temporary files
|
56
|
+
generated by ctags. This default can be
|
57
|
+
changed at run time by setting the environment
|
58
|
+
variable TMPDIR.
|
59
|
+
|
60
|
+
If you wish to change the name of the installed files, edit the makefile
|
61
|
+
produced by the configure script ("Makefile") before performing the "make
|
62
|
+
install" step. There are two lines at the top of the file where the names of
|
63
|
+
the installed files may be customized.
|
64
|
+
|
65
|
+
|
66
|
+
Basic Installation
|
67
|
+
==================
|
68
|
+
|
69
|
+
These are generic installation instructions.
|
70
|
+
|
71
|
+
The `configure' shell script attempts to guess correct values for
|
72
|
+
various system-dependent variables used during compilation. It uses
|
73
|
+
those values to create a `Makefile' in each directory of the package.
|
74
|
+
It may also create one or more `.h' files containing system-dependent
|
75
|
+
definitions. Finally, it creates a shell script `config.status' that
|
76
|
+
you can run in the future to recreate the current configuration, a file
|
77
|
+
`config.cache' that saves the results of its tests to speed up
|
78
|
+
reconfiguring, and a file `config.log' containing compiler output
|
79
|
+
(useful mainly for debugging `configure').
|
80
|
+
|
81
|
+
If you need to do unusual things to compile the package, please try
|
82
|
+
to figure out how `configure' could check whether to do them, and mail
|
83
|
+
diffs or instructions to the address given in the `README' so they can
|
84
|
+
be considered for the next release. If at some point `config.cache'
|
85
|
+
contains results you don't want to keep, you may remove or edit it.
|
86
|
+
|
87
|
+
The file `configure.in' is used to create `configure' by a program
|
88
|
+
called `autoconf'. You only need `configure.in' if you want to change
|
89
|
+
it or regenerate `configure' using a newer version of `autoconf'.
|
90
|
+
|
91
|
+
The simplest way to compile this package is:
|
92
|
+
|
93
|
+
1. `cd' to the directory containing the package's source code and type
|
94
|
+
`./configure' to configure the package for your system. If you're
|
95
|
+
using `csh' on an old version of System V, you might need to type
|
96
|
+
`sh ./configure' instead to prevent `csh' from trying to execute
|
97
|
+
`configure' itself.
|
98
|
+
|
99
|
+
Running `configure' takes awhile. While running, it prints some
|
100
|
+
messages telling which features it is checking for.
|
101
|
+
|
102
|
+
2. Type `make' to compile the package.
|
103
|
+
|
104
|
+
3. Optionally, type `make check' to run any self-tests that come with
|
105
|
+
the package.
|
106
|
+
|
107
|
+
4. Type `make install' to install the programs and any data files and
|
108
|
+
documentation.
|
109
|
+
|
110
|
+
5. You can remove the program binaries and object files from the
|
111
|
+
source code directory by typing `make clean'. To also remove the
|
112
|
+
files that `configure' created (so you can compile the package for
|
113
|
+
a different kind of computer), type `make distclean'.
|
114
|
+
|
115
|
+
Compilers and Options
|
116
|
+
=====================
|
117
|
+
|
118
|
+
Some systems require unusual options for compilation or linking that
|
119
|
+
the `configure' script does not know about. You can give `configure'
|
120
|
+
initial values for variables by setting them in the environment. Using
|
121
|
+
a Bourne-compatible shell, you can do that on the command line like
|
122
|
+
this:
|
123
|
+
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
124
|
+
|
125
|
+
Or on systems that have the `env' program, you can do it like this:
|
126
|
+
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
127
|
+
|
128
|
+
Compiling For Multiple Architectures
|
129
|
+
====================================
|
130
|
+
|
131
|
+
You can compile the package for more than one kind of computer at the
|
132
|
+
same time, by placing the object files for each architecture in their
|
133
|
+
own directory. To do this, you must use a version of `make' that
|
134
|
+
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
135
|
+
directory where you want the object files and executables to go and run
|
136
|
+
the `configure' script. `configure' automatically checks for the
|
137
|
+
source code in the directory that `configure' is in and in `..'.
|
138
|
+
|
139
|
+
If you have to use a `make' that does not supports the `VPATH'
|
140
|
+
variable, you have to compile the package for one architecture at a time
|
141
|
+
in the source code directory. After you have installed the package for
|
142
|
+
one architecture, use `make distclean' before reconfiguring for another
|
143
|
+
architecture.
|
144
|
+
|
145
|
+
Installation Names
|
146
|
+
==================
|
147
|
+
|
148
|
+
By default, `make install' will install the package's files in
|
149
|
+
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
150
|
+
installation prefix other than `/usr/local' by giving `configure' the
|
151
|
+
option `--prefix=PATH'.
|
152
|
+
|
153
|
+
You can specify separate installation prefixes for
|
154
|
+
architecture-specific files and architecture-independent files. If you
|
155
|
+
give `configure' the option `--exec-prefix=PATH', the package will use
|
156
|
+
PATH as the prefix for installing programs and libraries.
|
157
|
+
Documentation and other data files will still use the regular prefix.
|
158
|
+
|
159
|
+
In addition, if you use an unusual directory layout you can give
|
160
|
+
options like `--bindir=PATH' to specify different values for particular
|
161
|
+
kinds of files. Run `configure --help' for a list of the directories
|
162
|
+
you can set and what kinds of files go in them.
|
163
|
+
|
164
|
+
Optional Features
|
165
|
+
=================
|
166
|
+
|
167
|
+
Some packages pay attention to `--enable-FEATURE' options to
|
168
|
+
`configure', where FEATURE indicates an optional part of the package.
|
169
|
+
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
170
|
+
is something like `gnu-as' or `x' (for the X Window System). The
|
171
|
+
`README' should mention any `--enable-' and `--with-' options that the
|
172
|
+
package recognizes.
|
173
|
+
|
174
|
+
Sharing Defaults
|
175
|
+
================
|
176
|
+
|
177
|
+
If you want to set default values for `configure' scripts to share,
|
178
|
+
you can create a site shell script called `config.site' that gives
|
179
|
+
default values for variables like `CC', `cache_file', and `prefix'.
|
180
|
+
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
181
|
+
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
182
|
+
`CONFIG_SITE' environment variable to the location of the site script.
|
183
|
+
A warning: not all `configure' scripts look for a site script.
|
184
|
+
|
185
|
+
Operation Controls
|
186
|
+
==================
|
187
|
+
|
188
|
+
`configure' recognizes the following options to control how it
|
189
|
+
operates.
|
190
|
+
|
191
|
+
`--cache-file=FILE'
|
192
|
+
Use and save the results of the tests in FILE instead of
|
193
|
+
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
194
|
+
debugging `configure'.
|
195
|
+
|
196
|
+
`--help'
|
197
|
+
Print a summary of the options to `configure', and exit.
|
198
|
+
|
199
|
+
`--quiet'
|
200
|
+
`--silent'
|
201
|
+
`-q'
|
202
|
+
Do not print messages saying which checks are being made. To
|
203
|
+
suppress all normal output, redirect it to `/dev/null' (any error
|
204
|
+
messages will still be shown).
|
205
|
+
|
206
|
+
`--srcdir=DIR'
|
207
|
+
Look for the package's source code in directory DIR. Usually
|
208
|
+
`configure' can determine that directory automatically.
|
209
|
+
|
210
|
+
`--version'
|
211
|
+
Print the version of Autoconf used to generate the `configure'
|
212
|
+
script, and exit.
|
213
|
+
|
214
|
+
`configure' also accepts some other, not widely useful, options.
|
215
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
If you are attempting to install Exuberant Ctags on a Unix-like platform
|
2
|
+
(one that can at least run a Bourne shell script) see the file INSTALL.
|
3
|
+
|
4
|
+
Installation Notes
|
5
|
+
==================
|
6
|
+
|
7
|
+
For non-Unix platforms, simple makefiles are provided:
|
8
|
+
|
9
|
+
descrip.mms For VMS using either DEC C or VAX C
|
10
|
+
mk_bc3.mak For MSDOS using Borland C/C++ 3.x
|
11
|
+
mk_bc5.mak For Win32 using Borland C++ 5.5
|
12
|
+
mk_djg.mak For MSDOS using DJGPP Gnu GCC (better to follow Unix install)
|
13
|
+
mk_manx.mak For Amiga using Aztec/Manx C 5.0
|
14
|
+
mk_mingw.mak For Win32 using MinGW
|
15
|
+
mk_mpw.mak For Macintosh using MPW
|
16
|
+
mk_mvc.mak For Win32 using Microsoft Visual C++
|
17
|
+
mk_os2.mak For OS/2 using GCC (EMX)
|
18
|
+
mk_qdos.mak For QDOS using C68
|
19
|
+
mk_riscos.mak For RISC OS using the GCC SDK <http://hard-mofo.dsvr.net>
|
20
|
+
mk_sas.mak For Amiga using SAS/C
|
21
|
+
|
22
|
+
|
23
|
+
Special Notes
|
24
|
+
=============
|
25
|
+
|
26
|
+
DJGPP:
|
27
|
+
------
|
28
|
+
|
29
|
+
It is better to follow the standard Unix install on DJGPP, but this requires
|
30
|
+
that you use BASH and requires a fairly complete installation of GJGPP
|
31
|
+
packages. You can use mk_djg.mak if you can't run configure.
|
32
|
+
|
33
|
+
Macintosh with MPW:
|
34
|
+
-------------------
|
35
|
+
|
36
|
+
To build Ctags on MPW you will have to have the Metrowerks compilers
|
37
|
+
or you will have to edit the makefiles yourself.
|
38
|
+
|
39
|
+
Since the makefile for MPW is called mk_mpw.mak you will have to give
|
40
|
+
the command: `Make -f mk_mpw.mak CTags` and then select the output
|
41
|
+
and execute it. Alternatively you could rename this makefile to
|
42
|
+
CTags.make and issue the command `Build CTags`.
|
43
|
+
|
44
|
+
If the build process goes wrong make sure the line endings for the
|
45
|
+
makefile are set to MacOS (CR instead of LF).
|
46
|
+
|
47
|
+
This version of Ctags only accepts and emits unix style paths. This was
|
48
|
+
done since it was easier to implement (few changes in main source files)
|
49
|
+
and since I ported Ctags to MPW to use with Pepper which also works with
|
50
|
+
unix style paths internally. Besides, since we're now moving to MacOS X
|
51
|
+
anyway, Mac programmers are getting used to unix style paths anyway.
|
52
|
+
|
53
|
+
Example, suppose you have a project using PowerPlant which is located in
|
54
|
+
'HD20:tools:PowerPlant:' and you want a tags file for all powerplant
|
55
|
+
sources and your projects sources. Go to the root directory of your
|
56
|
+
project and type:
|
57
|
+
|
58
|
+
CTags -R . '/HD20/tools/PowerPlant/'
|
59
|
+
|
60
|
+
The '.' in this command means current directory. You will also have to
|
61
|
+
put quotes around the full unix style path since / has a special meaning
|
62
|
+
in MPW.
|
63
|
+
|
64
|
+
RISC OS:
|
65
|
+
--------
|
66
|
+
|
67
|
+
Regex support on RISC OS is available when compiled to use the RISC OS port
|
68
|
+
of the GNU regex library, which can be obtained from:
|
69
|
+
|
70
|
+
<http://www.sbellon.de/software.html>
|
71
|
+
|
72
|
+
Using 'Set RexEx$Path <Obey$Dir>.' in the regex-0/12 directory will ensure
|
73
|
+
it can be found.
|