1 |
/* Tags file maker to go with GNU Emacs -*- coding: latin-1 -*- |
/* Tags file maker to go with GNU Emacs -*- coding: latin-1 -*- |
2 |
Copyright (C) 1984, 87, 88, 89, 93, 94, 95, 98, 99, 2000, 2001 |
Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2001 |
3 |
Free Software Foundation, Inc. and Ken Arnold |
Free Software Foundation, Inc. and Ken Arnold |
4 |
|
|
5 |
This file is not considered part of GNU Emacs. |
This file is not considered part of GNU Emacs. |
25 |
* Ed Pelegri-Llopart added C typedefs. |
* Ed Pelegri-Llopart added C typedefs. |
26 |
* Gnu Emacs TAGS format and modifications by RMS? |
* Gnu Emacs TAGS format and modifications by RMS? |
27 |
* 1989 Sam Kendall added C++. |
* 1989 Sam Kendall added C++. |
28 |
* 1993 Francesco Potort́ reorganised C and C++ based on work by Joe Wells. |
* 1992 Joseph B. Wells improved C and C++ parsing. |
29 |
|
* 1993 Francesco Potort́ reorganised C and C++. |
30 |
* 1994 Regexp tags by Tom Tromey. |
* 1994 Regexp tags by Tom Tromey. |
31 |
* 2001 Nested classes by Francesco Potort́ based on work by Mykola Dzyuba. |
* 2001 Nested classes by Francesco Potort́ (ideas by Mykola Dzyuba). |
32 |
* |
* |
33 |
* Francesco Potort́ <pot@gnu.org> has maintained it since 1993. |
* Francesco Potort́ <pot@gnu.org> has maintained it since 1993. |
34 |
*/ |
*/ |
35 |
|
|
36 |
char pot_etags_version[] = "@(#) pot revision number is 14.26"; |
char pot_etags_version[] = "@(#) pot revision number is 14.35"; |
37 |
|
|
38 |
#define TRUE 1 |
#define TRUE 1 |
39 |
#define FALSE 0 |
#define FALSE 0 |
46 |
# define NDEBUG /* disable assert */ |
# define NDEBUG /* disable assert */ |
47 |
#endif |
#endif |
48 |
|
|
|
#if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) |
|
|
# define P_(proto) proto |
|
|
#else |
|
|
# define P_(proto) () |
|
|
#endif |
|
|
|
|
49 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
50 |
# include <config.h> |
# include <config.h> |
51 |
/* On some systems, Emacs defines static as nothing for the sake |
/* On some systems, Emacs defines static as nothing for the sake |
53 |
# undef static |
# undef static |
54 |
# define ETAGS_REGEXPS /* use the regexp features */ |
# define ETAGS_REGEXPS /* use the regexp features */ |
55 |
# define LONG_OPTIONS /* accept long options */ |
# define LONG_OPTIONS /* accept long options */ |
56 |
|
# ifndef PTR /* for Xemacs */ |
57 |
|
# define PTR void * |
58 |
|
# endif |
59 |
|
# ifndef __P /* for Xemacs */ |
60 |
|
# define __P(args) args |
61 |
|
# endif |
62 |
#else |
#else |
63 |
# ifndef __STDC__ |
# if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) |
64 |
# define static /* remove static for old compilers' sake */ |
# define __P(args) args /* use prototypes */ |
65 |
# define const /* same for const */ |
# define PTR void * /* for generic pointers */ |
66 |
|
# else |
67 |
|
# define __P(args) () /* no prototypes */ |
68 |
|
# define const /* remove const for old compilers' sake */ |
69 |
|
# define PTR long * /* don't use void* */ |
70 |
# endif |
# endif |
71 |
#endif /* !HAVE_CONFIG_H */ |
#endif /* !HAVE_CONFIG_H */ |
72 |
|
|
222 |
(char *) (op), (n) * sizeof (Type))) |
(char *) (op), (n) * sizeof (Type))) |
223 |
#endif |
#endif |
224 |
|
|
225 |
typedef int bool; |
#define bool int |
226 |
|
|
227 |
typedef void Lang_function P_((FILE *)); |
typedef void Lang_function __P((FILE *)); |
228 |
|
|
229 |
typedef struct |
typedef struct |
230 |
{ |
{ |
270 |
/* Many compilers barf on this: |
/* Many compilers barf on this: |
271 |
Lang_function Ada_funcs; |
Lang_function Ada_funcs; |
272 |
so let's write it this way */ |
so let's write it this way */ |
273 |
static void Ada_funcs P_((FILE *)); |
static void Ada_funcs __P((FILE *)); |
274 |
static void Asm_labels P_((FILE *)); |
static void Asm_labels __P((FILE *)); |
275 |
static void C_entries P_((int c_ext, FILE *)); |
static void C_entries __P((int c_ext, FILE *)); |
276 |
static void default_C_entries P_((FILE *)); |
static void default_C_entries __P((FILE *)); |
277 |
static void plain_C_entries P_((FILE *)); |
static void plain_C_entries __P((FILE *)); |
278 |
static void Cjava_entries P_((FILE *)); |
static void Cjava_entries __P((FILE *)); |
279 |
static void Cobol_paragraphs P_((FILE *)); |
static void Cobol_paragraphs __P((FILE *)); |
280 |
static void Cplusplus_entries P_((FILE *)); |
static void Cplusplus_entries __P((FILE *)); |
281 |
static void Cstar_entries P_((FILE *)); |
static void Cstar_entries __P((FILE *)); |
282 |
static void Erlang_functions P_((FILE *)); |
static void Erlang_functions __P((FILE *)); |
283 |
static void Fortran_functions P_((FILE *)); |
static void Fortran_functions __P((FILE *)); |
284 |
static void Yacc_entries P_((FILE *)); |
static void Yacc_entries __P((FILE *)); |
285 |
static void Lisp_functions P_((FILE *)); |
static void Lisp_functions __P((FILE *)); |
286 |
static void Makefile_targets P_((FILE *)); |
static void Makefile_targets __P((FILE *)); |
287 |
static void Pascal_functions P_((FILE *)); |
static void Pascal_functions __P((FILE *)); |
288 |
static void Perl_functions P_((FILE *)); |
static void Perl_functions __P((FILE *)); |
289 |
static void PHP_functions P_((FILE *)); |
static void PHP_functions __P((FILE *)); |
290 |
static void Postscript_functions P_((FILE *)); |
static void Postscript_functions __P((FILE *)); |
291 |
static void Prolog_functions P_((FILE *)); |
static void Prolog_functions __P((FILE *)); |
292 |
static void Python_functions P_((FILE *)); |
static void Python_functions __P((FILE *)); |
293 |
static void Scheme_functions P_((FILE *)); |
static void Scheme_functions __P((FILE *)); |
294 |
static void TeX_commands P_((FILE *)); |
static void TeX_commands __P((FILE *)); |
295 |
static void Texinfo_nodes P_((FILE *)); |
static void Texinfo_nodes __P((FILE *)); |
296 |
static void just_read_file P_((FILE *)); |
static void just_read_file __P((FILE *)); |
297 |
|
|
298 |
static void print_language_names P_((void)); |
static void print_language_names __P((void)); |
299 |
static void print_version P_((void)); |
static void print_version __P((void)); |
300 |
static void print_help P_((void)); |
static void print_help __P((void)); |
301 |
int main P_((int, char **)); |
int main __P((int, char **)); |
302 |
static int number_len P_((long)); |
static int number_len __P((long)); |
303 |
|
|
304 |
static compressor *get_compressor_from_suffix P_((char *, char **)); |
static compressor *get_compressor_from_suffix __P((char *, char **)); |
305 |
static language *get_language_from_langname P_((char *)); |
static language *get_language_from_langname __P((const char *)); |
306 |
static language *get_language_from_interpreter P_((char *)); |
static language *get_language_from_interpreter __P((char *)); |
307 |
static language *get_language_from_filename P_((char *)); |
static language *get_language_from_filename __P((char *)); |
308 |
static int total_size_of_entries P_((node *)); |
static int total_size_of_entries __P((node *)); |
309 |
static long readline P_((linebuffer *, FILE *)); |
static long readline __P((linebuffer *, FILE *)); |
310 |
static long readline_internal P_((linebuffer *, FILE *)); |
static long readline_internal __P((linebuffer *, FILE *)); |
311 |
static void get_tag P_((char *)); |
static bool nocase_tail __P((char *)); |
312 |
|
static char *get_tag __P((char *)); |
313 |
|
|
314 |
#ifdef ETAGS_REGEXPS |
#ifdef ETAGS_REGEXPS |
315 |
static void analyse_regex P_((char *, bool)); |
static void analyse_regex __P((char *, bool)); |
316 |
static void add_regex P_((char *, bool, language *)); |
static void add_regex __P((char *, bool, language *)); |
317 |
static void free_patterns P_((void)); |
static void free_patterns __P((void)); |
318 |
#endif /* ETAGS_REGEXPS */ |
#endif /* ETAGS_REGEXPS */ |
319 |
static void error P_((const char *, const char *)); |
static void error __P((const char *, const char *)); |
320 |
static void suggest_asking_for_help P_((void)); |
static void suggest_asking_for_help __P((void)); |
321 |
void fatal P_((char *, char *)); |
void fatal __P((char *, char *)); |
322 |
static void pfatal P_((char *)); |
static void pfatal __P((char *)); |
323 |
static void add_node P_((node *, node **)); |
static void add_node __P((node *, node **)); |
324 |
|
|
325 |
static void init P_((void)); |
static void init __P((void)); |
326 |
static void initbuffer P_((linebuffer *)); |
static void initbuffer __P((linebuffer *)); |
327 |
static void find_entries P_((char *, FILE *)); |
static void find_entries __P((char *, FILE *)); |
328 |
static void free_tree P_((node *)); |
static void free_tree __P((node *)); |
329 |
static void pfnote P_((char *, bool, char *, int, int, long)); |
static void pfnote __P((char *, bool, char *, int, int, long)); |
330 |
static void new_pfnote P_((char *, int, bool, char *, int, int, long)); |
static void new_pfnote __P((char *, int, bool, char *, int, int, long)); |
331 |
static void process_file P_((char *)); |
static void process_file __P((char *)); |
332 |
static void put_entries P_((node *)); |
static void put_entries __P((node *)); |
333 |
static void takeprec P_((void)); |
|
334 |
|
static char *concat __P((char *, char *, char *)); |
335 |
static char *concat P_((char *, char *, char *)); |
static char *skip_spaces __P((char *)); |
336 |
static char *skip_spaces P_((char *)); |
static char *skip_non_spaces __P((char *)); |
337 |
static char *skip_non_spaces P_((char *)); |
static char *savenstr __P((char *, int)); |
338 |
static char *savenstr P_((char *, int)); |
static char *savestr __P((char *)); |
339 |
static char *savestr P_((char *)); |
static char *etags_strchr __P((const char *, int)); |
340 |
static char *etags_strchr P_((const char *, int)); |
static char *etags_strrchr __P((const char *, int)); |
341 |
static char *etags_strrchr P_((const char *, int)); |
static char *etags_getcwd __P((void)); |
342 |
static char *etags_getcwd P_((void)); |
static char *relative_filename __P((char *, char *)); |
343 |
static char *relative_filename P_((char *, char *)); |
static char *absolute_filename __P((char *, char *)); |
344 |
static char *absolute_filename P_((char *, char *)); |
static char *absolute_dirname __P((char *, char *)); |
345 |
static char *absolute_dirname P_((char *, char *)); |
static bool filename_is_absolute __P((char *f)); |
346 |
static bool filename_is_absolute P_((char *f)); |
static void canonicalize_filename __P((char *)); |
347 |
static void canonicalize_filename P_((char *)); |
static void linebuffer_setlen __P((linebuffer *, int)); |
348 |
static void linebuffer_setlen P_((linebuffer *, int)); |
PTR xmalloc __P((unsigned int)); |
349 |
long *xmalloc P_((unsigned int)); |
PTR xrealloc __P((char *, unsigned int)); |
|
long *xrealloc P_((char *, unsigned int)); |
|
350 |
|
|
351 |
|
|
352 |
char searchar = '/'; /* use /.../ searches */ |
char searchar = '/'; /* use /.../ searches */ |
375 |
/* white chars */ |
/* white chars */ |
376 |
*white = " \f\t\n\r\v", |
*white = " \f\t\n\r\v", |
377 |
/* not in a name */ |
/* not in a name */ |
378 |
*nonam = " \f\t\n\r(=,[;", |
*nonam = " \f\t\n\r()=,;", |
379 |
/* token ending chars */ |
/* token ending chars */ |
380 |
*endtk = " \t\n\r\"'#()[]{}=-+%*/&|^~!<>;,.:?", |
*endtk = " \t\n\r\"'#()[]{}=-+%*/&|^~!<>;,.:?", |
381 |
/* token starting chars */ |
/* token starting chars */ |
445 |
typedef struct pattern |
typedef struct pattern |
446 |
{ |
{ |
447 |
struct pattern *p_next; |
struct pattern *p_next; |
448 |
language *language; |
language *lang; |
449 |
char *regex; |
char *regex; |
450 |
struct re_pattern_buffer *pattern; |
struct re_pattern_buffer *pat; |
451 |
struct re_registers regs; |
struct re_registers regs; |
452 |
char *name_pattern; |
char *name_pattern; |
453 |
bool error_signaled; |
bool error_signaled; |
1294 |
*/ |
*/ |
1295 |
static language * |
static language * |
1296 |
get_language_from_langname (name) |
get_language_from_langname (name) |
1297 |
char *name; |
const char *name; |
1298 |
{ |
{ |
1299 |
language *lang; |
language *lang; |
1300 |
|
|
1707 |
* also be one of the characters " \t(),;". |
* also be one of the characters " \t(),;". |
1708 |
* |
* |
1709 |
* The real implementation uses the notinname() macro, which recognises |
* The real implementation uses the notinname() macro, which recognises |
1710 |
* characters slightly different form " \t\r\n(),;". See the variable |
* characters slightly different from " \t\r\n(),;". See the variable |
1711 |
* `nonam'. |
* `nonam'. |
1712 |
*/ |
*/ |
1713 |
#define traditional_tag_style TRUE |
#define traditional_tag_style TRUE |
1970 |
st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec |
st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec |
1971 |
}; |
}; |
1972 |
|
|
1973 |
static unsigned int hash P_((const char *, unsigned int)); |
static unsigned int hash __P((const char *, unsigned int)); |
1974 |
static struct C_stab_entry * in_word_set P_((const char *, unsigned int)); |
static struct C_stab_entry * in_word_set __P((const char *, unsigned int)); |
1975 |
static enum sym_type C_symtype P_((char *, int, int)); |
static enum sym_type C_symtype __P((char *, int, int)); |
1976 |
|
|
1977 |
/* Feed stuff between (but not including) %[ and %] lines to: |
/* Feed stuff between (but not including) %[ and %] lines to: |
1978 |
gperf -c -k 1,3 -o -p -r -t |
gperf -c -k 1,3 -o -p -r -t |
2320 |
* Variables and functions for dealing with nested structures. |
* Variables and functions for dealing with nested structures. |
2321 |
* Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001) |
* Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001) |
2322 |
*/ |
*/ |
2323 |
static void pushclass_above P_((int, char *, int)); |
static void pushclass_above __P((int, char *, int)); |
2324 |
static void popclass_above P_((int)); |
static void popclass_above __P((int)); |
2325 |
static void write_classname P_((linebuffer *, char *qualifier)); |
static void write_classname __P((linebuffer *, char *qualifier)); |
2326 |
|
|
2327 |
struct { |
struct { |
2328 |
char **cname; /* nested class names */ |
char **cname; /* nested class names */ |
2411 |
} |
} |
2412 |
|
|
2413 |
|
|
2414 |
static bool consider_token P_((char *, int, int, int *, int, int, bool *)); |
static bool consider_token __P((char *, int, int, int *, int, int, bool *)); |
2415 |
static void make_C_tag P_((bool)); |
static void make_C_tag __P((bool)); |
2416 |
|
|
2417 |
/* |
/* |
2418 |
* consider_token () |
* consider_token () |
3612 |
TRUE); \ |
TRUE); \ |
3613 |
) |
) |
3614 |
#define LOOKING_AT(cp, keyword) /* keyword is a constant string */ \ |
#define LOOKING_AT(cp, keyword) /* keyword is a constant string */ \ |
3615 |
(strneq ((cp), keyword, sizeof(keyword)-1) /* cp points at kyword */ \ |
(strneq ((cp), keyword, sizeof(keyword)-1) /* cp points at keyword */ \ |
3616 |
&& iswhite((cp)[sizeof(keyword)-1]) /* followed by a blank */ \ |
&& notinname ((cp)[sizeof(keyword)-1]) /* end of keyword */ \ |
3617 |
&& ((cp) = skip_spaces((cp)+sizeof(keyword)-1))) /* skip blanks */ |
&& ((cp) = skip_spaces((cp)+sizeof(keyword)-1))) /* skip spaces */ |
3618 |
|
|
3619 |
/* |
/* |
3620 |
* Read a file, but do no processing. This is used to do regexp |
* Read a file, but do no processing. This is used to do regexp |
3633 |
|
|
3634 |
/* Fortran parsing */ |
/* Fortran parsing */ |
3635 |
|
|
3636 |
static bool tail P_((char *)); |
static void F_takeprec __P((void)); |
3637 |
static void takeprec P_((void)); |
static void F_getit __P((FILE *)); |
|
static void getit P_((FILE *)); |
|
|
|
|
|
static bool |
|
|
tail (cp) |
|
|
char *cp; |
|
|
{ |
|
|
register int len = 0; |
|
|
|
|
|
while (*cp != '\0' && lowcase (*cp) == lowcase (dbp[len])) |
|
|
cp++, len++; |
|
|
if (*cp == '\0' && !intoken (dbp[len])) |
|
|
{ |
|
|
dbp += len; |
|
|
return TRUE; |
|
|
} |
|
|
return FALSE; |
|
|
} |
|
3638 |
|
|
3639 |
static void |
static void |
3640 |
takeprec () |
F_takeprec () |
3641 |
{ |
{ |
3642 |
dbp = skip_spaces (dbp); |
dbp = skip_spaces (dbp); |
3643 |
if (*dbp != '*') |
if (*dbp != '*') |
3660 |
} |
} |
3661 |
|
|
3662 |
static void |
static void |
3663 |
getit (inf) |
F_getit (inf) |
3664 |
FILE *inf; |
FILE *inf; |
3665 |
{ |
{ |
3666 |
register char *cp; |
register char *cp; |
3700 |
switch (lowcase (*dbp)) |
switch (lowcase (*dbp)) |
3701 |
{ |
{ |
3702 |
case 'i': |
case 'i': |
3703 |
if (tail ("integer")) |
if (nocase_tail ("integer")) |
3704 |
takeprec (); |
F_takeprec (); |
3705 |
break; |
break; |
3706 |
case 'r': |
case 'r': |
3707 |
if (tail ("real")) |
if (nocase_tail ("real")) |
3708 |
takeprec (); |
F_takeprec (); |
3709 |
break; |
break; |
3710 |
case 'l': |
case 'l': |
3711 |
if (tail ("logical")) |
if (nocase_tail ("logical")) |
3712 |
takeprec (); |
F_takeprec (); |
3713 |
break; |
break; |
3714 |
case 'c': |
case 'c': |
3715 |
if (tail ("complex") || tail ("character")) |
if (nocase_tail ("complex") || nocase_tail ("character")) |
3716 |
takeprec (); |
F_takeprec (); |
3717 |
break; |
break; |
3718 |
case 'd': |
case 'd': |
3719 |
if (tail ("double")) |
if (nocase_tail ("double")) |
3720 |
{ |
{ |
3721 |
dbp = skip_spaces (dbp); |
dbp = skip_spaces (dbp); |
3722 |
if (*dbp == '\0') |
if (*dbp == '\0') |
3723 |
continue; |
continue; |
3724 |
if (tail ("precision")) |
if (nocase_tail ("precision")) |
3725 |
break; |
break; |
3726 |
continue; |
continue; |
3727 |
} |
} |
3733 |
switch (lowcase (*dbp)) |
switch (lowcase (*dbp)) |
3734 |
{ |
{ |
3735 |
case 'f': |
case 'f': |
3736 |
if (tail ("function")) |
if (nocase_tail ("function")) |
3737 |
getit (inf); |
F_getit (inf); |
3738 |
continue; |
continue; |
3739 |
case 's': |
case 's': |
3740 |
if (tail ("subroutine")) |
if (nocase_tail ("subroutine")) |
3741 |
getit (inf); |
F_getit (inf); |
3742 |
continue; |
continue; |
3743 |
case 'e': |
case 'e': |
3744 |
if (tail ("entry")) |
if (nocase_tail ("entry")) |
3745 |
getit (inf); |
F_getit (inf); |
3746 |
continue; |
continue; |
3747 |
case 'b': |
case 'b': |
3748 |
if (tail ("blockdata") || tail ("block data")) |
if (nocase_tail ("blockdata") || nocase_tail ("block data")) |
3749 |
{ |
{ |
3750 |
dbp = skip_spaces (dbp); |
dbp = skip_spaces (dbp); |
3751 |
if (*dbp == '\0') /* assume un-named */ |
if (*dbp == '\0') /* assume un-named */ |
3752 |
pfnote (savestr ("blockdata"), TRUE, |
pfnote (savestr ("blockdata"), TRUE, |
3753 |
lb.buffer, dbp - lb.buffer, lineno, linecharno); |
lb.buffer, dbp - lb.buffer, lineno, linecharno); |
3754 |
else |
else |
3755 |
getit (inf); /* look for name */ |
F_getit (inf); /* look for name */ |
3756 |
} |
} |
3757 |
continue; |
continue; |
3758 |
} |
} |
3762 |
|
|
3763 |
/* |
/* |
3764 |
* Ada parsing |
* Ada parsing |
3765 |
|
* Original code by |
3766 |
* Philippe Waroquiers <philippe.waroquiers@eurocontrol.be> (1998) |
* Philippe Waroquiers <philippe.waroquiers@eurocontrol.be> (1998) |
3767 |
*/ |
*/ |
3768 |
|
|
3769 |
static void adagetit P_((FILE *, char *)); |
static void Ada_getit __P((FILE *, char *)); |
3770 |
|
|
3771 |
/* Once we are positioned after an "interesting" keyword, let's get |
/* Once we are positioned after an "interesting" keyword, let's get |
3772 |
the real tag value necessary. */ |
the real tag value necessary. */ |
3773 |
static void |
static void |
3774 |
adagetit (inf, name_qualifier) |
Ada_getit (inf, name_qualifier) |
3775 |
FILE *inf; |
FILE *inf; |
3776 |
char *name_qualifier; |
char *name_qualifier; |
3777 |
{ |
{ |
3790 |
charno += readline (&lb, inf); |
charno += readline (&lb, inf); |
3791 |
dbp = lb.buffer; |
dbp = lb.buffer; |
3792 |
} |
} |
3793 |
switch (*dbp) |
switch (lowcase(*dbp)) |
3794 |
{ |
{ |
3795 |
case 'b': |
case 'b': |
3796 |
case 'B': |
if (nocase_tail ("body")) |
|
if (tail ("body")) |
|
3797 |
{ |
{ |
3798 |
/* Skipping body of procedure body or package body or .... |
/* Skipping body of procedure body or package body or .... |
3799 |
resetting qualifier to body instead of spec. */ |
resetting qualifier to body instead of spec. */ |
3802 |
} |
} |
3803 |
break; |
break; |
3804 |
case 't': |
case 't': |
|
case 'T': |
|
3805 |
/* Skipping type of task type or protected type ... */ |
/* Skipping type of task type or protected type ... */ |
3806 |
if (tail ("type")) |
if (nocase_tail ("type")) |
3807 |
continue; |
continue; |
3808 |
break; |
break; |
3809 |
} |
} |
3884 |
} |
} |
3885 |
|
|
3886 |
/* We are at the beginning of a token. */ |
/* We are at the beginning of a token. */ |
3887 |
switch (*dbp) |
switch (lowcase(*dbp)) |
3888 |
{ |
{ |
3889 |
case 'f': |
case 'f': |
3890 |
case 'F': |
if (!packages_only && nocase_tail ("function")) |
3891 |
if (!packages_only && tail ("function")) |
Ada_getit (inf, "/f"); |
|
adagetit (inf, "/f"); |
|
3892 |
else |
else |
3893 |
break; /* from switch */ |
break; /* from switch */ |
3894 |
continue; /* advance char */ |
continue; /* advance char */ |
3895 |
case 'p': |
case 'p': |
3896 |
case 'P': |
if (!packages_only && nocase_tail ("procedure")) |
3897 |
if (!packages_only && tail ("procedure")) |
Ada_getit (inf, "/p"); |
3898 |
adagetit (inf, "/p"); |
else if (nocase_tail ("package")) |
3899 |
else if (tail ("package")) |
Ada_getit (inf, "/s"); |
3900 |
adagetit (inf, "/s"); |
else if (nocase_tail ("protected")) /* protected type */ |
3901 |
else if (tail ("protected")) /* protected type */ |
Ada_getit (inf, "/t"); |
|
adagetit (inf, "/t"); |
|
3902 |
else |
else |
3903 |
break; /* from switch */ |
break; /* from switch */ |
3904 |
continue; /* advance char */ |
continue; /* advance char */ |
3905 |
case 't': |
case 't': |
3906 |
case 'T': |
if (!packages_only && nocase_tail ("task")) |
3907 |
if (!packages_only && tail ("task")) |
Ada_getit (inf, "/k"); |
3908 |
adagetit (inf, "/k"); |
else if (typedefs && !packages_only && nocase_tail ("type")) |
|
else if (typedefs && !packages_only && tail ("type")) |
|
3909 |
{ |
{ |
3910 |
adagetit (inf, "/t"); |
Ada_getit (inf, "/t"); |
3911 |
while (*dbp != '\0') |
while (*dbp != '\0') |
3912 |
dbp += 1; |
dbp += 1; |
3913 |
} |
} |
3926 |
|
|
3927 |
|
|
3928 |
/* |
/* |
|
* Bob Weiner, Motorola Inc., 4/3/94 |
|
3929 |
* Unix and microcontroller assembly tag handling |
* Unix and microcontroller assembly tag handling |
3930 |
* look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]' |
* Labels: /^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]/ |
3931 |
|
* Idea by Bob Weiner, Motorola Inc. (1994) |
3932 |
*/ |
*/ |
3933 |
static void |
static void |
3934 |
Asm_labels (inf) |
Asm_labels (inf) |
3959 |
|
|
3960 |
/* |
/* |
3961 |
* Perl support |
* Perl support |
3962 |
* Perl sub names: look for /^sub[ \t\n]+[^ \t\n{]+/ |
* Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/ |
3963 |
* Perl variable names: /^(my|local).../ |
* Perl variable names: /^(my|local).../ |
3964 |
* Bart Robinson <lomew@cs.utah.edu> (1995) |
* Original code by Bart Robinson <lomew@cs.utah.edu> (1995) |
3965 |
* Michael Ernst <mernst@alum.mit.edu> (1997) |
* Additions by Michael Ernst <mernst@alum.mit.edu> (1997) |
3966 |
|
* Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001) |
3967 |
*/ |
*/ |
3968 |
static void |
static void |
3969 |
Perl_functions (inf) |
Perl_functions (inf) |
3970 |
FILE *inf; |
FILE *inf; |
3971 |
{ |
{ |
3972 |
|
char *package = savestr ("main"); /* current package name */ |
3973 |
register char *cp; |
register char *cp; |
3974 |
|
|
3975 |
LOOP_ON_INPUT_LINES (inf, lb, cp) |
LOOP_ON_INPUT_LINES (inf, lb, cp) |
3976 |
{ |
{ |
3977 |
if (LOOKING_AT (cp, "sub")) |
skip_spaces(cp); |
3978 |
|
|
3979 |
|
if (LOOKING_AT (cp, "package")) |
3980 |
{ |
{ |
3981 |
if (*cp != '\0') |
free (package); |
3982 |
{ |
package = get_tag (cp); |
3983 |
char *sp = cp; |
if (package == NULL) /* can't parse package name */ |
3984 |
while (*cp != '\0' |
package = savestr (""); |
3985 |
&& !iswhite (*cp) && *cp != '{' && *cp != '(') |
else |
3986 |
cp++; |
package = savestr(package); /* make a copy */ |
3987 |
pfnote (savenstr (sp, cp-sp), TRUE, |
} |
3988 |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
else if (LOOKING_AT (cp, "sub")) |
3989 |
} |
{ |
3990 |
|
char *name, *fullname, *pos; |
3991 |
|
char *sp = cp; |
3992 |
|
|
3993 |
|
while (!notinname (*cp)) |
3994 |
|
cp++; |
3995 |
|
if (cp == sp) |
3996 |
|
continue; |
3997 |
|
name = savenstr (sp, cp-sp); |
3998 |
|
if ((pos = etags_strchr (name, ':')) != NULL && pos[1] == ':') |
3999 |
|
fullname = name; |
4000 |
|
else |
4001 |
|
fullname = concat (package, "::", name); |
4002 |
|
pfnote (fullname, TRUE, |
4003 |
|
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
4004 |
|
if (name != fullname) |
4005 |
|
free (name); |
4006 |
} |
} |
4007 |
else if (globals /* only if tagging global vars is enabled */ |
else if (globals /* only if tagging global vars is enabled */ |
4008 |
&& ((strneq (cp, "my", 2) && (cp+=2)) |
&& (LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local"))) |
|
|| (strneq (cp, "local", 5) && (cp+=5))) |
|
|
&& (*cp == '(' || iswhite (*cp))) |
|
4009 |
{ |
{ |
4010 |
/* After "my" or "local", but before any following paren or space. */ |
/* After "my" or "local", but before any following paren or space. */ |
4011 |
char *varname = NULL; |
char *varname = NULL; |
4012 |
|
|
|
cp = skip_spaces (cp); |
|
4013 |
if (*cp == '$' || *cp == '@' || *cp == '%') |
if (*cp == '$' || *cp == '@' || *cp == '%') |
4014 |
{ |
{ |
4015 |
char* varstart = ++cp; |
char* varstart = ++cp; |
4037 |
/* |
/* |
4038 |
* Python support |
* Python support |
4039 |
* Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/ |
* Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/ |
4040 |
* Eric S. Raymond <esr@thyrsus.com> (1997) |
* Idea by Eric S. Raymond <esr@thyrsus.com> (1997) |
4041 |
*/ |
*/ |
4042 |
static void |
static void |
4043 |
Python_functions (inf) |
Python_functions (inf) |
4048 |
LOOP_ON_INPUT_LINES (inf, lb, cp) |
LOOP_ON_INPUT_LINES (inf, lb, cp) |
4049 |
if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class")) |
if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class")) |
4050 |
{ |
{ |
4051 |
while (*cp != '\0' && !iswhite (*cp) && *cp != '(' && *cp != ':') |
while (!notinname (*cp) && *cp != ':') |
4052 |
cp++; |
cp++; |
4053 |
pfnote (NULL, TRUE, |
pfnote (NULL, TRUE, |
4054 |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
4064 |
* - /^[ \t]*define\(\"[^\"]+/ |
* - /^[ \t]*define\(\"[^\"]+/ |
4065 |
* Only with --members: |
* Only with --members: |
4066 |
* - /^[ \t]*var[ \t\n]+\$[^ \t\n=;]/ |
* - /^[ \t]*var[ \t\n]+\$[^ \t\n=;]/ |
4067 |
* originally by Diez B. Roggisch 2001-06-06 |
* Idea by Diez B. Roggisch (2001) |
4068 |
*/ |
*/ |
4069 |
static void |
static void |
4070 |
PHP_functions (inf) |
PHP_functions (inf) |
4079 |
if (search_identifier |
if (search_identifier |
4080 |
&& *cp != '\0') |
&& *cp != '\0') |
4081 |
{ |
{ |
4082 |
while (*cp != '\0' && !iswhite (*cp) && *cp != '(') |
while (!notinname (*cp)) |
4083 |
cp++; |
cp++; |
4084 |
pfnote (NULL, TRUE, |
pfnote (NULL, TRUE, |
4085 |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
4091 |
cp = skip_spaces (cp+1); |
cp = skip_spaces (cp+1); |
4092 |
if(*cp != '\0') |
if(*cp != '\0') |
4093 |
{ |
{ |
4094 |
while (*cp != '\0' && !iswhite (*cp) && *cp != '(') |
while (!notinname (*cp)) |
4095 |
cp++; |
cp++; |
4096 |
pfnote (NULL, TRUE, |
pfnote (NULL, TRUE, |
4097 |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
4126 |
&& LOOKING_AT (cp, "var") |
&& LOOKING_AT (cp, "var") |
4127 |
&& *cp == '$') |
&& *cp == '$') |
4128 |
{ |
{ |
4129 |
while (*cp != '=' && *cp != ';' && *cp != '\0' && !iswhite(*cp)) |
while (!notinname(*cp)) |
4130 |
cp++; |
cp++; |
4131 |
pfnote (NULL, FALSE, |
pfnote (NULL, FALSE, |
4132 |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
4135 |
} |
} |
4136 |
|
|
4137 |
|
|
4138 |
/* Idea by Corny de Souza |
/* |
4139 |
* Cobol tag functions |
* Cobol tag functions |
4140 |
* We could look for anything that could be a paragraph name. |
* We could look for anything that could be a paragraph name. |
4141 |
* i.e. anything that starts in column 8 is one word and ends in a full stop. |
* i.e. anything that starts in column 8 is one word and ends in a full stop. |
4142 |
|
* Idea by Corny de Souza (1993) |
4143 |
*/ |
*/ |
4144 |
static void |
static void |
4145 |
Cobol_paragraphs (inf) |
Cobol_paragraphs (inf) |
4189 |
} |
} |
4190 |
|
|
4191 |
|
|
|
/* Added by Mosur Mohan, 4/22/88 */ |
|
|
/* Pascal parsing */ |
|
|
|
|
4192 |
/* |
/* |
4193 |
|
* Pascal parsing |
4194 |
|
* Original code by Mosur K. Mohan (1989) |
4195 |
|
* |
4196 |
* Locates tags for procedures & functions. Doesn't do any type- or |
* Locates tags for procedures & functions. Doesn't do any type- or |
4197 |
* var-definitions. It does look for the keyword "extern" or |
* var-definitions. It does look for the keyword "extern" or |
4198 |
* "forward" immediately following the procedure statement; if found, |
* "forward" immediately following the procedure statement; if found, |
4305 |
continue; |
continue; |
4306 |
if (lowcase (*dbp == 'e')) |
if (lowcase (*dbp == 'e')) |
4307 |
{ |
{ |
4308 |
if (tail ("extern")) /* superfluous, really! */ |
if (nocase_tail ("extern")) /* superfluous, really! */ |
4309 |
{ |
{ |
4310 |
found_tag = FALSE; |
found_tag = FALSE; |
4311 |
verify_tag = FALSE; |
verify_tag = FALSE; |
4313 |
} |
} |
4314 |
else if (lowcase (*dbp) == 'f') |
else if (lowcase (*dbp) == 'f') |
4315 |
{ |
{ |
4316 |
if (tail ("forward")) /* check for forward reference */ |
if (nocase_tail ("forward")) /* check for forward reference */ |
4317 |
{ |
{ |
4318 |
found_tag = FALSE; |
found_tag = FALSE; |
4319 |
verify_tag = FALSE; |
verify_tag = FALSE; |
4357 |
switch (lowcase (c)) |
switch (lowcase (c)) |
4358 |
{ |
{ |
4359 |
case 'p': |
case 'p': |
4360 |
if (tail ("rocedure")) /* c = 'p', dbp has advanced */ |
if (nocase_tail ("rocedure")) /* c = 'p', dbp has advanced */ |
4361 |
get_tagname = TRUE; |
get_tagname = TRUE; |
4362 |
continue; |
continue; |
4363 |
case 'f': |
case 'f': |
4364 |
if (tail ("unction")) |
if (nocase_tail ("unction")) |
4365 |
get_tagname = TRUE; |
get_tagname = TRUE; |
4366 |
continue; |
continue; |
4367 |
} |
} |
4377 |
* look for (def or (DEF, quote or QUOTE |
* look for (def or (DEF, quote or QUOTE |
4378 |
*/ |
*/ |
4379 |
|
|
4380 |
static int L_isdef P_((char *)); |
static void L_getit __P((void)); |
|
static int L_isquote P_((char *)); |
|
|
static void L_getit P_((void)); |
|
|
|
|
|
static int |
|
|
L_isdef (strp) |
|
|
register char *strp; |
|
|
{ |
|
|
return ((strp[1] == 'd' || strp[1] == 'D') |
|
|
&& (strp[2] == 'e' || strp[2] == 'E') |
|
|
&& (strp[3] == 'f' || strp[3] == 'F')); |
|
|
} |
|
|
|
|
|
static int |
|
|
L_isquote (strp) |
|
|
register char *strp; |
|
|
{ |
|
|
return ((*++strp == 'q' || *strp == 'Q') |
|
|
&& (*++strp == 'u' || *strp == 'U') |
|
|
&& (*++strp == 'o' || *strp == 'O') |
|
|
&& (*++strp == 't' || *strp == 'T') |
|
|
&& (*++strp == 'e' || *strp == 'E') |
|
|
&& iswhite (*++strp)); |
|
|
} |
|
4381 |
|
|
4382 |
static void |
static void |
4383 |
L_getit () |
L_getit () |
4384 |
{ |
{ |
|
register char *cp; |
|
|
|
|
4385 |
if (*dbp == '\'') /* Skip prefix quote */ |
if (*dbp == '\'') /* Skip prefix quote */ |
4386 |
dbp++; |
dbp++; |
4387 |
else if (*dbp == '(') |
else if (*dbp == '(') |
4388 |
{ |
{ |
4389 |
if (L_isquote (dbp)) |
dbp++; |
4390 |
dbp += 7; /* Skip "(quote " */ |
/* Try to skip "(quote " */ |
4391 |
else |
if (!LOOKING_AT (dbp, "quote") && !LOOKING_AT (dbp, "QUOTE")) |
4392 |
dbp += 1; /* Skip "(" before name in (defstruct (foo)) */ |
/* Ok, then skip "(" before name in (defstruct (foo)) */ |
4393 |
dbp = skip_spaces (dbp); |
dbp = skip_spaces (dbp); |
4394 |
} |
} |
4395 |
|
get_tag (dbp); |
|
for (cp = dbp /*+1*/; |
|
|
*cp != '\0' && *cp != '(' && !iswhite(*cp) && *cp != ')'; |
|
|
cp++) |
|
|
continue; |
|
|
if (cp == dbp) |
|
|
return; |
|
|
|
|
|
pfnote (savenstr (dbp, cp-dbp), TRUE, |
|
|
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
|
4396 |
} |
} |
4397 |
|
|
4398 |
static void |
static void |
4401 |
{ |
{ |
4402 |
LOOP_ON_INPUT_LINES (inf, lb, dbp) |
LOOP_ON_INPUT_LINES (inf, lb, dbp) |
4403 |
{ |
{ |
4404 |
if (dbp[0] == '(') |
if (dbp[0] != '(') |
4405 |
|
continue; |
4406 |
|
|
4407 |
|
if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3)) |
4408 |
{ |
{ |
4409 |
if (L_isdef (dbp)) |
dbp = skip_non_spaces (dbp); |
4410 |
{ |
dbp = skip_spaces (dbp); |
4411 |
dbp = skip_non_spaces (dbp); |
L_getit (); |
4412 |
dbp = skip_spaces (dbp); |
} |
4413 |
L_getit (); |
else |
4414 |
} |
{ |
4415 |
else |
/* Check for (foo::defmumble name-defined ... */ |
4416 |
|
do |
4417 |
|
dbp++; |
4418 |
|
while (!notinname (*dbp) && *dbp != ':'); |
4419 |
|
if (*dbp == ':') |
4420 |
{ |
{ |
|
/* Check for (foo::defmumble name-defined ... */ |
|
4421 |
do |
do |
4422 |
dbp++; |
dbp++; |
4423 |
while (*dbp != '\0' && !iswhite (*dbp) |
while (*dbp == ':'); |
|
&& *dbp != ':' && *dbp != '(' && *dbp != ')'); |
|
|
if (*dbp == ':') |
|
|
{ |
|
|
do |
|
|
dbp++; |
|
|
while (*dbp == ':'); |
|
4424 |
|
|
4425 |
if (L_isdef (dbp - 1)) |
if (strneq (dbp, "def", 3) || strneq (dbp, "DEF", 3)) |
4426 |
{ |
{ |
4427 |
dbp = skip_non_spaces (dbp); |
dbp = skip_non_spaces (dbp); |
4428 |
dbp = skip_spaces (dbp); |
dbp = skip_spaces (dbp); |
4429 |
L_getit (); |
L_getit (); |
|
} |
|
4430 |
} |
} |
4431 |
} |
} |
4432 |
} |
} |
4438 |
* Postscript tag functions |
* Postscript tag functions |
4439 |
* Just look for lines where the first character is '/' |
* Just look for lines where the first character is '/' |
4440 |
* Also look at "defineps" for PSWrap |
* Also look at "defineps" for PSWrap |
4441 |
* Richard Mlynarik <mly@adoc.xerox.com> (1997) |
* Ideas by: |
4442 |
* Ideas by Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999) |
* Richard Mlynarik <mly@adoc.xerox.com> (1997) |
4443 |
|
* Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999) |
4444 |
*/ |
*/ |
4445 |
static void |
static void |
4446 |
Postscript_functions (inf) |
Postscript_functions (inf) |
4459 |
pfnote (savenstr (bp, ep-bp), TRUE, |
pfnote (savenstr (bp, ep-bp), TRUE, |
4460 |
lb.buffer, ep - lb.buffer + 1, lineno, linecharno); |
lb.buffer, ep - lb.buffer + 1, lineno, linecharno); |
4461 |
} |
} |
4462 |
else if (strneq (bp, "defineps", 8)) |
else if (LOOKING_AT (bp, "defineps")) |
4463 |
{ |
get_tag (bp); |
|
bp = skip_non_spaces (bp); |
|
|
bp = skip_spaces (bp); |
|
|
get_tag (bp); |
|
|
} |
|
4464 |
} |
} |
4465 |
} |
} |
4466 |
|
|
4468 |
/* |
/* |
4469 |
* Scheme tag functions |
* Scheme tag functions |
4470 |
* look for (def... xyzzy |
* look for (def... xyzzy |
4471 |
* look for (def... (xyzzy |
* (def... (xyzzy |
4472 |
* look for (def ... ((...(xyzzy .... |
* (def ... ((...(xyzzy .... |
4473 |
* look for (set! xyzzy |
* (set! xyzzy |
4474 |
|
* Original code by Ken Haase (1985?) |
4475 |
*/ |
*/ |
4476 |
|
|
4477 |
static void |
static void |
4482 |
|
|
4483 |
LOOP_ON_INPUT_LINES (inf, lb, bp) |
LOOP_ON_INPUT_LINES (inf, lb, bp) |
4484 |
{ |
{ |
4485 |
if (bp[0] == '(' |
if (strneq (bp, "(def", 4) || strneq (bp, "(DEF", 4)) |
|
&& (bp[1] == 'D' || bp[1] == 'd') |
|
|
&& (bp[2] == 'E' || bp[2] == 'e') |
|
|
&& (bp[3] == 'F' || bp[3] == 'f')) |
|
4486 |
{ |
{ |
4487 |
bp = skip_non_spaces (bp); |
bp = skip_non_spaces (bp+4); |
4488 |
/* Skip over open parens and white space */ |
/* Skip over open parens and white space */ |
4489 |
while (iswhite (*bp) || *bp == '(') |
while (notinname (*bp)) |
4490 |
bp++; |
bp++; |
4491 |
get_tag (bp); |
get_tag (bp); |
4492 |
} |
} |
4516 |
:chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ |
:chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ |
4517 |
:part:appendix:entry:index"; |
:part:appendix:entry:index"; |
4518 |
|
|
4519 |
static void TEX_mode P_((FILE *)); |
static void TEX_mode __P((FILE *)); |
4520 |
static struct TEX_tabent *TEX_decode_env P_((char *, char *)); |
static struct TEX_tabent *TEX_decode_env __P((char *, char *)); |
4521 |
static int TEX_Token P_((char *)); |
static int TEX_Token __P((char *)); |
4522 |
|
|
4523 |
char TEX_esc = '\\'; |
char TEX_esc = '\\'; |
4524 |
char TEX_opgrp = '{'; |
char TEX_opgrp = '{'; |
4698 |
|
|
4699 |
|
|
4700 |
/* |
/* |
4701 |
* Prolog support (rewritten) by Anders Lindgren, Mar. 96 |
* Prolog support |
4702 |
* |
* |
4703 |
* Assumes that the predicate starts at column 0. |
* Assumes that the predicate or rule starts at column 0. |
4704 |
* Only the first clause of a predicate is added. |
* Only the first clause of a predicate or rule is added. |
4705 |
*/ |
* Original code by Sunichirou Sugou (1989) |
4706 |
static int prolog_pr P_((char *, char *)); |
* Rewritten by Anders Lindgren (1996) |
4707 |
static void prolog_skip_comment P_((linebuffer *, FILE *)); |
*/ |
4708 |
static int prolog_atom P_((char *, int)); |
static int prolog_pr __P((char *, char *)); |
4709 |
|
static void prolog_skip_comment __P((linebuffer *, FILE *)); |
4710 |
|
static int prolog_atom __P((char *, int)); |
4711 |
|
|
4712 |
static void |
static void |
4713 |
Prolog_functions (inf) |
Prolog_functions (inf) |
4731 |
prolog_skip_comment (&lb, inf); |
prolog_skip_comment (&lb, inf); |
4732 |
else if ((len = prolog_pr (cp, last)) > 0) |
else if ((len = prolog_pr (cp, last)) > 0) |
4733 |
{ |
{ |
4734 |
/* Predicate. Store the function name so that we only |
/* Predicate or rule. Store the function name so that we |
4735 |
generate a tag for the first clause. */ |
only generate a tag for the first clause. */ |
4736 |
if (last == NULL) |
if (last == NULL) |
4737 |
last = xnew(len + 1, char); |
last = xnew(len + 1, char); |
4738 |
else if (len + 1 > allocated) |
else if (len + 1 > allocated) |
4864 |
|
|
4865 |
|
|
4866 |
/* |
/* |
4867 |
* Support for Erlang -- Anders Lindgren, Feb 1996. |
* Support for Erlang |
4868 |
* |
* |
4869 |
* Generates tags for functions, defines, and records. |
* Generates tags for functions, defines, and records. |
|
* |
|
4870 |
* Assumes that Erlang functions start at column 0. |
* Assumes that Erlang functions start at column 0. |
4871 |
|
* Original code by Anders Lindgren (1996) |
4872 |
*/ |
*/ |
4873 |
static int erlang_func P_((char *, char *)); |
static int erlang_func __P((char *, char *)); |
4874 |
static void erlang_attribute P_((char *)); |
static void erlang_attribute __P((char *)); |
4875 |
static int erlang_atom P_((char *, int)); |
static int erlang_atom __P((char *, int)); |
4876 |
|
|
4877 |
static void |
static void |
4878 |
Erlang_functions (inf) |
Erlang_functions (inf) |
4974 |
int pos; |
int pos; |
4975 |
int len; |
int len; |
4976 |
|
|
4977 |
if (strneq (s, "-define", 7) || strneq (s, "-record", 7)) |
if (LOOKING_AT (s, "-define") || LOOKING_AT (s, "-record")) |
4978 |
{ |
{ |
|
pos = skip_spaces (s + 7) - s; |
|
4979 |
if (s[pos++] == '(') |
if (s[pos++] == '(') |
4980 |
{ |
{ |
4981 |
pos = skip_spaces (s + pos) - s; |
pos = skip_spaces (s + pos) - s; |
5042 |
|
|
5043 |
#ifdef ETAGS_REGEXPS |
#ifdef ETAGS_REGEXPS |
5044 |
|
|
5045 |
static char *scan_separators P_((char *)); |
static char *scan_separators __P((char *)); |
5046 |
static void analyse_regex P_((char *, bool)); |
static void analyse_regex __P((char *, bool)); |
5047 |
static void add_regex P_((char *, bool, language *)); |
static void add_regex __P((char *, bool, language *)); |
5048 |
static char *substitute P_((char *, char *, struct re_registers *)); |
static char *substitute __P((char *, char *, struct re_registers *)); |
5049 |
|
|
5050 |
/* Take a string like "/blah/" and turn it into "blah", making sure |
/* Take a string like "/blah/" and turn it into "blah", making sure |
5051 |
that the first and last characters are the same, and handling |
that the first and last characters are the same, and handling |
5207 |
p_head = xnew (1, pattern); |
p_head = xnew (1, pattern); |
5208 |
p_head->regex = savestr (regexp_pattern); |
p_head->regex = savestr (regexp_pattern); |
5209 |
p_head->p_next = pp; |
p_head->p_next = pp; |
5210 |
p_head->language = lang; |
p_head->lang = lang; |
5211 |
p_head->pattern = patbuf; |
p_head->pat = patbuf; |
5212 |
p_head->name_pattern = savestr (name); |
p_head->name_pattern = savestr (name); |
5213 |
p_head->error_signaled = FALSE; |
p_head->error_signaled = FALSE; |
5214 |
} |
} |
5281 |
#endif /* ETAGS_REGEXPS */ |
#endif /* ETAGS_REGEXPS */ |
5282 |
|
|
5283 |
|
|
5284 |
static void |
static bool |
5285 |
|
nocase_tail (cp) |
5286 |
|
char *cp; |
5287 |
|
{ |
5288 |
|
register int len = 0; |
5289 |
|
|
5290 |
|
while (*cp != '\0' && lowcase (*cp) == lowcase (dbp[len])) |
5291 |
|
cp++, len++; |
5292 |
|
if (*cp == '\0' && !intoken (dbp[len])) |
5293 |
|
{ |
5294 |
|
dbp += len; |
5295 |
|
return TRUE; |
5296 |
|
} |
5297 |
|
return FALSE; |
5298 |
|
} |
5299 |
|
|
5300 |
|
static char * |
5301 |
get_tag (bp) |
get_tag (bp) |
5302 |
register char *bp; |
register char *bp; |
5303 |
{ |
{ |
5304 |
register char *cp; |
register char *cp, *name; |
5305 |
|
|
5306 |
if (*bp == '\0') |
if (*bp == '\0') |
5307 |
return; |
return NULL; |
5308 |
/* Go till you get to white space or a syntactic break */ |
/* Go till you get to white space or a syntactic break */ |
5309 |
for (cp = bp + 1; |
for (cp = bp + 1; !notinname (*cp); cp++) |
|
*cp != '\0' && *cp != '(' && *cp != ')' && !iswhite (*cp); |
|
|
cp++) |
|
5310 |
continue; |
continue; |
5311 |
pfnote (savenstr (bp, cp-bp), TRUE, |
name = savenstr (bp, cp-bp); |
5312 |
|
pfnote (name, TRUE, |
5313 |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
5314 |
|
return name; |
5315 |
} |
} |
5316 |
|
|
5317 |
/* Initialize a linebuffer for use */ |
/* Initialize a linebuffer for use */ |
5415 |
for (pp = p_head; pp != NULL; pp = pp->p_next) |
for (pp = p_head; pp != NULL; pp = pp->p_next) |
5416 |
{ |
{ |
5417 |
/* Only use generic regexps or those for the current language. */ |
/* Only use generic regexps or those for the current language. */ |
5418 |
if (pp->language != NULL && pp->language != curlang) |
if (pp->lang != NULL && pp->lang != curlang) |
5419 |
continue; |
continue; |
5420 |
|
|
5421 |
match = re_match (pp->pattern, lbp->buffer, lbp->len, 0, &pp->regs); |
match = re_match (pp->pat, lbp->buffer, lbp->len, 0, &pp->regs); |
5422 |
switch (match) |
switch (match) |
5423 |
{ |
{ |
5424 |
case -2: |
case -2: |
5826 |
} |
} |
5827 |
|
|
5828 |
/* Like malloc but get fatal error if memory is exhausted. */ |
/* Like malloc but get fatal error if memory is exhausted. */ |
5829 |
long * |
PTR |
5830 |
xmalloc (size) |
xmalloc (size) |
5831 |
unsigned int size; |
unsigned int size; |
5832 |
{ |
{ |
5833 |
long *result = (long *) malloc (size); |
PTR result = (PTR) malloc (size); |
5834 |
if (result == NULL) |
if (result == NULL) |
5835 |
fatal ("virtual memory exhausted", (char *)NULL); |
fatal ("virtual memory exhausted", (char *)NULL); |
5836 |
return result; |
return result; |
5837 |
} |
} |
5838 |
|
|
5839 |
long * |
PTR |
5840 |
xrealloc (ptr, size) |
xrealloc (ptr, size) |
5841 |
char *ptr; |
char *ptr; |
5842 |
unsigned int size; |
unsigned int size; |
5843 |
{ |
{ |
5844 |
long *result = (long *) realloc (ptr, size); |
PTR result = (PTR) realloc (ptr, size); |
5845 |
if (result == NULL) |
if (result == NULL) |
5846 |
fatal ("virtual memory exhausted", (char *)NULL); |
fatal ("virtual memory exhausted", (char *)NULL); |
5847 |
return result; |
return result; |
5852 |
* c-indentation-style: gnu |
* c-indentation-style: gnu |
5853 |
* indent-tabs-mode: t |
* indent-tabs-mode: t |
5854 |
* tab-width: 8 |
* tab-width: 8 |
5855 |
* c-font-lock-extra-types: ("FILE" "bool" "linebuffer") |
* c-font-lock-extra-types: ("FILE" "bool" "language" "linebuffer") |
5856 |
* End: |
* End: |
5857 |
*/ |
*/ |