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,281 @@
|
|
1
|
+
/*
|
2
|
+
* $Id: strlist.c 443 2006-05-30 04:37:13Z darren $
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2002, Darren Hiebert
|
5
|
+
*
|
6
|
+
* This source code is released for free distribution under the terms of the
|
7
|
+
* GNU General Public License.
|
8
|
+
*
|
9
|
+
* This module contains functions managing resizable string lists.
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*
|
13
|
+
* INCLUDE FILES
|
14
|
+
*/
|
15
|
+
#include "general.h" /* must always come first */
|
16
|
+
|
17
|
+
#include <string.h>
|
18
|
+
#ifdef HAVE_FNMATCH_H
|
19
|
+
# include <fnmatch.h>
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#include "debug.h"
|
23
|
+
#include "read.h"
|
24
|
+
#include "routines.h"
|
25
|
+
#include "strlist.h"
|
26
|
+
|
27
|
+
/*
|
28
|
+
* FUNCTION DEFINITIONS
|
29
|
+
*/
|
30
|
+
|
31
|
+
extern stringList *stringListNew (void)
|
32
|
+
{
|
33
|
+
stringList* const result = xMalloc (1, stringList);
|
34
|
+
result->max = 0;
|
35
|
+
result->count = 0;
|
36
|
+
result->list = NULL;
|
37
|
+
return result;
|
38
|
+
}
|
39
|
+
|
40
|
+
extern void stringListAdd (stringList *const current, vString *string)
|
41
|
+
{
|
42
|
+
enum { incrementalIncrease = 10 };
|
43
|
+
Assert (current != NULL);
|
44
|
+
if (current->list == NULL)
|
45
|
+
{
|
46
|
+
Assert (current->max == 0);
|
47
|
+
current->count = 0;
|
48
|
+
current->max = incrementalIncrease;
|
49
|
+
current->list = xMalloc (current->max, vString*);
|
50
|
+
}
|
51
|
+
else if (current->count == current->max)
|
52
|
+
{
|
53
|
+
current->max += incrementalIncrease;
|
54
|
+
current->list = xRealloc (current->list, current->max, vString*);
|
55
|
+
}
|
56
|
+
current->list [current->count++] = string;
|
57
|
+
}
|
58
|
+
|
59
|
+
extern void stringListRemoveLast (stringList *const current)
|
60
|
+
{
|
61
|
+
Assert (current != NULL);
|
62
|
+
Assert (current->count > 0);
|
63
|
+
--current->count;
|
64
|
+
current->list [current->count] = NULL;
|
65
|
+
}
|
66
|
+
|
67
|
+
/* Combine list `from' into `current', deleting `from' */
|
68
|
+
extern void stringListCombine (
|
69
|
+
stringList *const current, stringList *const from)
|
70
|
+
{
|
71
|
+
unsigned int i;
|
72
|
+
Assert (current != NULL);
|
73
|
+
Assert (from != NULL);
|
74
|
+
for (i = 0 ; i < from->count ; ++i)
|
75
|
+
{
|
76
|
+
stringListAdd (current, from->list [i]);
|
77
|
+
from->list [i] = NULL;
|
78
|
+
}
|
79
|
+
stringListDelete (from);
|
80
|
+
}
|
81
|
+
|
82
|
+
extern stringList* stringListNewFromArgv (const char* const* const argv)
|
83
|
+
{
|
84
|
+
stringList* const result = stringListNew ();
|
85
|
+
const char *const *p;
|
86
|
+
Assert (argv != NULL);
|
87
|
+
for (p = argv ; *p != NULL ; ++p)
|
88
|
+
stringListAdd (result, vStringNewInit (*p));
|
89
|
+
return result;
|
90
|
+
}
|
91
|
+
|
92
|
+
extern stringList* stringListNewFromFile (const char* const fileName)
|
93
|
+
{
|
94
|
+
stringList* result = NULL;
|
95
|
+
FILE* const fp = fopen (fileName, "r");
|
96
|
+
if (fp != NULL)
|
97
|
+
{
|
98
|
+
result = stringListNew ();
|
99
|
+
while (! feof (fp))
|
100
|
+
{
|
101
|
+
vString* const str = vStringNew ();
|
102
|
+
readLine (str, fp);
|
103
|
+
vStringStripTrailing (str);
|
104
|
+
if (vStringLength (str) > 0)
|
105
|
+
stringListAdd (result, str);
|
106
|
+
else
|
107
|
+
vStringDelete (str);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
return result;
|
111
|
+
}
|
112
|
+
|
113
|
+
extern unsigned int stringListCount (const stringList *const current)
|
114
|
+
{
|
115
|
+
Assert (current != NULL);
|
116
|
+
return current->count;
|
117
|
+
}
|
118
|
+
|
119
|
+
extern vString* stringListItem (
|
120
|
+
const stringList *const current, const unsigned int indx)
|
121
|
+
{
|
122
|
+
Assert (current != NULL);
|
123
|
+
return current->list [indx];
|
124
|
+
}
|
125
|
+
|
126
|
+
extern vString* stringListLast (const stringList *const current)
|
127
|
+
{
|
128
|
+
Assert (current != NULL);
|
129
|
+
Assert (current->count > 0);
|
130
|
+
return current->list [current->count - 1];
|
131
|
+
}
|
132
|
+
|
133
|
+
extern void stringListClear (stringList *const current)
|
134
|
+
{
|
135
|
+
unsigned int i;
|
136
|
+
Assert (current != NULL);
|
137
|
+
for (i = 0 ; i < current->count ; ++i)
|
138
|
+
{
|
139
|
+
vStringDelete (current->list [i]);
|
140
|
+
current->list [i] = NULL;
|
141
|
+
}
|
142
|
+
current->count = 0;
|
143
|
+
}
|
144
|
+
|
145
|
+
extern void stringListDelete (stringList *const current)
|
146
|
+
{
|
147
|
+
if (current != NULL)
|
148
|
+
{
|
149
|
+
if (current->list != NULL)
|
150
|
+
{
|
151
|
+
stringListClear (current);
|
152
|
+
eFree (current->list);
|
153
|
+
current->list = NULL;
|
154
|
+
}
|
155
|
+
current->max = 0;
|
156
|
+
current->count = 0;
|
157
|
+
eFree (current);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
static boolean compareString (
|
162
|
+
const char *const string, vString *const itm)
|
163
|
+
{
|
164
|
+
return (boolean) (strcmp (string, vStringValue (itm)) == 0);
|
165
|
+
}
|
166
|
+
|
167
|
+
static boolean compareStringInsensitive (
|
168
|
+
const char *const string, vString *const itm)
|
169
|
+
{
|
170
|
+
return (boolean) (strcasecmp (string, vStringValue (itm)) == 0);
|
171
|
+
}
|
172
|
+
|
173
|
+
static int stringListIndex (
|
174
|
+
const stringList *const current,
|
175
|
+
const char *const string,
|
176
|
+
boolean (*test)(const char *s, vString *const vs))
|
177
|
+
{
|
178
|
+
int result = -1;
|
179
|
+
unsigned int i;
|
180
|
+
Assert (current != NULL);
|
181
|
+
Assert (string != NULL);
|
182
|
+
Assert (test != NULL);
|
183
|
+
for (i = 0 ; result == -1 && i < current->count ; ++i)
|
184
|
+
if ((*test)(string, current->list [i]))
|
185
|
+
result = i;
|
186
|
+
return result;
|
187
|
+
}
|
188
|
+
|
189
|
+
extern boolean stringListHas (
|
190
|
+
const stringList *const current, const char *const string)
|
191
|
+
{
|
192
|
+
boolean result = FALSE;
|
193
|
+
Assert (current != NULL);
|
194
|
+
result = stringListIndex (current, string, compareString) != -1;
|
195
|
+
return result;
|
196
|
+
}
|
197
|
+
|
198
|
+
extern boolean stringListHasInsensitive (
|
199
|
+
const stringList *const current, const char *const string)
|
200
|
+
{
|
201
|
+
boolean result = FALSE;
|
202
|
+
Assert (current != NULL);
|
203
|
+
Assert (string != NULL);
|
204
|
+
result = stringListIndex (current, string, compareStringInsensitive) != -1;
|
205
|
+
return result;
|
206
|
+
}
|
207
|
+
|
208
|
+
extern boolean stringListHasTest (
|
209
|
+
const stringList *const current, boolean (*test)(const char *s))
|
210
|
+
{
|
211
|
+
boolean result = FALSE;
|
212
|
+
unsigned int i;
|
213
|
+
Assert (current != NULL);
|
214
|
+
for (i = 0 ; ! result && i < current->count ; ++i)
|
215
|
+
result = (*test)(vStringValue (current->list [i]));
|
216
|
+
return result;
|
217
|
+
}
|
218
|
+
|
219
|
+
extern boolean stringListRemoveExtension (
|
220
|
+
stringList* const current, const char* const extension)
|
221
|
+
{
|
222
|
+
boolean result = FALSE;
|
223
|
+
int where;
|
224
|
+
#ifdef CASE_INSENSITIVE_FILENAMES
|
225
|
+
where = stringListIndex (current, extension, compareStringInsensitive);
|
226
|
+
#else
|
227
|
+
where = stringListIndex (current, extension, compareString);
|
228
|
+
#endif
|
229
|
+
if (where != -1)
|
230
|
+
{
|
231
|
+
memmove (current->list + where, current->list + where + 1,
|
232
|
+
(current->count - where) * sizeof (*current->list));
|
233
|
+
current->list [current->count - 1] = NULL;
|
234
|
+
--current->count;
|
235
|
+
result = TRUE;
|
236
|
+
}
|
237
|
+
return result;
|
238
|
+
}
|
239
|
+
|
240
|
+
extern boolean stringListExtensionMatched (
|
241
|
+
const stringList* const current, const char* const extension)
|
242
|
+
{
|
243
|
+
#ifdef CASE_INSENSITIVE_FILENAMES
|
244
|
+
return stringListHasInsensitive (current, extension);
|
245
|
+
#else
|
246
|
+
return stringListHas (current, extension);
|
247
|
+
#endif
|
248
|
+
}
|
249
|
+
|
250
|
+
static boolean fileNameMatched (
|
251
|
+
const vString* const vpattern, const char* const fileName)
|
252
|
+
{
|
253
|
+
const char* const pattern = vStringValue (vpattern);
|
254
|
+
#if defined (HAVE_FNMATCH)
|
255
|
+
return (boolean) (fnmatch (pattern, fileName, 0) == 0);
|
256
|
+
#elif defined (CASE_INSENSITIVE_FILENAMES)
|
257
|
+
return (boolean) (strcasecmp (pattern, fileName) == 0);
|
258
|
+
#else
|
259
|
+
return (boolean) (strcmp (pattern, fileName) == 0);
|
260
|
+
#endif
|
261
|
+
}
|
262
|
+
|
263
|
+
extern boolean stringListFileMatched (
|
264
|
+
const stringList* const current, const char* const fileName)
|
265
|
+
{
|
266
|
+
boolean result = FALSE;
|
267
|
+
unsigned int i;
|
268
|
+
for (i = 0 ; ! result && i < stringListCount (current) ; ++i)
|
269
|
+
result = fileNameMatched (stringListItem (current, i), fileName);
|
270
|
+
return result;
|
271
|
+
}
|
272
|
+
|
273
|
+
extern void stringListPrint (const stringList *const current)
|
274
|
+
{
|
275
|
+
unsigned int i;
|
276
|
+
Assert (current != NULL);
|
277
|
+
for (i = 0 ; i < current->count ; ++i)
|
278
|
+
printf ("%s%s", (i > 0) ? ", " : "", vStringValue (current->list [i]));
|
279
|
+
}
|
280
|
+
|
281
|
+
/* vi:set tabstop=4 shiftwidth=4: */
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/*
|
2
|
+
* $Id: strlist.h 443 2006-05-30 04:37:13Z darren $
|
3
|
+
*
|
4
|
+
* Copyright (c) 1999-2002, Darren Hiebert
|
5
|
+
*
|
6
|
+
* This source code is released for free distribution under the terms of the
|
7
|
+
* GNU General Public License.
|
8
|
+
*
|
9
|
+
* Defines external interface to resizable string lists.
|
10
|
+
*/
|
11
|
+
#ifndef _STRLIST_H
|
12
|
+
#define _STRLIST_H
|
13
|
+
|
14
|
+
/*
|
15
|
+
* INCLUDE FILES
|
16
|
+
*/
|
17
|
+
#include "general.h" /* must always come first */
|
18
|
+
|
19
|
+
#include "vstring.h"
|
20
|
+
|
21
|
+
/*
|
22
|
+
* DATA DECLARATIONS
|
23
|
+
*/
|
24
|
+
typedef struct sStringList {
|
25
|
+
unsigned int max;
|
26
|
+
unsigned int count;
|
27
|
+
vString **list;
|
28
|
+
} stringList;
|
29
|
+
|
30
|
+
/*
|
31
|
+
* FUNCTION PROTOTYPES
|
32
|
+
*/
|
33
|
+
extern stringList *stringListNew (void);
|
34
|
+
extern void stringListAdd (stringList *const current, vString *string);
|
35
|
+
extern void stringListRemoveLast (stringList *const current);
|
36
|
+
extern void stringListCombine (stringList *const current, stringList *const from);
|
37
|
+
extern stringList* stringListNewFromArgv (const char* const* const list);
|
38
|
+
extern stringList* stringListNewFromFile (const char* const fileName);
|
39
|
+
extern void stringListClear (stringList *const current);
|
40
|
+
extern unsigned int stringListCount (const stringList *const current);
|
41
|
+
extern vString* stringListItem (const stringList *const current, const unsigned int indx);
|
42
|
+
extern vString* stringListLast (const stringList *const current);
|
43
|
+
extern void stringListDelete (stringList *const current);
|
44
|
+
extern boolean stringListHasInsensitive (const stringList *const current, const char *const string);
|
45
|
+
extern boolean stringListHas (const stringList *const current, const char *const string);
|
46
|
+
extern boolean stringListHasTest (const stringList *const current, boolean (*test)(const char *s));
|
47
|
+
extern boolean stringListRemoveExtension (stringList* const current, const char* const extension);
|
48
|
+
extern boolean stringListExtensionMatched (const stringList* const list, const char* const extension);
|
49
|
+
extern boolean stringListFileMatched (const stringList* const list, const char* const str);
|
50
|
+
extern void stringListPrint (const stringList *const current);
|
51
|
+
|
52
|
+
#endif /* _STRLIST_H */
|
53
|
+
|
54
|
+
/* vi:set tabstop=4 shiftwidth=4: */
|
@@ -0,0 +1,116 @@
|
|
1
|
+
/*
|
2
|
+
* $Id: tcl.c 443 2006-05-30 04:37:13Z darren $
|
3
|
+
*
|
4
|
+
* Copyright (c) 2000-2003, Darren Hiebert
|
5
|
+
*
|
6
|
+
* This source code is released for free distribution under the terms of the
|
7
|
+
* GNU General Public License.
|
8
|
+
*
|
9
|
+
* This module contains functions for generating tags for TCL scripts.
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*
|
13
|
+
* INCLUDE FILES
|
14
|
+
*/
|
15
|
+
#include "general.h" /* must always come first */
|
16
|
+
|
17
|
+
#include <string.h>
|
18
|
+
|
19
|
+
#include "parse.h"
|
20
|
+
#include "read.h"
|
21
|
+
#include "vstring.h"
|
22
|
+
|
23
|
+
/*
|
24
|
+
* DATA DEFINITIONS
|
25
|
+
*/
|
26
|
+
typedef enum {
|
27
|
+
K_CLASS, K_METHOD, K_PROCEDURE
|
28
|
+
} tclKind;
|
29
|
+
|
30
|
+
static kindOption TclKinds [] = {
|
31
|
+
{ TRUE, 'c', "class", "classes" },
|
32
|
+
{ TRUE, 'm', "method", "methods" },
|
33
|
+
{ TRUE, 'p', "procedure", "procedures" }
|
34
|
+
};
|
35
|
+
|
36
|
+
/*
|
37
|
+
* FUNCTION DEFINITIONS
|
38
|
+
*/
|
39
|
+
|
40
|
+
static const unsigned char *makeTclTag (
|
41
|
+
const unsigned char *cp,
|
42
|
+
vString *const name,
|
43
|
+
const tclKind kind)
|
44
|
+
{
|
45
|
+
vStringClear (name);
|
46
|
+
while ((int) *cp != '\0' && ! isspace ((int) *cp))
|
47
|
+
{
|
48
|
+
vStringPut (name, (int) *cp);
|
49
|
+
++cp;
|
50
|
+
}
|
51
|
+
vStringTerminate (name);
|
52
|
+
makeSimpleTag (name, TclKinds, kind);
|
53
|
+
return cp;
|
54
|
+
}
|
55
|
+
|
56
|
+
static boolean match (const unsigned char *line, const char *word)
|
57
|
+
{
|
58
|
+
return (boolean) (strncmp ((const char*) line, word, strlen (word)) == 0);
|
59
|
+
}
|
60
|
+
|
61
|
+
static void findTclTags (void)
|
62
|
+
{
|
63
|
+
vString *name = vStringNew ();
|
64
|
+
const unsigned char *line;
|
65
|
+
|
66
|
+
while ((line = fileReadLine ()) != NULL)
|
67
|
+
{
|
68
|
+
const unsigned char *cp;
|
69
|
+
|
70
|
+
while (isspace (line [0]))
|
71
|
+
++line;
|
72
|
+
|
73
|
+
if (line [0] == '\0' || line [0] == '#')
|
74
|
+
continue;
|
75
|
+
|
76
|
+
/* read first word */
|
77
|
+
for (cp = line ; *cp != '\0' && ! isspace ((int) *cp) ; ++cp)
|
78
|
+
;
|
79
|
+
if (! isspace ((int) *cp))
|
80
|
+
continue;
|
81
|
+
while (isspace ((int) *cp))
|
82
|
+
++cp;
|
83
|
+
/* Now `line' points at first word and `cp' points at next word */
|
84
|
+
|
85
|
+
if (match (line, "proc"))
|
86
|
+
cp = makeTclTag (cp, name, K_PROCEDURE);
|
87
|
+
else if (match (line, "class") || match (line, "itcl::class"))
|
88
|
+
cp = makeTclTag (cp, name, K_CLASS);
|
89
|
+
else if (match (line, "public") ||
|
90
|
+
match (line, "protected") ||
|
91
|
+
match (line, "private"))
|
92
|
+
{
|
93
|
+
if (match (cp, "method"))
|
94
|
+
{
|
95
|
+
cp += 6;
|
96
|
+
while (isspace ((int) *cp))
|
97
|
+
++cp;
|
98
|
+
cp = makeTclTag (cp, name, K_METHOD);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
vStringDelete (name);
|
103
|
+
}
|
104
|
+
|
105
|
+
extern parserDefinition* TclParser (void)
|
106
|
+
{
|
107
|
+
static const char *const extensions [] = { "tcl", "tk", "wish", "itcl", NULL };
|
108
|
+
parserDefinition* def = parserNew ("Tcl");
|
109
|
+
def->kinds = TclKinds;
|
110
|
+
def->kindCount = KIND_COUNT (TclKinds);
|
111
|
+
def->extensions = extensions;
|
112
|
+
def->parser = findTclTags;
|
113
|
+
return def;
|
114
|
+
}
|
115
|
+
|
116
|
+
/* vi:set tabstop=4 shiftwidth=4: */
|