2000-04-09 11:15:57 +00:00
|
|
|
|
/* ebrowse.c --- parsing files for the ebrowse C++ browser
|
|
|
|
|
|
2022-01-01 07:45:51 +00:00
|
|
|
|
Copyright (C) 1992-2022 Free Software Foundation, Inc.
|
2008-05-09 23:19:13 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2016-03-10 15:34:52 +00:00
|
|
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
|
|
|
|
your option) any later version.
|
2008-05-09 23:19:13 +00:00
|
|
|
|
|
|
|
|
|
GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
2008-05-09 23:19:13 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2000-06-23 11:36:52 +00:00
|
|
|
|
#include <config.h>
|
2013-06-21 20:27:13 +00:00
|
|
|
|
#include <stddef.h>
|
2000-04-09 11:15:57 +00:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include <assert.h>
|
2011-01-09 08:00:02 +00:00
|
|
|
|
#include <getopt.h>
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2022-03-09 02:46:47 +00:00
|
|
|
|
#include <attribute.h>
|
Use unlocked stdio more systematically
This can improve performance significantly on stdio-bottlenecked code.
E.g., make-docfile is 3x faster on my Fedora 25 x86-64 desktop.
* admin/merge-gnulib (GNULIB_MODULES): Add unlocked-io.
* lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c:
* lib-src/hexl.c, lib-src/make-docfile.c, lib-src/movemail.c:
* lib-src/profile.c, lib-src/update-game-score.c:
Include unlocked-io.h instead of stdio.h, since these programs are
single-threaded.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/unlocked-io.h, m4/unlocked-io.m4: New files, copied from Gnulib.
* src/charset.c, src/cm.c, src/emacs.c, src/image.c, src/keyboard.c:
* src/lread.c, src/term.c:
Include sysstdio.h, possibly instead of stdio.h, to define
the unlocked functions if the system does not provide them.
* src/charset.c, src/lread.c (getc_unlocked):
Remove, since sysstdio.h now defines it if needed.
* src/cm.c (cmputc, cmcheckmagic):
* src/dispnew.c (update_frame, update_frame_with_menu)
(update_frame_1, Fsend_string_to_terminal, Fding, bitch_at_user):
* src/emacs.c (main, Fdump_emacs):
* src/fileio.c (Fdo_auto_save, Fset_binary_mode):
* src/image.c (slurp_file, png_read_from_file, png_load_body)
(our_stdio_fill_input_buffer):
* src/keyboard.c (record_char, kbd_buffer_get_event, handle_interrupt):
* src/lread.c (readbyte_from_file):
* src/minibuf.c (read_minibuf_noninteractive):
* src/print.c (printchar_to_stream, strout)
(Fredirect_debugging_output):
* src/sysdep.c (reset_sys_modes, procfs_ttyname)
(procfs_get_total_memory):
* src/term.c (tty_ring_bell, tty_send_additional_strings)
(tty_set_terminal_modes, tty_reset_terminal_modes)
(tty_update_end, tty_clear_end_of_line, tty_write_glyphs)
(tty_write_glyphs_with_face, tty_insert_glyphs)
(tty_menu_activate):
* src/xfaces.c (Fx_load_color_file):
Use unlocked stdio when it should be safe.
* src/sysstdio.h (clearerr_unlocked, feof_unlocked, ferror_unlocked)
(fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked)
(fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked)
(putc_unlocked, putchar_unloced): Provide substitutes if not declared.
2017-06-22 18:21:20 +00:00
|
|
|
|
#include <flexmember.h>
|
|
|
|
|
#include <min-max.h>
|
|
|
|
|
#include <unlocked-io.h>
|
|
|
|
|
|
2001-09-01 18:22:38 +00:00
|
|
|
|
/* The SunOS compiler doesn't have SEEK_END. */
|
|
|
|
|
#ifndef SEEK_END
|
|
|
|
|
#define SEEK_END 2
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Files are read in chunks of this number of bytes. */
|
|
|
|
|
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
enum { READ_CHUNK_SIZE = 100 * 1024 };
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
/* Value is true if strings X and Y compare equal. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
streq (char const *x, char const *y)
|
|
|
|
|
{
|
|
|
|
|
return strcmp (x, y) == 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
filename_eq (char const *x, char const *y)
|
|
|
|
|
{
|
|
|
|
|
#ifdef __MSDOS__
|
|
|
|
|
return strcasecmp (x, y) == 0;
|
|
|
|
|
#elif defined WINDOWSNT
|
|
|
|
|
return stricmp (x, y) == 0;
|
2000-06-11 20:35:07 +00:00
|
|
|
|
#else
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
return streq (x, y);
|
2000-06-11 20:35:07 +00:00
|
|
|
|
#endif
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* The default output file name. */
|
|
|
|
|
|
2000-05-04 21:48:52 +00:00
|
|
|
|
#define DEFAULT_OUTFILE "BROWSE"
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* A version string written to the output file. Change this whenever
|
|
|
|
|
the structure of the output file changes. */
|
|
|
|
|
|
|
|
|
|
#define EBROWSE_FILE_VERSION "ebrowse 5.0"
|
|
|
|
|
|
|
|
|
|
/* The output file consists of a tree of Lisp objects, with major
|
|
|
|
|
nodes built out of Lisp structures. These are the heads of the
|
|
|
|
|
Lisp structs with symbols identifying their type. */
|
|
|
|
|
|
|
|
|
|
#define TREE_HEADER_STRUCT "[ebrowse-hs "
|
|
|
|
|
#define TREE_STRUCT "[ebrowse-ts "
|
|
|
|
|
#define MEMBER_STRUCT "[ebrowse-ms "
|
|
|
|
|
#define CLASS_STRUCT "[ebrowse-cs "
|
|
|
|
|
|
|
|
|
|
/* The name of the symbol table entry for global functions, variables,
|
|
|
|
|
defines etc. This name also appears in the browser display. */
|
|
|
|
|
|
|
|
|
|
#define GLOBALS_NAME "*Globals*"
|
|
|
|
|
|
|
|
|
|
/* Token definitions. */
|
|
|
|
|
|
|
|
|
|
enum token
|
|
|
|
|
{
|
|
|
|
|
YYEOF = 0, /* end of file */
|
|
|
|
|
CSTRING = 256, /* string constant */
|
|
|
|
|
CCHAR, /* character constant */
|
|
|
|
|
CINT, /* integral constant */
|
|
|
|
|
CFLOAT, /* real constant */
|
|
|
|
|
|
|
|
|
|
ELLIPSIS, /* ... */
|
|
|
|
|
LSHIFTASGN, /* <<= */
|
|
|
|
|
RSHIFTASGN, /* >>= */
|
|
|
|
|
ARROWSTAR, /* ->* */
|
|
|
|
|
IDENT, /* identifier */
|
|
|
|
|
DIVASGN, /* /= */
|
|
|
|
|
INC, /* ++ */
|
|
|
|
|
ADDASGN, /* += */
|
|
|
|
|
DEC, /* -- */
|
|
|
|
|
ARROW, /* -> */
|
|
|
|
|
SUBASGN, /* -= */
|
|
|
|
|
MULASGN, /* *= */
|
|
|
|
|
MODASGN, /* %= */
|
|
|
|
|
LOR, /* || */
|
|
|
|
|
ORASGN, /* |= */
|
|
|
|
|
LAND, /* && */
|
|
|
|
|
ANDASGN, /* &= */
|
|
|
|
|
XORASGN, /* ^= */
|
|
|
|
|
POINTSTAR, /* .* */
|
|
|
|
|
DCOLON, /* :: */
|
|
|
|
|
EQ, /* == */
|
|
|
|
|
NE, /* != */
|
|
|
|
|
LE, /* <= */
|
|
|
|
|
LSHIFT, /* << */
|
|
|
|
|
GE, /* >= */
|
|
|
|
|
RSHIFT, /* >> */
|
|
|
|
|
|
|
|
|
|
/* Keywords. The undef's are there because these
|
|
|
|
|
three symbols are very likely to be defined somewhere. */
|
|
|
|
|
#undef BOOL
|
|
|
|
|
#undef TRUE
|
|
|
|
|
#undef FALSE
|
|
|
|
|
|
|
|
|
|
ASM, /* asm */
|
|
|
|
|
AUTO, /* auto */
|
|
|
|
|
BREAK, /* break */
|
|
|
|
|
CASE, /* case */
|
|
|
|
|
CATCH, /* catch */
|
|
|
|
|
CHAR, /* char */
|
|
|
|
|
CLASS, /* class */
|
|
|
|
|
CONST, /* const */
|
|
|
|
|
CONTINUE, /* continue */
|
|
|
|
|
DEFAULT, /* default */
|
|
|
|
|
DELETE, /* delete */
|
|
|
|
|
DO, /* do */
|
|
|
|
|
DOUBLE, /* double */
|
|
|
|
|
ELSE, /* else */
|
|
|
|
|
ENUM, /* enum */
|
|
|
|
|
EXTERN, /* extern */
|
|
|
|
|
FLOAT, /* float */
|
|
|
|
|
FOR, /* for */
|
|
|
|
|
FRIEND, /* friend */
|
|
|
|
|
GOTO, /* goto */
|
|
|
|
|
IF, /* if */
|
|
|
|
|
T_INLINE, /* inline */
|
|
|
|
|
INT, /* int */
|
|
|
|
|
LONG, /* long */
|
|
|
|
|
NEW, /* new */
|
|
|
|
|
OPERATOR, /* operator */
|
|
|
|
|
PRIVATE, /* private */
|
|
|
|
|
PROTECTED, /* protected */
|
|
|
|
|
PUBLIC, /* public */
|
|
|
|
|
REGISTER, /* register */
|
|
|
|
|
RETURN, /* return */
|
|
|
|
|
SHORT, /* short */
|
|
|
|
|
SIGNED, /* signed */
|
|
|
|
|
SIZEOF, /* sizeof */
|
|
|
|
|
STATIC, /* static */
|
|
|
|
|
STRUCT, /* struct */
|
|
|
|
|
SWITCH, /* switch */
|
|
|
|
|
TEMPLATE, /* template */
|
|
|
|
|
THIS, /* this */
|
|
|
|
|
THROW, /* throw */
|
|
|
|
|
TRY, /* try */
|
|
|
|
|
TYPEDEF, /* typedef */
|
|
|
|
|
UNION, /* union */
|
|
|
|
|
UNSIGNED, /* unsigned */
|
|
|
|
|
VIRTUAL, /* virtual */
|
|
|
|
|
VOID, /* void */
|
|
|
|
|
VOLATILE, /* volatile */
|
|
|
|
|
WHILE, /* while */
|
|
|
|
|
MUTABLE, /* mutable */
|
|
|
|
|
BOOL, /* bool */
|
|
|
|
|
TRUE, /* true */
|
|
|
|
|
FALSE, /* false */
|
|
|
|
|
SIGNATURE, /* signature (GNU extension) */
|
|
|
|
|
NAMESPACE, /* namespace */
|
|
|
|
|
EXPLICIT, /* explicit */
|
|
|
|
|
TYPENAME, /* typename */
|
|
|
|
|
CONST_CAST, /* const_cast */
|
|
|
|
|
DYNAMIC_CAST, /* dynamic_cast */
|
|
|
|
|
REINTERPRET_CAST, /* reinterpret_cast */
|
|
|
|
|
STATIC_CAST, /* static_cast */
|
|
|
|
|
TYPEID, /* typeid */
|
|
|
|
|
USING, /* using */
|
2019-01-03 12:07:05 +00:00
|
|
|
|
WCHAR, /* wchar_t */
|
|
|
|
|
FINAL /* final */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Storage classes, in a wider sense. */
|
|
|
|
|
|
|
|
|
|
enum sc
|
|
|
|
|
{
|
|
|
|
|
SC_UNKNOWN,
|
|
|
|
|
SC_MEMBER, /* Is an instance member. */
|
|
|
|
|
SC_STATIC, /* Is static member. */
|
|
|
|
|
SC_FRIEND, /* Is friend function. */
|
|
|
|
|
SC_TYPE /* Is a type definition. */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Member visibility. */
|
|
|
|
|
|
|
|
|
|
enum visibility
|
|
|
|
|
{
|
|
|
|
|
V_PUBLIC,
|
|
|
|
|
V_PROTECTED,
|
|
|
|
|
V_PRIVATE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Member flags. */
|
|
|
|
|
|
|
|
|
|
#define F_VIRTUAL 1 /* Is virtual function. */
|
|
|
|
|
#define F_INLINE 2 /* Is inline function. */
|
|
|
|
|
#define F_CONST 4 /* Is const. */
|
|
|
|
|
#define F_PURE 8 /* Is pure virtual function. */
|
|
|
|
|
#define F_MUTABLE 16 /* Is mutable. */
|
|
|
|
|
#define F_TEMPLATE 32 /* Is a template. */
|
|
|
|
|
#define F_EXPLICIT 64 /* Is explicit constructor. */
|
|
|
|
|
#define F_THROW 128 /* Has a throw specification. */
|
|
|
|
|
#define F_EXTERNC 256 /* Is declared extern "C". */
|
|
|
|
|
#define F_DEFINE 512 /* Is a #define. */
|
|
|
|
|
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
/* Set and test a bit in an int. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
static void
|
|
|
|
|
set_flag (int *f, int flag)
|
|
|
|
|
{
|
|
|
|
|
*f |= flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
has_flag (int f, int flag)
|
|
|
|
|
{
|
|
|
|
|
return (f & flag) != 0;
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Structure describing a class member. */
|
|
|
|
|
|
|
|
|
|
struct member
|
|
|
|
|
{
|
|
|
|
|
struct member *next; /* Next in list of members. */
|
|
|
|
|
struct member *anext; /* Collision chain in member_table. */
|
|
|
|
|
struct member **list; /* Pointer to list in class. */
|
|
|
|
|
unsigned param_hash; /* Hash value for parameter types. */
|
|
|
|
|
int vis; /* Visibility (public, ...). */
|
|
|
|
|
int flags; /* See F_* above. */
|
|
|
|
|
char *regexp; /* Matching regular expression. */
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
const char *filename; /* Don't free this shared string. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
int pos; /* Buffer position of occurrence. */
|
|
|
|
|
char *def_regexp; /* Regular expression matching definition. */
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
const char *def_filename; /* File name of definition. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
int def_pos; /* Buffer position of definition. */
|
Use C99-style flexible array members if available.
This avoids some subtle aliasing issues, which typically
aren't a problem with GCC but may be a problem elsewhere.
* lib-src/ebrowse.c (struct member, struct alias, struct sym):
Use FLEXIBLE_ARRAY_MEMBER.
(add_sym, add_member, make_namespace, register_namespace_alias):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/alloc.c (sdata): New typedef, replacing the old struct sdata.
It is a struct if GC_CHECK_STRING_BYTES, a union otherwise.
In either case, it uses a flexible array member rather than
the old struct hack. All uses changed.
(SDATA_NBYTES, sweep_strings) [!GC_CHECK_STRING_BYTES]:
Adjust to sdata reorganization.
* src/alloc.c (VBLOCK_BYTES_MIN, allocate_vectorlike, Fgarbage_collect):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/chartab.c (Fmake_char_table, make_sub_char_table, copy_char_table):
Use CHAR_TABLE_STANDARD_SLOTS rather than its definition,
as the latter has changed.
* src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Move here from w32.c,
and port better to pre-C99 GCC.
* src/image.c (struct xpm_cached_color):
* src/lisp.h (struct Lisp_Vector, struct Lisp_Bool_Vector)
(struct Lisp_Char_Table, struct Lisp_Sub_Char_Table):
Use FLEXIBLE_ARRAY_MEMBER.
* src/lisp.h (string_bytes) [GC_CHECK_STRING_BYTES]:
Move decl to top level so it gets checked against implementation.
(CHAR_TABLE_STANDARD_SLOTS): Adjust to struct Lisp_Char_Table change.
* src/w32.c (FLEXIBLE_ARRAY_MEMBER): Move to conf_post.h.
2013-06-21 20:11:44 +00:00
|
|
|
|
char name[FLEXIBLE_ARRAY_MEMBER]; /* Member name. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Structures of this type are used to connect class structures with
|
|
|
|
|
their super and subclasses. */
|
|
|
|
|
|
|
|
|
|
struct link
|
|
|
|
|
{
|
|
|
|
|
struct sym *sym; /* The super or subclass. */
|
|
|
|
|
struct link *next; /* Next in list or NULL. */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Structure used to record namespace aliases. */
|
|
|
|
|
|
|
|
|
|
struct alias
|
|
|
|
|
{
|
|
|
|
|
struct alias *next; /* Next in list. */
|
2001-10-01 07:25:14 +00:00
|
|
|
|
struct sym *namesp; /* Namespace in which defined. */
|
|
|
|
|
struct link *aliasee; /* List of aliased namespaces (A::B::C...). */
|
Use C99-style flexible array members if available.
This avoids some subtle aliasing issues, which typically
aren't a problem with GCC but may be a problem elsewhere.
* lib-src/ebrowse.c (struct member, struct alias, struct sym):
Use FLEXIBLE_ARRAY_MEMBER.
(add_sym, add_member, make_namespace, register_namespace_alias):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/alloc.c (sdata): New typedef, replacing the old struct sdata.
It is a struct if GC_CHECK_STRING_BYTES, a union otherwise.
In either case, it uses a flexible array member rather than
the old struct hack. All uses changed.
(SDATA_NBYTES, sweep_strings) [!GC_CHECK_STRING_BYTES]:
Adjust to sdata reorganization.
* src/alloc.c (VBLOCK_BYTES_MIN, allocate_vectorlike, Fgarbage_collect):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/chartab.c (Fmake_char_table, make_sub_char_table, copy_char_table):
Use CHAR_TABLE_STANDARD_SLOTS rather than its definition,
as the latter has changed.
* src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Move here from w32.c,
and port better to pre-C99 GCC.
* src/image.c (struct xpm_cached_color):
* src/lisp.h (struct Lisp_Vector, struct Lisp_Bool_Vector)
(struct Lisp_Char_Table, struct Lisp_Sub_Char_Table):
Use FLEXIBLE_ARRAY_MEMBER.
* src/lisp.h (string_bytes) [GC_CHECK_STRING_BYTES]:
Move decl to top level so it gets checked against implementation.
(CHAR_TABLE_STANDARD_SLOTS): Adjust to struct Lisp_Char_Table change.
* src/w32.c (FLEXIBLE_ARRAY_MEMBER): Move to conf_post.h.
2013-06-21 20:11:44 +00:00
|
|
|
|
char name[FLEXIBLE_ARRAY_MEMBER]; /* Alias name. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* The structure used to describe a class in the symbol table,
|
|
|
|
|
or a namespace in all_namespaces. */
|
|
|
|
|
|
|
|
|
|
struct sym
|
|
|
|
|
{
|
|
|
|
|
int flags; /* Is class a template class?. */
|
|
|
|
|
unsigned char visited; /* Used to find circles. */
|
|
|
|
|
struct sym *next; /* Hash collision list. */
|
|
|
|
|
struct link *subs; /* List of subclasses. */
|
|
|
|
|
struct link *supers; /* List of superclasses. */
|
|
|
|
|
struct member *vars; /* List of instance variables. */
|
|
|
|
|
struct member *fns; /* List of instance functions. */
|
|
|
|
|
struct member *static_vars; /* List of static variables. */
|
|
|
|
|
struct member *static_fns; /* List of static functions. */
|
|
|
|
|
struct member *friends; /* List of friend functions. */
|
|
|
|
|
struct member *types; /* List of local types. */
|
|
|
|
|
char *regexp; /* Matching regular expression. */
|
|
|
|
|
int pos; /* Buffer position. */
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
const char *filename; /* File in which it can be found. */
|
|
|
|
|
const char *sfilename; /* File in which members can be found. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
struct sym *namesp; /* Namespace in which defined. . */
|
Use C99-style flexible array members if available.
This avoids some subtle aliasing issues, which typically
aren't a problem with GCC but may be a problem elsewhere.
* lib-src/ebrowse.c (struct member, struct alias, struct sym):
Use FLEXIBLE_ARRAY_MEMBER.
(add_sym, add_member, make_namespace, register_namespace_alias):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/alloc.c (sdata): New typedef, replacing the old struct sdata.
It is a struct if GC_CHECK_STRING_BYTES, a union otherwise.
In either case, it uses a flexible array member rather than
the old struct hack. All uses changed.
(SDATA_NBYTES, sweep_strings) [!GC_CHECK_STRING_BYTES]:
Adjust to sdata reorganization.
* src/alloc.c (VBLOCK_BYTES_MIN, allocate_vectorlike, Fgarbage_collect):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/chartab.c (Fmake_char_table, make_sub_char_table, copy_char_table):
Use CHAR_TABLE_STANDARD_SLOTS rather than its definition,
as the latter has changed.
* src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Move here from w32.c,
and port better to pre-C99 GCC.
* src/image.c (struct xpm_cached_color):
* src/lisp.h (struct Lisp_Vector, struct Lisp_Bool_Vector)
(struct Lisp_Char_Table, struct Lisp_Sub_Char_Table):
Use FLEXIBLE_ARRAY_MEMBER.
* src/lisp.h (string_bytes) [GC_CHECK_STRING_BYTES]:
Move decl to top level so it gets checked against implementation.
(CHAR_TABLE_STANDARD_SLOTS): Adjust to struct Lisp_Char_Table change.
* src/w32.c (FLEXIBLE_ARRAY_MEMBER): Move to conf_post.h.
2013-06-21 20:11:44 +00:00
|
|
|
|
char name[FLEXIBLE_ARRAY_MEMBER]; /* Name of the class. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Experimental: Print info for `--position-info'. We print
|
|
|
|
|
'(CLASS-NAME SCOPE MEMBER-NAME). */
|
|
|
|
|
|
|
|
|
|
#define P_DEFN 1
|
|
|
|
|
#define P_DECL 2
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static int info_where;
|
|
|
|
|
static struct sym *info_cls = NULL;
|
|
|
|
|
static struct member *info_member = NULL;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Experimental. For option `--position-info', the buffer position we
|
|
|
|
|
are interested in. When this position is reached, print out
|
|
|
|
|
information about what we know about that point. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static int info_position = -1;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Command line options structure for getopt_long. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct option const options[] =
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
{"append", no_argument, NULL, 'a'},
|
|
|
|
|
{"files", required_argument, NULL, 'f'},
|
|
|
|
|
{"help", no_argument, NULL, -2},
|
|
|
|
|
{"min-regexp-length", required_argument, NULL, 'm'},
|
|
|
|
|
{"max-regexp-length", required_argument, NULL, 'M'},
|
|
|
|
|
{"no-nested-classes", no_argument, NULL, 'n'},
|
|
|
|
|
{"no-regexps", no_argument, NULL, 'x'},
|
|
|
|
|
{"no-structs-or-unions", no_argument, NULL, 's'},
|
|
|
|
|
{"output-file", required_argument, NULL, 'o'},
|
|
|
|
|
{"position-info", required_argument, NULL, 'p'},
|
|
|
|
|
{"search-path", required_argument, NULL, 'I'},
|
|
|
|
|
{"verbose", no_argument, NULL, 'v'},
|
|
|
|
|
{"version", no_argument, NULL, -3},
|
|
|
|
|
{"very-verbose", no_argument, NULL, 'V'},
|
|
|
|
|
{NULL, 0, NULL, 0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Semantic values of tokens. Set by yylex.. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static unsigned yyival; /* Set for token CINT. */
|
|
|
|
|
static char *yytext; /* Set for token IDENT. */
|
|
|
|
|
static char *yytext_end;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Output file. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static FILE *yyout;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Current line number. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static int yyline;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* The name of the current input file. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static const char *filename;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Three character class vectors, and macros to test membership
|
|
|
|
|
of characters. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static char is_ident[255];
|
|
|
|
|
static char is_digit[255];
|
|
|
|
|
static char is_white[255];
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
#define IDENTP(C) is_ident[(unsigned char) (C)]
|
|
|
|
|
#define DIGITP(C) is_digit[(unsigned char) (C)]
|
|
|
|
|
#define WHITEP(C) is_white[(unsigned char) (C)]
|
|
|
|
|
|
|
|
|
|
/* Command line flags. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static int f_append;
|
|
|
|
|
static int f_verbose;
|
|
|
|
|
static int f_very_verbose;
|
|
|
|
|
static int f_structs = 1;
|
|
|
|
|
static int f_regexps = 1;
|
|
|
|
|
static int f_nested_classes = 1;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Maximum and minimum lengths of regular expressions matching a
|
|
|
|
|
member, class etc., for writing them to the output file. These are
|
|
|
|
|
overridable from the command line. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static int min_regexp = 5;
|
|
|
|
|
static int max_regexp = 50;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Input buffer. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static char *inbuffer;
|
|
|
|
|
static char *in;
|
|
|
|
|
static size_t inbuffer_size;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Return the current buffer position in the input file. */
|
|
|
|
|
|
|
|
|
|
#define BUFFER_POS() (in - inbuffer)
|
|
|
|
|
|
2001-12-19 06:03:57 +00:00
|
|
|
|
/* If current lookahead is CSTRING, the following points to the
|
2000-04-09 11:15:57 +00:00
|
|
|
|
first character in the string constant. Used for recognizing
|
|
|
|
|
extern "C". */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static char *string_start;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* The size of the hash tables for classes.and members. Should be
|
|
|
|
|
prime. */
|
|
|
|
|
|
|
|
|
|
#define TABLE_SIZE 1001
|
|
|
|
|
|
|
|
|
|
/* The hash table for class symbols. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct sym *class_table[TABLE_SIZE];
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Hash table containing all member structures. This is generally
|
|
|
|
|
faster for member lookup than traversing the member lists of a
|
|
|
|
|
`struct sym'. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct member *member_table[TABLE_SIZE];
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2001-10-01 07:25:14 +00:00
|
|
|
|
/* Hash table for namespace aliases */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct alias *namespace_alias_table[TABLE_SIZE];
|
2001-10-01 07:25:14 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* The special class symbol used to hold global functions,
|
|
|
|
|
variables etc. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct sym *global_symbols;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* The current namespace. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct sym *current_namespace;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* The list of all known namespaces. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct sym *all_namespaces;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Stack of namespaces we're currently nested in, during the parse. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct sym **namespace_stack;
|
|
|
|
|
static int namespace_stack_size;
|
|
|
|
|
static int namespace_sp;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* The current lookahead token. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static int tk = -1;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Structure describing a keyword. */
|
|
|
|
|
|
|
|
|
|
struct kw
|
|
|
|
|
{
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
const char *name; /* Spelling. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
int tk; /* Token value. */
|
|
|
|
|
struct kw *next; /* Next in collision chain. */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Keywords are lookup up in a hash table of their own. */
|
|
|
|
|
|
|
|
|
|
#define KEYWORD_TABLE_SIZE 1001
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct kw *keyword_table[KEYWORD_TABLE_SIZE];
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Search path. */
|
|
|
|
|
|
|
|
|
|
struct search_path
|
|
|
|
|
{
|
|
|
|
|
char *path;
|
|
|
|
|
struct search_path *next;
|
|
|
|
|
};
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static struct search_path *search_path;
|
|
|
|
|
static struct search_path *search_path_tail;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Function prototypes. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *matching_regexp (void);
|
|
|
|
|
static struct sym *add_sym (const char *, struct sym *);
|
|
|
|
|
static void add_global_defn (char *, char *, int, unsigned, int, int, int);
|
|
|
|
|
static void add_global_decl (char *, char *, int, unsigned, int, int, int);
|
|
|
|
|
static struct member *add_member (struct sym *, char *, int, int, unsigned);
|
2019-01-03 12:07:05 +00:00
|
|
|
|
static void class_definition (struct sym *, const char *, int, int, int);
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *operator_name (int *);
|
|
|
|
|
static void parse_qualified_param_ident_or_type (char **);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
Utilities
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Print an error in a printf-like style with the current input file
|
|
|
|
|
name and line number. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
yyerror (const char *format, const char *s)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "%s:%d: ", filename, yyline);
|
2001-01-02 14:32:37 +00:00
|
|
|
|
fprintf (stderr, format, s);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
putc ('\n', stderr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Like malloc but print an error and exit if not enough memory is
|
2000-11-10 19:43:55 +00:00
|
|
|
|
available. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2018-04-28 23:49:24 +00:00
|
|
|
|
static void * ATTRIBUTE_MALLOC
|
2011-03-21 18:03:15 +00:00
|
|
|
|
xmalloc (size_t nbytes)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
void *p = malloc (nbytes);
|
2000-04-19 14:30:52 +00:00
|
|
|
|
if (p == NULL)
|
|
|
|
|
{
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("out of memory", NULL);
|
2004-05-08 15:26:33 +00:00
|
|
|
|
exit (EXIT_FAILURE);
|
2000-04-19 14:30:52 +00:00
|
|
|
|
}
|
|
|
|
|
return p;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Like realloc but print an error and exit if out of memory. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void *
|
2011-03-21 18:03:15 +00:00
|
|
|
|
xrealloc (void *p, size_t sz)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
p = realloc (p, sz);
|
2000-04-19 14:30:52 +00:00
|
|
|
|
if (p == NULL)
|
|
|
|
|
{
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("out of memory", NULL);
|
2004-05-08 15:26:33 +00:00
|
|
|
|
exit (EXIT_FAILURE);
|
2000-04-19 14:30:52 +00:00
|
|
|
|
}
|
|
|
|
|
return p;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Like strdup, but print an error and exit if not enough memory is
|
|
|
|
|
available.. If S is null, return null. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
xstrdup (char *s)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (s)
|
2013-11-14 01:52:18 +00:00
|
|
|
|
return strcpy (xmalloc (strlen (s) + 1), s);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
Symbols
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Initialize the symbol table. This currently only sets up the
|
|
|
|
|
special symbol for globals (`*Globals*'). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
init_sym (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
global_symbols = add_sym (GLOBALS_NAME, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add a symbol for class NAME to the symbol table. NESTED_IN_CLASS
|
|
|
|
|
is the class in which class NAME was found. If it is null,
|
|
|
|
|
this means the scope of NAME is the current namespace.
|
|
|
|
|
|
|
|
|
|
If a symbol for NAME already exists, return that. Otherwise
|
|
|
|
|
create a new symbol and set it to default values. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct sym *
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
add_sym (const char *name, struct sym *nested_in_class)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct sym *sym;
|
|
|
|
|
unsigned h;
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
const char *s;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
struct sym *scope = nested_in_class ? nested_in_class : current_namespace;
|
|
|
|
|
|
|
|
|
|
for (s = name, h = 0; *s; ++s)
|
|
|
|
|
h = (h << 1) ^ *s;
|
|
|
|
|
h %= TABLE_SIZE;
|
|
|
|
|
|
|
|
|
|
for (sym = class_table[h]; sym; sym = sym->next)
|
2005-09-20 13:19:29 +00:00
|
|
|
|
if (streq (name, sym->name)
|
|
|
|
|
&& ((!sym->namesp && !scope)
|
|
|
|
|
|| (sym->namesp && scope
|
|
|
|
|
&& streq (sym->namesp->name, scope->name))))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (sym == NULL)
|
|
|
|
|
{
|
|
|
|
|
if (f_very_verbose)
|
|
|
|
|
{
|
|
|
|
|
putchar ('\t');
|
|
|
|
|
puts (name);
|
|
|
|
|
}
|
|
|
|
|
|
Port flexible array members to GCC + valgrind
These changes are needed to conform to the C standard's rule for
allocating structs containing flexible array members. C11 says
that malloc (offsetof (struct s, m) + n) does not suffice to
allocate a struct with an n-byte tail; instead, malloc’s arg
should be rounded up to the nearest multiple of alignof (struct s).
Although this is arguably a defect in C11, gcc -O2 + valgrind
sometimes complains when this rule is violated, and when debugging
it’s better to keep valgrind happy.
For details please see the thread containing the message at:
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00416.html
* lib-src/ebrowse.c, src/alloc.c, src/image.c, src/process.c:
Include flexmember.h.
* lib-src/ebrowse.c (add_sym, add_member, make_namespace)
(register_namespace_alias):
* src/alloc.c (SDATA_SIZE, allocate_string_data):
* src/image.c (xpm_cache_color, imagemagick_create_cache):
* src/process.c (Fmake_network_process):
Use FLEXSIZEOF instead of offsetof and addition.
* src/alloc.c (SDATA_SIZE, vector_alignment):
Use FLEXALIGNOF instead of sizeof (ptrdiff_t).
* src/lisp.h (ALIGNOF_STRUCT_LISP_VECTOR):
Remove, as alloc.c can now calculate this on its own.
2016-09-08 01:08:45 +00:00
|
|
|
|
sym = xmalloc (FLEXSIZEOF (struct sym, name, strlen (name) + 1));
|
Use C99-style flexible array members if available.
This avoids some subtle aliasing issues, which typically
aren't a problem with GCC but may be a problem elsewhere.
* lib-src/ebrowse.c (struct member, struct alias, struct sym):
Use FLEXIBLE_ARRAY_MEMBER.
(add_sym, add_member, make_namespace, register_namespace_alias):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/alloc.c (sdata): New typedef, replacing the old struct sdata.
It is a struct if GC_CHECK_STRING_BYTES, a union otherwise.
In either case, it uses a flexible array member rather than
the old struct hack. All uses changed.
(SDATA_NBYTES, sweep_strings) [!GC_CHECK_STRING_BYTES]:
Adjust to sdata reorganization.
* src/alloc.c (VBLOCK_BYTES_MIN, allocate_vectorlike, Fgarbage_collect):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/chartab.c (Fmake_char_table, make_sub_char_table, copy_char_table):
Use CHAR_TABLE_STANDARD_SLOTS rather than its definition,
as the latter has changed.
* src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Move here from w32.c,
and port better to pre-C99 GCC.
* src/image.c (struct xpm_cached_color):
* src/lisp.h (struct Lisp_Vector, struct Lisp_Bool_Vector)
(struct Lisp_Char_Table, struct Lisp_Sub_Char_Table):
Use FLEXIBLE_ARRAY_MEMBER.
* src/lisp.h (string_bytes) [GC_CHECK_STRING_BYTES]:
Move decl to top level so it gets checked against implementation.
(CHAR_TABLE_STANDARD_SLOTS): Adjust to struct Lisp_Char_Table change.
* src/w32.c (FLEXIBLE_ARRAY_MEMBER): Move to conf_post.h.
2013-06-21 20:11:44 +00:00
|
|
|
|
memset (sym, 0, offsetof (struct sym, name));
|
2000-04-09 11:15:57 +00:00
|
|
|
|
strcpy (sym->name, name);
|
|
|
|
|
sym->namesp = scope;
|
|
|
|
|
sym->next = class_table[h];
|
|
|
|
|
class_table[h] = sym;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sym;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add links between superclass SUPER and subclass SUB. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_link (struct sym *super, struct sym *sub)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct link *lnk, *lnk2, *p, *prev;
|
|
|
|
|
|
|
|
|
|
/* See if a link already exists. */
|
|
|
|
|
for (p = super->subs, prev = NULL;
|
|
|
|
|
p && strcmp (sub->name, p->sym->name) > 0;
|
|
|
|
|
prev = p, p = p->next)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Avoid duplicates. */
|
|
|
|
|
if (p == NULL || p->sym != sub)
|
|
|
|
|
{
|
2000-07-14 17:59:55 +00:00
|
|
|
|
lnk = (struct link *) xmalloc (sizeof *lnk);
|
|
|
|
|
lnk2 = (struct link *) xmalloc (sizeof *lnk2);
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
lnk->sym = sub;
|
|
|
|
|
lnk->next = p;
|
|
|
|
|
|
|
|
|
|
if (prev)
|
|
|
|
|
prev->next = lnk;
|
|
|
|
|
else
|
|
|
|
|
super->subs = lnk;
|
|
|
|
|
|
|
|
|
|
lnk2->sym = super;
|
|
|
|
|
lnk2->next = sub->supers;
|
|
|
|
|
sub->supers = lnk2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Find in class CLS member NAME.
|
|
|
|
|
|
|
|
|
|
VAR non-zero means look for a member variable; otherwise a function
|
|
|
|
|
is searched. SC specifies what kind of member is searched---a
|
|
|
|
|
static, or per-instance member etc. HASH is a hash code for the
|
|
|
|
|
parameter types of functions. Value is a pointer to the member
|
|
|
|
|
found or null if not found. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct member *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct member **list;
|
|
|
|
|
struct member *p;
|
|
|
|
|
unsigned name_hash = 0;
|
|
|
|
|
char *s;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
switch (sc)
|
|
|
|
|
{
|
|
|
|
|
case SC_FRIEND:
|
|
|
|
|
list = &cls->friends;
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case SC_TYPE:
|
|
|
|
|
list = &cls->types;
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case SC_STATIC:
|
|
|
|
|
list = var ? &cls->static_vars : &cls->static_fns;
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
default:
|
|
|
|
|
list = var ? &cls->vars : &cls->fns;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (s = name; *s; ++s)
|
|
|
|
|
name_hash = (name_hash << 1) ^ *s;
|
|
|
|
|
i = name_hash % TABLE_SIZE;
|
|
|
|
|
|
|
|
|
|
for (p = member_table[i]; p; p = p->anext)
|
|
|
|
|
if (p->list == list && p->param_hash == hash && streq (name, p->name))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add to class CLS information for the declaration of member NAME.
|
|
|
|
|
REGEXP is a regexp matching the declaration, if non-null. POS is
|
|
|
|
|
the position in the source where the declaration is found. HASH is
|
|
|
|
|
a hash code for the parameter list of the member, if it's a
|
|
|
|
|
function. VAR non-zero means member is a variable or type. SC
|
|
|
|
|
specifies the type of member (instance member, static, ...). VIS
|
|
|
|
|
is the member's visibility (public, protected, private). FLAGS is
|
|
|
|
|
a bit set giving additional information about the member (see the
|
|
|
|
|
F_* defines). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct member *m;
|
|
|
|
|
|
|
|
|
|
m = find_member (cls, name, var, sc, hash);
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
m = add_member (cls, name, var, sc, hash);
|
|
|
|
|
|
|
|
|
|
/* Have we seen a new filename? If so record that. */
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
if (!cls->filename || !filename_eq (cls->filename, filename))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
m->filename = filename;
|
|
|
|
|
|
|
|
|
|
m->regexp = regexp;
|
|
|
|
|
m->pos = pos;
|
|
|
|
|
m->flags = flags;
|
|
|
|
|
|
|
|
|
|
switch (vis)
|
|
|
|
|
{
|
|
|
|
|
case PRIVATE:
|
|
|
|
|
m->vis = V_PRIVATE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PROTECTED:
|
|
|
|
|
m->vis = V_PROTECTED;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PUBLIC:
|
|
|
|
|
m->vis = V_PUBLIC;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info_where = P_DECL;
|
|
|
|
|
info_cls = cls;
|
|
|
|
|
info_member = m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add to class CLS information for the definition of member NAME.
|
|
|
|
|
REGEXP is a regexp matching the declaration, if non-null. POS is
|
|
|
|
|
the position in the source where the declaration is found. HASH is
|
|
|
|
|
a hash code for the parameter list of the member, if it's a
|
|
|
|
|
function. VAR non-zero means member is a variable or type. SC
|
|
|
|
|
specifies the type of member (instance member, static, ...). VIS
|
|
|
|
|
is the member's visibility (public, protected, private). FLAGS is
|
|
|
|
|
a bit set giving additional information about the member (see the
|
|
|
|
|
F_* defines). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct member *m;
|
|
|
|
|
|
|
|
|
|
if (sc == SC_UNKNOWN)
|
|
|
|
|
{
|
|
|
|
|
m = find_member (cls, name, var, SC_MEMBER, hash);
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
{
|
|
|
|
|
m = find_member (cls, name, var, SC_STATIC, hash);
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
m = add_member (cls, name, var, sc, hash);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m = find_member (cls, name, var, sc, hash);
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
m = add_member (cls, name, var, sc, hash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!cls->sfilename)
|
|
|
|
|
cls->sfilename = filename;
|
|
|
|
|
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
if (!filename_eq (cls->sfilename, filename))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
m->def_filename = filename;
|
|
|
|
|
|
|
|
|
|
m->def_regexp = regexp;
|
|
|
|
|
m->def_pos = pos;
|
|
|
|
|
m->flags |= flags;
|
|
|
|
|
|
|
|
|
|
info_where = P_DEFN;
|
|
|
|
|
info_cls = cls;
|
|
|
|
|
info_member = m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add a symbol for a define named NAME to the symbol table.
|
|
|
|
|
REGEXP is a regular expression matching the define in the source,
|
|
|
|
|
if it is non-null. POS is the position in the file. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_define (char *name, char *regexp, int pos)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
|
|
|
|
|
add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add information for the global definition of NAME.
|
|
|
|
|
REGEXP is a regexp matching the declaration, if non-null. POS is
|
|
|
|
|
the position in the source where the declaration is found. HASH is
|
|
|
|
|
a hash code for the parameter list of the member, if it's a
|
|
|
|
|
function. VAR non-zero means member is a variable or type. SC
|
|
|
|
|
specifies the type of member (instance member, static, ...). VIS
|
|
|
|
|
is the member's visibility (public, protected, private). FLAGS is
|
|
|
|
|
a bit set giving additional information about the member (see the
|
|
|
|
|
F_* defines). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
struct sym *sym;
|
|
|
|
|
|
|
|
|
|
/* Try to find out for which classes a function is a friend, and add
|
|
|
|
|
what we know about it to them. */
|
|
|
|
|
if (!var)
|
|
|
|
|
for (i = 0; i < TABLE_SIZE; ++i)
|
|
|
|
|
for (sym = class_table[i]; sym; sym = sym->next)
|
|
|
|
|
if (sym != global_symbols && sym->friends)
|
|
|
|
|
if (find_member (sym, name, 0, SC_FRIEND, hash))
|
|
|
|
|
add_member_defn (sym, name, regexp, pos, hash, 0,
|
|
|
|
|
SC_FRIEND, flags);
|
|
|
|
|
|
|
|
|
|
/* Add to global symbols. */
|
|
|
|
|
add_member_defn (global_symbols, name, regexp, pos, hash, var, sc, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add information for the global declaration of NAME.
|
|
|
|
|
REGEXP is a regexp matching the declaration, if non-null. POS is
|
|
|
|
|
the position in the source where the declaration is found. HASH is
|
|
|
|
|
a hash code for the parameter list of the member, if it's a
|
|
|
|
|
function. VAR non-zero means member is a variable or type. SC
|
|
|
|
|
specifies the type of member (instance member, static, ...). VIS
|
|
|
|
|
is the member's visibility (public, protected, private). FLAGS is
|
|
|
|
|
a bit set giving additional information about the member (see the
|
|
|
|
|
F_* defines). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
/* Add declaration only if not already declared. Header files must
|
|
|
|
|
be processed before source files for this to have the right effect.
|
|
|
|
|
I do not want to handle implicit declarations at the moment. */
|
|
|
|
|
struct member *m;
|
|
|
|
|
struct member *found;
|
|
|
|
|
|
|
|
|
|
m = found = find_member (global_symbols, name, var, sc, hash);
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
m = add_member (global_symbols, name, var, sc, hash);
|
|
|
|
|
|
|
|
|
|
/* Definition already seen => probably last declaration implicit.
|
|
|
|
|
Override. This means that declarations must always be added to
|
|
|
|
|
the symbol table before definitions. */
|
|
|
|
|
if (!found)
|
|
|
|
|
{
|
|
|
|
|
if (!global_symbols->filename
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
|| !filename_eq (global_symbols->filename, filename))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
m->filename = filename;
|
|
|
|
|
|
|
|
|
|
m->regexp = regexp;
|
|
|
|
|
m->pos = pos;
|
|
|
|
|
m->vis = V_PUBLIC;
|
|
|
|
|
m->flags = flags;
|
|
|
|
|
|
|
|
|
|
info_where = P_DECL;
|
|
|
|
|
info_cls = global_symbols;
|
|
|
|
|
info_member = m;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add a symbol for member NAME to class CLS.
|
|
|
|
|
VAR non-zero means it's a variable. SC specifies the kind of
|
|
|
|
|
member. HASH is a hash code for the parameter types of a function.
|
|
|
|
|
Value is a pointer to the member's structure. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct member *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
Port flexible array members to GCC + valgrind
These changes are needed to conform to the C standard's rule for
allocating structs containing flexible array members. C11 says
that malloc (offsetof (struct s, m) + n) does not suffice to
allocate a struct with an n-byte tail; instead, malloc’s arg
should be rounded up to the nearest multiple of alignof (struct s).
Although this is arguably a defect in C11, gcc -O2 + valgrind
sometimes complains when this rule is violated, and when debugging
it’s better to keep valgrind happy.
For details please see the thread containing the message at:
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00416.html
* lib-src/ebrowse.c, src/alloc.c, src/image.c, src/process.c:
Include flexmember.h.
* lib-src/ebrowse.c (add_sym, add_member, make_namespace)
(register_namespace_alias):
* src/alloc.c (SDATA_SIZE, allocate_string_data):
* src/image.c (xpm_cache_color, imagemagick_create_cache):
* src/process.c (Fmake_network_process):
Use FLEXSIZEOF instead of offsetof and addition.
* src/alloc.c (SDATA_SIZE, vector_alignment):
Use FLEXALIGNOF instead of sizeof (ptrdiff_t).
* src/lisp.h (ALIGNOF_STRUCT_LISP_VECTOR):
Remove, as alloc.c can now calculate this on its own.
2016-09-08 01:08:45 +00:00
|
|
|
|
struct member *m = xmalloc (FLEXSIZEOF (struct member, name,
|
|
|
|
|
strlen (name) + 1));
|
2000-04-09 11:15:57 +00:00
|
|
|
|
struct member **list;
|
|
|
|
|
struct member *p;
|
|
|
|
|
struct member *prev;
|
|
|
|
|
unsigned name_hash = 0;
|
|
|
|
|
int i;
|
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
|
|
strcpy (m->name, name);
|
|
|
|
|
m->param_hash = hash;
|
|
|
|
|
|
|
|
|
|
m->vis = 0;
|
|
|
|
|
m->flags = 0;
|
|
|
|
|
m->regexp = NULL;
|
|
|
|
|
m->filename = NULL;
|
|
|
|
|
m->pos = 0;
|
|
|
|
|
m->def_regexp = NULL;
|
|
|
|
|
m->def_filename = NULL;
|
|
|
|
|
m->def_pos = 0;
|
|
|
|
|
|
|
|
|
|
assert (cls != NULL);
|
|
|
|
|
|
|
|
|
|
switch (sc)
|
|
|
|
|
{
|
|
|
|
|
case SC_FRIEND:
|
|
|
|
|
list = &cls->friends;
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case SC_TYPE:
|
|
|
|
|
list = &cls->types;
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case SC_STATIC:
|
|
|
|
|
list = var ? &cls->static_vars : &cls->static_fns;
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
default:
|
|
|
|
|
list = var ? &cls->vars : &cls->fns;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (s = name; *s; ++s)
|
|
|
|
|
name_hash = (name_hash << 1) ^ *s;
|
|
|
|
|
i = name_hash % TABLE_SIZE;
|
|
|
|
|
m->anext = member_table[i];
|
|
|
|
|
member_table[i] = m;
|
|
|
|
|
m->list = list;
|
|
|
|
|
|
|
|
|
|
/* Keep the member list sorted. It's cheaper to do it here than to
|
|
|
|
|
sort them in Lisp. */
|
|
|
|
|
for (prev = NULL, p = *list;
|
|
|
|
|
p && strcmp (name, p->name) > 0;
|
|
|
|
|
prev = p, p = p->next)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
m->next = p;
|
|
|
|
|
if (prev)
|
|
|
|
|
prev->next = m;
|
|
|
|
|
else
|
|
|
|
|
*list = m;
|
|
|
|
|
return m;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Given the root R of a class tree, step through all subclasses
|
|
|
|
|
recursively, marking functions as virtual that are declared virtual
|
|
|
|
|
in base classes. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
mark_virtual (struct sym *r)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct link *p;
|
|
|
|
|
struct member *m, *m2;
|
|
|
|
|
|
|
|
|
|
for (p = r->subs; p; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
for (m = r->fns; m; m = m->next)
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
if (has_flag (m->flags, F_VIRTUAL))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
for (m2 = p->sym->fns; m2; m2 = m2->next)
|
|
|
|
|
if (m->param_hash == m2->param_hash && streq (m->name, m2->name))
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&m2->flags, F_VIRTUAL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mark_virtual (p->sym);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* For all roots of the class tree, mark functions as virtual that
|
|
|
|
|
are virtual because of a virtual declaration in a base class. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
mark_inherited_virtual (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct sym *r;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < TABLE_SIZE; ++i)
|
|
|
|
|
for (r = class_table[i]; r; r = r->next)
|
|
|
|
|
if (r->supers == NULL)
|
|
|
|
|
mark_virtual (r);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Create and return a symbol for a namespace with name NAME. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct sym *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
make_namespace (char *name, struct sym *context)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
Port flexible array members to GCC + valgrind
These changes are needed to conform to the C standard's rule for
allocating structs containing flexible array members. C11 says
that malloc (offsetof (struct s, m) + n) does not suffice to
allocate a struct with an n-byte tail; instead, malloc’s arg
should be rounded up to the nearest multiple of alignof (struct s).
Although this is arguably a defect in C11, gcc -O2 + valgrind
sometimes complains when this rule is violated, and when debugging
it’s better to keep valgrind happy.
For details please see the thread containing the message at:
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00416.html
* lib-src/ebrowse.c, src/alloc.c, src/image.c, src/process.c:
Include flexmember.h.
* lib-src/ebrowse.c (add_sym, add_member, make_namespace)
(register_namespace_alias):
* src/alloc.c (SDATA_SIZE, allocate_string_data):
* src/image.c (xpm_cache_color, imagemagick_create_cache):
* src/process.c (Fmake_network_process):
Use FLEXSIZEOF instead of offsetof and addition.
* src/alloc.c (SDATA_SIZE, vector_alignment):
Use FLEXALIGNOF instead of sizeof (ptrdiff_t).
* src/lisp.h (ALIGNOF_STRUCT_LISP_VECTOR):
Remove, as alloc.c can now calculate this on its own.
2016-09-08 01:08:45 +00:00
|
|
|
|
struct sym *s = xmalloc (FLEXSIZEOF (struct sym, name, strlen (name) + 1));
|
Use C99-style flexible array members if available.
This avoids some subtle aliasing issues, which typically
aren't a problem with GCC but may be a problem elsewhere.
* lib-src/ebrowse.c (struct member, struct alias, struct sym):
Use FLEXIBLE_ARRAY_MEMBER.
(add_sym, add_member, make_namespace, register_namespace_alias):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/alloc.c (sdata): New typedef, replacing the old struct sdata.
It is a struct if GC_CHECK_STRING_BYTES, a union otherwise.
In either case, it uses a flexible array member rather than
the old struct hack. All uses changed.
(SDATA_NBYTES, sweep_strings) [!GC_CHECK_STRING_BYTES]:
Adjust to sdata reorganization.
* src/alloc.c (VBLOCK_BYTES_MIN, allocate_vectorlike, Fgarbage_collect):
Use offsetof (struct, flex_array_member), not sizeof (struct), as
that ports better to pre-C99 non-GCC.
* src/chartab.c (Fmake_char_table, make_sub_char_table, copy_char_table):
Use CHAR_TABLE_STANDARD_SLOTS rather than its definition,
as the latter has changed.
* src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Move here from w32.c,
and port better to pre-C99 GCC.
* src/image.c (struct xpm_cached_color):
* src/lisp.h (struct Lisp_Vector, struct Lisp_Bool_Vector)
(struct Lisp_Char_Table, struct Lisp_Sub_Char_Table):
Use FLEXIBLE_ARRAY_MEMBER.
* src/lisp.h (string_bytes) [GC_CHECK_STRING_BYTES]:
Move decl to top level so it gets checked against implementation.
(CHAR_TABLE_STANDARD_SLOTS): Adjust to struct Lisp_Char_Table change.
* src/w32.c (FLEXIBLE_ARRAY_MEMBER): Move to conf_post.h.
2013-06-21 20:11:44 +00:00
|
|
|
|
memset (s, 0, offsetof (struct sym, name));
|
2000-04-09 11:15:57 +00:00
|
|
|
|
strcpy (s->name, name);
|
|
|
|
|
s->next = all_namespaces;
|
2001-10-01 07:25:14 +00:00
|
|
|
|
s->namesp = context;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
all_namespaces = s;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-12-30 02:52:49 +00:00
|
|
|
|
/* Find the symbol for namespace NAME. If not found, return NULL */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct sym *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
check_namespace (char *name, struct sym *context)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2001-10-01 07:25:14 +00:00
|
|
|
|
struct sym *p = NULL;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
for (p = all_namespaces; p; p = p->next)
|
|
|
|
|
{
|
2001-10-01 07:25:14 +00:00
|
|
|
|
if (streq (p->name, name) && (p->namesp == context))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
2010-07-03 15:15:30 +00:00
|
|
|
|
}
|
2001-10-01 07:25:14 +00:00
|
|
|
|
|
|
|
|
|
return p;
|
2010-07-03 15:15:30 +00:00
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2001-10-01 07:25:14 +00:00
|
|
|
|
/* Find the symbol for namespace NAME. If not found, add a new symbol
|
|
|
|
|
for NAME to all_namespaces. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct sym *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
find_namespace (char *name, struct sym *context)
|
2001-10-01 07:25:14 +00:00
|
|
|
|
{
|
|
|
|
|
struct sym *p = check_namespace (name, context);
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (p == NULL)
|
2001-10-01 07:25:14 +00:00
|
|
|
|
p = make_namespace (name, context);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2001-10-01 07:25:14 +00:00
|
|
|
|
/* Find namespace alias with name NAME. If not found return NULL. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct link *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
check_namespace_alias (char *name)
|
2001-10-01 07:25:14 +00:00
|
|
|
|
{
|
|
|
|
|
struct link *p = NULL;
|
|
|
|
|
struct alias *al;
|
|
|
|
|
unsigned h;
|
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
|
|
for (s = name, h = 0; *s; ++s)
|
|
|
|
|
h = (h << 1) ^ *s;
|
|
|
|
|
h %= TABLE_SIZE;
|
|
|
|
|
|
|
|
|
|
for (al = namespace_alias_table[h]; al; al = al->next)
|
|
|
|
|
if (streq (name, al->name) && (al->namesp == current_namespace))
|
|
|
|
|
{
|
|
|
|
|
p = al->aliasee;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
register_namespace_alias (char *new_name, struct link *old_name)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2001-10-01 07:25:14 +00:00
|
|
|
|
unsigned h;
|
|
|
|
|
char *s;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
struct alias *al;
|
|
|
|
|
|
2001-10-01 07:25:14 +00:00
|
|
|
|
for (s = new_name, h = 0; *s; ++s)
|
|
|
|
|
h = (h << 1) ^ *s;
|
|
|
|
|
h %= TABLE_SIZE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Is it already in the table of aliases? */
|
|
|
|
|
for (al = namespace_alias_table[h]; al; al = al->next)
|
|
|
|
|
if (streq (new_name, al->name) && (al->namesp == current_namespace))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return;
|
|
|
|
|
|
Port flexible array members to GCC + valgrind
These changes are needed to conform to the C standard's rule for
allocating structs containing flexible array members. C11 says
that malloc (offsetof (struct s, m) + n) does not suffice to
allocate a struct with an n-byte tail; instead, malloc’s arg
should be rounded up to the nearest multiple of alignof (struct s).
Although this is arguably a defect in C11, gcc -O2 + valgrind
sometimes complains when this rule is violated, and when debugging
it’s better to keep valgrind happy.
For details please see the thread containing the message at:
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00416.html
* lib-src/ebrowse.c, src/alloc.c, src/image.c, src/process.c:
Include flexmember.h.
* lib-src/ebrowse.c (add_sym, add_member, make_namespace)
(register_namespace_alias):
* src/alloc.c (SDATA_SIZE, allocate_string_data):
* src/image.c (xpm_cache_color, imagemagick_create_cache):
* src/process.c (Fmake_network_process):
Use FLEXSIZEOF instead of offsetof and addition.
* src/alloc.c (SDATA_SIZE, vector_alignment):
Use FLEXALIGNOF instead of sizeof (ptrdiff_t).
* src/lisp.h (ALIGNOF_STRUCT_LISP_VECTOR):
Remove, as alloc.c can now calculate this on its own.
2016-09-08 01:08:45 +00:00
|
|
|
|
al = xmalloc (FLEXSIZEOF (struct alias, name, strlen (new_name) + 1));
|
2000-04-09 11:15:57 +00:00
|
|
|
|
strcpy (al->name, new_name);
|
2001-10-01 07:25:14 +00:00
|
|
|
|
al->next = namespace_alias_table[h];
|
|
|
|
|
al->namesp = current_namespace;
|
|
|
|
|
al->aliasee = old_name;
|
|
|
|
|
namespace_alias_table[h] = al;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Enter namespace with name NAME. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
enter_namespace (char *name)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2001-10-01 07:25:14 +00:00
|
|
|
|
struct sym *p = find_namespace (name, current_namespace);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
if (namespace_sp == namespace_stack_size)
|
|
|
|
|
{
|
|
|
|
|
int size = max (10, 2 * namespace_stack_size);
|
2001-05-08 11:25:01 +00:00
|
|
|
|
namespace_stack
|
|
|
|
|
= (struct sym **) xrealloc ((void *)namespace_stack,
|
|
|
|
|
size * sizeof *namespace_stack);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
namespace_stack_size = size;
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
namespace_stack[namespace_sp++] = current_namespace;
|
|
|
|
|
current_namespace = p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Leave the current namespace. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
leave_namespace (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
assert (namespace_sp > 0);
|
|
|
|
|
current_namespace = namespace_stack[--namespace_sp];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
Writing the Output File
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Write string S to the output file FP in a Lisp-readable form.
|
|
|
|
|
If S is null, write out `()'. */
|
|
|
|
|
|
2013-07-02 00:33:04 +00:00
|
|
|
|
static void
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (const char *s, FILE *fp)
|
|
|
|
|
{
|
|
|
|
|
if (!s)
|
|
|
|
|
{
|
|
|
|
|
putc ('(', fp);
|
|
|
|
|
putc (')', fp);
|
|
|
|
|
putc (' ', fp);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
putc ('"', fp);
|
|
|
|
|
fputs (s, fp);
|
|
|
|
|
putc ('"', fp);
|
|
|
|
|
putc (' ', fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* A dynamically allocated buffer for constructing a scope name. */
|
|
|
|
|
|
Prefer static to extern in ebrowse
* lib-src/ebrowse.c (info_where, info_cls, info_member)
(info_position, options, yyival, yytext, yytext_end, yyout)
(yyline, filename, is_ident, is_digit, is_white, f_append)
(f_verbose, f_very_verbose, f_structs, f_regexps)
(f_nested_classes, min_regexp, max_regexp, inbuffer, in)
(inbuffer_size, string_start, class_table, member_table)
(namespace_alias_table, global_symbols, current_namespace)
(all_namespaces, namespace_stack, namespace_stack_size)
(namespace_sp, tk, keyword_table, search_path)
(search_path_tail, scope_buffer, scope_buffer_size)
(scope_buffer_len): Now static.
(options): Now const.
2019-12-10 01:30:42 +00:00
|
|
|
|
static char *scope_buffer;
|
|
|
|
|
static int scope_buffer_size;
|
|
|
|
|
static int scope_buffer_len;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Make sure scope_buffer has enough room to add LEN chars to it. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
ensure_scope_buffer_room (int len)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (scope_buffer_len + len >= scope_buffer_size)
|
|
|
|
|
{
|
|
|
|
|
int new_size = max (2 * scope_buffer_size, scope_buffer_len + len);
|
2000-12-13 17:47:18 +00:00
|
|
|
|
scope_buffer = (char *) xrealloc (scope_buffer, new_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
scope_buffer_size = new_size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Recursively add the scope names of symbol P and the scopes of its
|
|
|
|
|
namespaces to scope_buffer. Value is a pointer to the complete
|
|
|
|
|
scope name constructed. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
sym_scope_1 (struct sym *p)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int len;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (p->namesp)
|
|
|
|
|
sym_scope_1 (p->namesp);
|
|
|
|
|
|
|
|
|
|
if (*scope_buffer)
|
|
|
|
|
{
|
|
|
|
|
ensure_scope_buffer_room (3);
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
strcpy (scope_buffer + scope_buffer_len, "::");
|
2000-04-09 11:15:57 +00:00
|
|
|
|
scope_buffer_len += 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
len = strlen (p->name);
|
|
|
|
|
ensure_scope_buffer_room (len + 1);
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
strcpy (scope_buffer + scope_buffer_len, p->name);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
scope_buffer_len += len;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
if (has_flag (p->flags, F_TEMPLATE))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
ensure_scope_buffer_room (3);
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
strcpy (scope_buffer + scope_buffer_len, "<>");
|
2000-04-09 11:15:57 +00:00
|
|
|
|
scope_buffer_len += 2;
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return scope_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the scope of symbol P in printed representation, i.e.
|
|
|
|
|
as it would appear in a C*+ source file. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
sym_scope (struct sym *p)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (!scope_buffer)
|
|
|
|
|
{
|
|
|
|
|
scope_buffer_size = 1024;
|
2000-07-14 17:59:55 +00:00
|
|
|
|
scope_buffer = (char *) xmalloc (scope_buffer_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
*scope_buffer = '\0';
|
|
|
|
|
scope_buffer_len = 0;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (p->namesp)
|
|
|
|
|
sym_scope_1 (p->namesp);
|
|
|
|
|
|
|
|
|
|
return scope_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-04-08 23:41:26 +00:00
|
|
|
|
/* Dump the list of members M to file FP. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2022-04-08 23:41:26 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
dump_members (FILE *fp, struct member *m)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
putc ('(', fp);
|
|
|
|
|
|
2022-04-08 23:41:26 +00:00
|
|
|
|
for (; m; m = m->next)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
fputs (MEMBER_STRUCT, fp);
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (m->name, fp);
|
|
|
|
|
putstr (NULL, fp); /* FIXME? scope for globals */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
fprintf (fp, "%u ", (unsigned) m->flags);
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (m->filename, fp);
|
|
|
|
|
putstr (m->regexp, fp);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
fprintf (fp, "%u ", (unsigned) m->pos);
|
|
|
|
|
fprintf (fp, "%u ", (unsigned) m->vis);
|
|
|
|
|
putc (' ', fp);
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (m->def_filename, fp);
|
|
|
|
|
putstr (m->def_regexp, fp);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
fprintf (fp, "%u", (unsigned) m->def_pos);
|
|
|
|
|
putc (']', fp);
|
|
|
|
|
putc ('\n', fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
putc (')', fp);
|
|
|
|
|
putc ('\n', fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Dump class ROOT to stream FP. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
dump_sym (FILE *fp, struct sym *root)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
fputs (CLASS_STRUCT, fp);
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (root->name, fp);
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Print scope, if any. */
|
|
|
|
|
if (root->namesp)
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (sym_scope (root), fp);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
else
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (NULL, fp);
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Print flags. */
|
2015-04-25 05:37:11 +00:00
|
|
|
|
fprintf (fp, "%d", root->flags);
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (root->filename, fp);
|
|
|
|
|
putstr (root->regexp, fp);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
fprintf (fp, "%u", (unsigned) root->pos);
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (root->sfilename, fp);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
putc (']', fp);
|
|
|
|
|
putc ('\n', fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-04-08 23:41:26 +00:00
|
|
|
|
/* Dump class ROOT and its subclasses to file FP. */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2022-04-08 23:41:26 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
dump_tree (FILE *fp, struct sym *root)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
dump_sym (fp, root);
|
|
|
|
|
|
|
|
|
|
if (f_verbose)
|
|
|
|
|
{
|
|
|
|
|
putchar ('+');
|
|
|
|
|
fflush (stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
putc ('(', fp);
|
|
|
|
|
|
2022-04-08 23:41:26 +00:00
|
|
|
|
for (struct link *lk = root->subs; lk; lk = lk->next)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
fputs (TREE_STRUCT, fp);
|
2022-04-08 23:41:26 +00:00
|
|
|
|
dump_tree (fp, lk->sym);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
putc (']', fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
putc (')', fp);
|
|
|
|
|
|
|
|
|
|
dump_members (fp, root->vars);
|
2022-04-08 23:41:26 +00:00
|
|
|
|
dump_members (fp, root->fns);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
dump_members (fp, root->static_vars);
|
2022-04-08 23:41:26 +00:00
|
|
|
|
dump_members (fp, root->static_fns);
|
|
|
|
|
dump_members (fp, root->friends);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
dump_members (fp, root->types);
|
|
|
|
|
|
|
|
|
|
/* Superclasses. */
|
|
|
|
|
putc ('(', fp);
|
|
|
|
|
putc (')', fp);
|
|
|
|
|
|
|
|
|
|
/* Mark slot. */
|
|
|
|
|
putc ('(', fp);
|
|
|
|
|
putc (')', fp);
|
|
|
|
|
|
|
|
|
|
putc ('\n', fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Dump the entire class tree to file FP. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
dump_roots (FILE *fp)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
/* Output file header containing version string, command line
|
|
|
|
|
options etc. */
|
|
|
|
|
if (!f_append)
|
|
|
|
|
{
|
|
|
|
|
fputs (TREE_HEADER_STRUCT, fp);
|
2011-02-26 00:22:13 +00:00
|
|
|
|
putstr (EBROWSE_FILE_VERSION, fp);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
putc ('\"', fp);
|
|
|
|
|
if (!f_structs)
|
|
|
|
|
fputs (" -s", fp);
|
|
|
|
|
if (f_regexps)
|
|
|
|
|
fputs (" -x", fp);
|
|
|
|
|
putc ('\"', fp);
|
|
|
|
|
fputs (" ()", fp);
|
|
|
|
|
fputs (" ()", fp);
|
|
|
|
|
putc (']', fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Mark functions as virtual that are so because of functions
|
|
|
|
|
declared virtual in base classes. */
|
|
|
|
|
mark_inherited_virtual ();
|
|
|
|
|
|
|
|
|
|
/* Dump the roots of the graph. */
|
2022-04-08 23:41:26 +00:00
|
|
|
|
for (int i = 0; i < TABLE_SIZE; ++i)
|
|
|
|
|
for (struct sym *r = class_table[i]; r; r = r->next)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (!r->supers)
|
|
|
|
|
{
|
|
|
|
|
fputs (TREE_STRUCT, fp);
|
2022-04-08 23:41:26 +00:00
|
|
|
|
dump_tree (fp, r);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
putc (']', fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (f_verbose)
|
|
|
|
|
putchar ('\n');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
Scanner
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
#define INCREMENT_LINENO \
|
|
|
|
|
do { \
|
|
|
|
|
if (f_very_verbose) \
|
|
|
|
|
{ \
|
|
|
|
|
++yyline; \
|
|
|
|
|
printf ("%d:\n", yyline); \
|
|
|
|
|
} \
|
|
|
|
|
else \
|
|
|
|
|
++yyline; \
|
|
|
|
|
} while (0)
|
|
|
|
|
#else
|
|
|
|
|
#define INCREMENT_LINENO ++yyline
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Define two macros for accessing the input buffer (current input
|
|
|
|
|
file). GET(C) sets C to the next input character and advances the
|
|
|
|
|
input pointer. UNGET retracts the input pointer. */
|
|
|
|
|
|
|
|
|
|
#define GET(C) ((C) = *in++)
|
|
|
|
|
#define UNGET() (--in)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Process a preprocessor line. Value is the next character from the
|
|
|
|
|
input buffer not consumed. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
|
process_pp_line (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2000-07-10 20:36:58 +00:00
|
|
|
|
int in_comment = 0, in_string = 0;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
int c;
|
|
|
|
|
char *p = yytext;
|
|
|
|
|
|
|
|
|
|
/* Skip over white space. The `#' has been consumed already. */
|
|
|
|
|
while (WHITEP (GET (c)))
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
/* Read the preprocessor command (if any). */
|
|
|
|
|
while (IDENTP (c))
|
|
|
|
|
{
|
|
|
|
|
*p++ = c;
|
|
|
|
|
GET (c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Is it a `define'? */
|
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
|
|
if (*yytext && streq (yytext, "define"))
|
|
|
|
|
{
|
|
|
|
|
p = yytext;
|
|
|
|
|
while (WHITEP (c))
|
|
|
|
|
GET (c);
|
|
|
|
|
while (IDENTP (c))
|
|
|
|
|
{
|
|
|
|
|
*p++ = c;
|
|
|
|
|
GET (c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
|
|
if (*yytext)
|
|
|
|
|
{
|
|
|
|
|
char *regexp = matching_regexp ();
|
|
|
|
|
int pos = BUFFER_POS ();
|
|
|
|
|
add_define (yytext, regexp, pos);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-07-10 20:36:58 +00:00
|
|
|
|
while (c && (c != '\n' || in_comment || in_string))
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (c == '\\')
|
|
|
|
|
GET (c);
|
|
|
|
|
else if (c == '/' && !in_comment)
|
|
|
|
|
{
|
|
|
|
|
if (GET (c) == '*')
|
|
|
|
|
in_comment = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (c == '*' && in_comment)
|
|
|
|
|
{
|
|
|
|
|
if (GET (c) == '/')
|
|
|
|
|
in_comment = 0;
|
|
|
|
|
}
|
2000-07-10 20:36:58 +00:00
|
|
|
|
else if (c == '"')
|
|
|
|
|
in_string = !in_string;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (c == '\n')
|
|
|
|
|
INCREMENT_LINENO;
|
|
|
|
|
|
|
|
|
|
GET (c);
|
|
|
|
|
}
|
2000-07-10 20:36:58 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Value is the next token from the input buffer. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
|
yylex (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int c;
|
|
|
|
|
char end_char;
|
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
while (WHITEP (GET (c)))
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case '\n':
|
|
|
|
|
INCREMENT_LINENO;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '\r':
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
/* End of file. */
|
|
|
|
|
return YYEOF;
|
|
|
|
|
|
|
|
|
|
case '\\':
|
|
|
|
|
GET (c);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '"':
|
|
|
|
|
case '\'':
|
|
|
|
|
/* String and character constants. */
|
|
|
|
|
end_char = c;
|
|
|
|
|
string_start = in;
|
|
|
|
|
while (GET (c) && c != end_char)
|
|
|
|
|
{
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case '\\':
|
|
|
|
|
/* Escape sequences. */
|
|
|
|
|
if (!GET (c))
|
|
|
|
|
{
|
|
|
|
|
if (end_char == '\'')
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("EOF in character constant", NULL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
else
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("EOF in string constant", NULL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
goto end_string;
|
|
|
|
|
}
|
|
|
|
|
else switch (c)
|
|
|
|
|
{
|
|
|
|
|
case '\n':
|
2000-07-10 20:36:58 +00:00
|
|
|
|
INCREMENT_LINENO;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case 'a':
|
|
|
|
|
case 'b':
|
|
|
|
|
case 'f':
|
|
|
|
|
case 'n':
|
|
|
|
|
case 'r':
|
|
|
|
|
case 't':
|
|
|
|
|
case 'v':
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'x':
|
|
|
|
|
{
|
|
|
|
|
/* Hexadecimal escape sequence. */
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < 2; ++i)
|
|
|
|
|
{
|
|
|
|
|
GET (c);
|
|
|
|
|
|
|
|
|
|
if (c >= '0' && c <= '7')
|
|
|
|
|
;
|
|
|
|
|
else if (c >= 'a' && c <= 'f')
|
|
|
|
|
;
|
|
|
|
|
else if (c >= 'A' && c <= 'F')
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
UNGET ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '0':
|
|
|
|
|
{
|
|
|
|
|
/* Octal escape sequence. */
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < 3; ++i)
|
|
|
|
|
{
|
|
|
|
|
GET (c);
|
|
|
|
|
|
|
|
|
|
if (c >= '0' && c <= '7')
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
UNGET ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '\n':
|
|
|
|
|
if (end_char == '\'')
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("newline in character constant", NULL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
else
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("newline in string constant", NULL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
INCREMENT_LINENO;
|
2000-07-10 20:36:58 +00:00
|
|
|
|
break;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
end_string:
|
|
|
|
|
return end_char == '\'' ? CCHAR : CSTRING;
|
|
|
|
|
|
|
|
|
|
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
|
|
|
|
|
case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
|
|
|
|
|
case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
|
|
|
|
|
case 'v': case 'w': case 'x': case 'y': case 'z':
|
|
|
|
|
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
|
|
|
|
|
case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N':
|
|
|
|
|
case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U':
|
|
|
|
|
case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_':
|
|
|
|
|
{
|
|
|
|
|
/* Identifier and keywords. */
|
|
|
|
|
unsigned hash;
|
|
|
|
|
struct kw *k;
|
|
|
|
|
|
|
|
|
|
p = yytext;
|
|
|
|
|
*p++ = hash = c;
|
|
|
|
|
|
|
|
|
|
while (IDENTP (GET (*p)))
|
|
|
|
|
{
|
|
|
|
|
hash = (hash << 1) ^ *p++;
|
|
|
|
|
if (p == yytext_end - 1)
|
|
|
|
|
{
|
|
|
|
|
int size = yytext_end - yytext;
|
2000-07-14 17:59:55 +00:00
|
|
|
|
yytext = (char *) xrealloc (yytext, 2 * size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
yytext_end = yytext + 2 * size;
|
|
|
|
|
p = yytext + size - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UNGET ();
|
|
|
|
|
*p = 0;
|
|
|
|
|
|
|
|
|
|
for (k = keyword_table[hash % KEYWORD_TABLE_SIZE]; k; k = k->next)
|
|
|
|
|
if (streq (k->name, yytext))
|
|
|
|
|
return k->tk;
|
|
|
|
|
|
|
|
|
|
return IDENT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case '/':
|
|
|
|
|
/* C and C++ comments, '/' and '/='. */
|
|
|
|
|
switch (GET (c))
|
|
|
|
|
{
|
|
|
|
|
case '*':
|
|
|
|
|
while (GET (c))
|
|
|
|
|
{
|
|
|
|
|
switch (c)
|
|
|
|
|
{
|
|
|
|
|
case '*':
|
|
|
|
|
if (GET (c) == '/')
|
|
|
|
|
goto comment_end;
|
|
|
|
|
UNGET ();
|
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
|
|
|
|
GET (c);
|
|
|
|
|
break;
|
|
|
|
|
case '\n':
|
|
|
|
|
INCREMENT_LINENO;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
comment_end:;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '=':
|
|
|
|
|
return DIVASGN;
|
|
|
|
|
|
|
|
|
|
case '/':
|
|
|
|
|
while (GET (c) && c != '\n')
|
|
|
|
|
;
|
2010-11-27 09:29:22 +00:00
|
|
|
|
/* Don't try to read past the end of the input buffer if
|
|
|
|
|
the file ends in a C++ comment without a newline. */
|
|
|
|
|
if (c == 0)
|
|
|
|
|
return YYEOF;
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
INCREMENT_LINENO;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '/';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '+':
|
|
|
|
|
if (GET (c) == '+')
|
|
|
|
|
return INC;
|
|
|
|
|
else if (c == '=')
|
|
|
|
|
return ADDASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '+';
|
|
|
|
|
|
|
|
|
|
case '-':
|
|
|
|
|
switch (GET (c))
|
|
|
|
|
{
|
|
|
|
|
case '-':
|
|
|
|
|
return DEC;
|
|
|
|
|
case '>':
|
|
|
|
|
if (GET (c) == '*')
|
|
|
|
|
return ARROWSTAR;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return ARROW;
|
|
|
|
|
case '=':
|
|
|
|
|
return SUBASGN;
|
|
|
|
|
}
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '-';
|
|
|
|
|
|
|
|
|
|
case '*':
|
|
|
|
|
if (GET (c) == '=')
|
|
|
|
|
return MULASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '*';
|
|
|
|
|
|
|
|
|
|
case '%':
|
|
|
|
|
if (GET (c) == '=')
|
|
|
|
|
return MODASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '%';
|
|
|
|
|
|
|
|
|
|
case '|':
|
|
|
|
|
if (GET (c) == '|')
|
|
|
|
|
return LOR;
|
|
|
|
|
else if (c == '=')
|
|
|
|
|
return ORASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '|';
|
|
|
|
|
|
|
|
|
|
case '&':
|
|
|
|
|
if (GET (c) == '&')
|
|
|
|
|
return LAND;
|
|
|
|
|
else if (c == '=')
|
|
|
|
|
return ANDASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '&';
|
|
|
|
|
|
|
|
|
|
case '^':
|
|
|
|
|
if (GET (c) == '=')
|
|
|
|
|
return XORASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '^';
|
|
|
|
|
|
|
|
|
|
case '.':
|
|
|
|
|
if (GET (c) == '*')
|
|
|
|
|
return POINTSTAR;
|
|
|
|
|
else if (c == '.')
|
|
|
|
|
{
|
|
|
|
|
if (GET (c) != '.')
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("invalid token '..' ('...' assumed)", NULL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
UNGET ();
|
|
|
|
|
return ELLIPSIS;
|
|
|
|
|
}
|
|
|
|
|
else if (!DIGITP (c))
|
|
|
|
|
{
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '.';
|
|
|
|
|
}
|
|
|
|
|
goto mantissa;
|
|
|
|
|
|
|
|
|
|
case ':':
|
|
|
|
|
if (GET (c) == ':')
|
|
|
|
|
return DCOLON;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return ':';
|
|
|
|
|
|
|
|
|
|
case '=':
|
|
|
|
|
if (GET (c) == '=')
|
|
|
|
|
return EQ;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '=';
|
|
|
|
|
|
|
|
|
|
case '!':
|
|
|
|
|
if (GET (c) == '=')
|
|
|
|
|
return NE;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '!';
|
|
|
|
|
|
|
|
|
|
case '<':
|
|
|
|
|
switch (GET (c))
|
|
|
|
|
{
|
|
|
|
|
case '=':
|
|
|
|
|
return LE;
|
|
|
|
|
case '<':
|
|
|
|
|
if (GET (c) == '=')
|
|
|
|
|
return LSHIFTASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return LSHIFT;
|
|
|
|
|
}
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '<';
|
|
|
|
|
|
|
|
|
|
case '>':
|
|
|
|
|
switch (GET (c))
|
|
|
|
|
{
|
|
|
|
|
case '=':
|
|
|
|
|
return GE;
|
|
|
|
|
case '>':
|
|
|
|
|
if (GET (c) == '=')
|
|
|
|
|
return RSHIFTASGN;
|
|
|
|
|
UNGET ();
|
|
|
|
|
return RSHIFT;
|
|
|
|
|
}
|
|
|
|
|
UNGET ();
|
|
|
|
|
return '>';
|
|
|
|
|
|
|
|
|
|
case '#':
|
|
|
|
|
c = process_pp_line ();
|
|
|
|
|
if (c == 0)
|
|
|
|
|
return YYEOF;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '(': case ')': case '[': case ']': case '{': case '}':
|
|
|
|
|
case ';': case ',': case '?': case '~':
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
|
|
case '0':
|
|
|
|
|
yyival = 0;
|
|
|
|
|
|
|
|
|
|
if (GET (c) == 'x' || c == 'X')
|
|
|
|
|
{
|
|
|
|
|
while (GET (c))
|
|
|
|
|
{
|
|
|
|
|
if (DIGITP (c))
|
|
|
|
|
yyival = yyival * 16 + c - '0';
|
|
|
|
|
else if (c >= 'a' && c <= 'f')
|
|
|
|
|
yyival = yyival * 16 + c - 'a' + 10;
|
|
|
|
|
else if (c >= 'A' && c <= 'F')
|
|
|
|
|
yyival = yyival * 16 + c - 'A' + 10;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goto int_suffixes;
|
|
|
|
|
}
|
|
|
|
|
else if (c == '.')
|
|
|
|
|
goto mantissa;
|
|
|
|
|
|
|
|
|
|
while (c >= '0' && c <= '7')
|
|
|
|
|
{
|
|
|
|
|
yyival = (yyival << 3) + c - '0';
|
|
|
|
|
GET (c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int_suffixes:
|
|
|
|
|
/* Integer suffixes. */
|
|
|
|
|
while (isalpha (c))
|
|
|
|
|
GET (c);
|
|
|
|
|
UNGET ();
|
|
|
|
|
return CINT;
|
|
|
|
|
|
|
|
|
|
case '1': case '2': case '3': case '4': case '5': case '6':
|
|
|
|
|
case '7': case '8': case '9':
|
|
|
|
|
/* Integer or floating constant, part before '.'. */
|
|
|
|
|
yyival = c - '0';
|
|
|
|
|
|
|
|
|
|
while (GET (c) && DIGITP (c))
|
|
|
|
|
yyival = 10 * yyival + c - '0';
|
|
|
|
|
|
|
|
|
|
if (c != '.')
|
|
|
|
|
goto int_suffixes;
|
|
|
|
|
|
|
|
|
|
mantissa:
|
|
|
|
|
/* Digits following '.'. */
|
|
|
|
|
while (DIGITP (c))
|
|
|
|
|
GET (c);
|
|
|
|
|
|
|
|
|
|
/* Optional exponent. */
|
|
|
|
|
if (c == 'E' || c == 'e')
|
|
|
|
|
{
|
|
|
|
|
if (GET (c) == '-' || c == '+')
|
|
|
|
|
GET (c);
|
|
|
|
|
|
|
|
|
|
while (DIGITP (c))
|
|
|
|
|
GET (c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Optional type suffixes. */
|
|
|
|
|
while (isalpha (c))
|
|
|
|
|
GET (c);
|
|
|
|
|
UNGET ();
|
|
|
|
|
return CFLOAT;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-01-26 09:32:03 +00:00
|
|
|
|
/* Actually local to matching_regexp. These variables must be in
|
2020-09-21 11:29:10 +00:00
|
|
|
|
global scope for the case that `static' gets defined away. */
|
2001-01-26 09:32:03 +00:00
|
|
|
|
|
|
|
|
|
static char *matching_regexp_buffer, *matching_regexp_end_buf;
|
|
|
|
|
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Value is the string from the start of the line to the current
|
|
|
|
|
position in the input buffer, or maybe a bit more if that string is
|
|
|
|
|
shorter than min_regexp. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
matching_regexp (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
char *p;
|
|
|
|
|
char *s;
|
|
|
|
|
char *t;
|
|
|
|
|
|
|
|
|
|
if (!f_regexps)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2001-01-26 09:32:03 +00:00
|
|
|
|
if (matching_regexp_buffer == NULL)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2001-01-26 09:32:03 +00:00
|
|
|
|
matching_regexp_buffer = (char *) xmalloc (max_regexp);
|
|
|
|
|
matching_regexp_end_buf = &matching_regexp_buffer[max_regexp] - 1;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Scan back to previous newline of buffer start. */
|
|
|
|
|
for (p = in - 1; p > inbuffer && *p != '\n'; --p)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (*p == '\n')
|
|
|
|
|
{
|
|
|
|
|
while (in - p < min_regexp && p > inbuffer)
|
|
|
|
|
{
|
|
|
|
|
/* Line probably not significant enough */
|
2009-01-14 13:41:12 +00:00
|
|
|
|
for (--p; p > inbuffer && *p != '\n'; --p)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
if (*p == '\n')
|
|
|
|
|
++p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Copy from end to make sure significant portions are included.
|
|
|
|
|
This implies that in the browser a regular expressing of the form
|
|
|
|
|
`^.*{regexp}' has to be used. */
|
2001-01-26 09:32:03 +00:00
|
|
|
|
for (s = matching_regexp_end_buf - 1, t = in;
|
|
|
|
|
s > matching_regexp_buffer && t > p;)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
*--s = *--t;
|
|
|
|
|
|
2001-11-16 10:48:38 +00:00
|
|
|
|
if (*s == '"' || *s == '\\')
|
2022-01-20 11:42:56 +00:00
|
|
|
|
{
|
|
|
|
|
if (s > matching_regexp_buffer)
|
|
|
|
|
*--s = '\\';
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
s++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-01-26 09:32:03 +00:00
|
|
|
|
*(matching_regexp_end_buf - 1) = '\0';
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return xstrdup (s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return a printable representation of token T. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static const char *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
token_string (int t)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
static char b[3];
|
|
|
|
|
|
|
|
|
|
switch (t)
|
|
|
|
|
{
|
|
|
|
|
case CSTRING: return "string constant";
|
|
|
|
|
case CCHAR: return "char constant";
|
|
|
|
|
case CINT: return "int constant";
|
|
|
|
|
case CFLOAT: return "floating constant";
|
|
|
|
|
case ELLIPSIS: return "...";
|
|
|
|
|
case LSHIFTASGN: return "<<=";
|
|
|
|
|
case RSHIFTASGN: return ">>=";
|
|
|
|
|
case ARROWSTAR: return "->*";
|
|
|
|
|
case IDENT: return "identifier";
|
|
|
|
|
case DIVASGN: return "/=";
|
|
|
|
|
case INC: return "++";
|
|
|
|
|
case ADDASGN: return "+=";
|
|
|
|
|
case DEC: return "--";
|
|
|
|
|
case ARROW: return "->";
|
|
|
|
|
case SUBASGN: return "-=";
|
|
|
|
|
case MULASGN: return "*=";
|
|
|
|
|
case MODASGN: return "%=";
|
|
|
|
|
case LOR: return "||";
|
|
|
|
|
case ORASGN: return "|=";
|
|
|
|
|
case LAND: return "&&";
|
|
|
|
|
case ANDASGN: return "&=";
|
|
|
|
|
case XORASGN: return "^=";
|
|
|
|
|
case POINTSTAR: return ".*";
|
|
|
|
|
case DCOLON: return "::";
|
|
|
|
|
case EQ: return "==";
|
|
|
|
|
case NE: return "!=";
|
|
|
|
|
case LE: return "<=";
|
|
|
|
|
case LSHIFT: return "<<";
|
|
|
|
|
case GE: return ">=";
|
|
|
|
|
case RSHIFT: return ">>";
|
|
|
|
|
case ASM: return "asm";
|
|
|
|
|
case AUTO: return "auto";
|
|
|
|
|
case BREAK: return "break";
|
|
|
|
|
case CASE: return "case";
|
|
|
|
|
case CATCH: return "catch";
|
|
|
|
|
case CHAR: return "char";
|
|
|
|
|
case CLASS: return "class";
|
|
|
|
|
case CONST: return "const";
|
|
|
|
|
case CONTINUE: return "continue";
|
|
|
|
|
case DEFAULT: return "default";
|
|
|
|
|
case DELETE: return "delete";
|
|
|
|
|
case DO: return "do";
|
|
|
|
|
case DOUBLE: return "double";
|
|
|
|
|
case ELSE: return "else";
|
|
|
|
|
case ENUM: return "enum";
|
|
|
|
|
case EXTERN: return "extern";
|
|
|
|
|
case FLOAT: return "float";
|
|
|
|
|
case FOR: return "for";
|
|
|
|
|
case FRIEND: return "friend";
|
|
|
|
|
case GOTO: return "goto";
|
|
|
|
|
case IF: return "if";
|
|
|
|
|
case T_INLINE: return "inline";
|
|
|
|
|
case INT: return "int";
|
|
|
|
|
case LONG: return "long";
|
|
|
|
|
case NEW: return "new";
|
|
|
|
|
case OPERATOR: return "operator";
|
|
|
|
|
case PRIVATE: return "private";
|
|
|
|
|
case PROTECTED: return "protected";
|
|
|
|
|
case PUBLIC: return "public";
|
|
|
|
|
case REGISTER: return "register";
|
|
|
|
|
case RETURN: return "return";
|
|
|
|
|
case SHORT: return "short";
|
|
|
|
|
case SIGNED: return "signed";
|
|
|
|
|
case SIZEOF: return "sizeof";
|
|
|
|
|
case STATIC: return "static";
|
|
|
|
|
case STRUCT: return "struct";
|
|
|
|
|
case SWITCH: return "switch";
|
|
|
|
|
case TEMPLATE: return "template";
|
|
|
|
|
case THIS: return "this";
|
|
|
|
|
case THROW: return "throw";
|
|
|
|
|
case TRY: return "try";
|
|
|
|
|
case TYPEDEF: return "typedef";
|
|
|
|
|
case UNION: return "union";
|
|
|
|
|
case UNSIGNED: return "unsigned";
|
|
|
|
|
case VIRTUAL: return "virtual";
|
|
|
|
|
case VOID: return "void";
|
|
|
|
|
case VOLATILE: return "volatile";
|
|
|
|
|
case WHILE: return "while";
|
2000-07-03 07:50:42 +00:00
|
|
|
|
case MUTABLE: return "mutable";
|
|
|
|
|
case BOOL: return "bool";
|
|
|
|
|
case TRUE: return "true";
|
|
|
|
|
case FALSE: return "false";
|
|
|
|
|
case SIGNATURE: return "signature";
|
|
|
|
|
case NAMESPACE: return "namespace";
|
|
|
|
|
case EXPLICIT: return "explicit";
|
|
|
|
|
case TYPENAME: return "typename";
|
|
|
|
|
case CONST_CAST: return "const_cast";
|
|
|
|
|
case DYNAMIC_CAST: return "dynamic_cast";
|
|
|
|
|
case REINTERPRET_CAST: return "reinterpret_cast";
|
|
|
|
|
case STATIC_CAST: return "static_cast";
|
|
|
|
|
case TYPEID: return "typeid";
|
|
|
|
|
case USING: return "using";
|
|
|
|
|
case WCHAR: return "wchar_t";
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case YYEOF: return "EOF";
|
2019-01-03 12:07:05 +00:00
|
|
|
|
case FINAL: return "final";
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2000-07-03 07:50:42 +00:00
|
|
|
|
default:
|
|
|
|
|
if (t < 255)
|
|
|
|
|
{
|
|
|
|
|
b[0] = t;
|
|
|
|
|
b[1] = '\0';
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return "???";
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Reinitialize the scanner for a new input file. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
re_init_scanner (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
in = inbuffer;
|
|
|
|
|
yyline = 1;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (yytext == NULL)
|
|
|
|
|
{
|
|
|
|
|
int size = 256;
|
2000-07-14 17:59:55 +00:00
|
|
|
|
yytext = (char *) xmalloc (size * sizeof *yytext);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
yytext_end = yytext + size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-02-26 00:23:33 +00:00
|
|
|
|
/* Insert a keyword NAME with token value TKV into the keyword hash
|
2000-04-09 11:15:57 +00:00
|
|
|
|
table. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2011-02-26 00:23:33 +00:00
|
|
|
|
insert_keyword (const char *name, int tkv)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
const char *s;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
unsigned h = 0;
|
2000-07-14 17:59:55 +00:00
|
|
|
|
struct kw *k = (struct kw *) xmalloc (sizeof *k);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
for (s = name; *s; ++s)
|
|
|
|
|
h = (h << 1) ^ *s;
|
|
|
|
|
|
|
|
|
|
h %= KEYWORD_TABLE_SIZE;
|
|
|
|
|
k->name = name;
|
2011-02-26 00:23:33 +00:00
|
|
|
|
k->tk = tkv;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
k->next = keyword_table[h];
|
|
|
|
|
keyword_table[h] = k;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Initialize the scanner for the first file. This sets up the
|
|
|
|
|
character class vectors and fills the keyword hash table. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
init_scanner (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Allocate the input buffer */
|
|
|
|
|
inbuffer_size = READ_CHUNK_SIZE + 1;
|
2000-07-14 17:59:55 +00:00
|
|
|
|
inbuffer = in = (char *) xmalloc (inbuffer_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
yyline = 1;
|
|
|
|
|
|
|
|
|
|
/* Set up character class vectors. */
|
|
|
|
|
for (i = 0; i < sizeof is_ident; ++i)
|
|
|
|
|
{
|
|
|
|
|
if (i == '_' || isalnum (i))
|
|
|
|
|
is_ident[i] = 1;
|
|
|
|
|
|
|
|
|
|
if (i >= '0' && i <= '9')
|
|
|
|
|
is_digit[i] = 1;
|
|
|
|
|
|
|
|
|
|
if (i == ' ' || i == '\t' || i == '\f' || i == '\v')
|
|
|
|
|
is_white[i] = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fill keyword hash table. */
|
|
|
|
|
insert_keyword ("and", LAND);
|
|
|
|
|
insert_keyword ("and_eq", ANDASGN);
|
|
|
|
|
insert_keyword ("asm", ASM);
|
|
|
|
|
insert_keyword ("auto", AUTO);
|
|
|
|
|
insert_keyword ("bitand", '&');
|
|
|
|
|
insert_keyword ("bitor", '|');
|
|
|
|
|
insert_keyword ("bool", BOOL);
|
|
|
|
|
insert_keyword ("break", BREAK);
|
|
|
|
|
insert_keyword ("case", CASE);
|
|
|
|
|
insert_keyword ("catch", CATCH);
|
|
|
|
|
insert_keyword ("char", CHAR);
|
|
|
|
|
insert_keyword ("class", CLASS);
|
|
|
|
|
insert_keyword ("compl", '~');
|
|
|
|
|
insert_keyword ("const", CONST);
|
|
|
|
|
insert_keyword ("const_cast", CONST_CAST);
|
|
|
|
|
insert_keyword ("continue", CONTINUE);
|
|
|
|
|
insert_keyword ("default", DEFAULT);
|
|
|
|
|
insert_keyword ("delete", DELETE);
|
|
|
|
|
insert_keyword ("do", DO);
|
|
|
|
|
insert_keyword ("double", DOUBLE);
|
|
|
|
|
insert_keyword ("dynamic_cast", DYNAMIC_CAST);
|
|
|
|
|
insert_keyword ("else", ELSE);
|
|
|
|
|
insert_keyword ("enum", ENUM);
|
|
|
|
|
insert_keyword ("explicit", EXPLICIT);
|
|
|
|
|
insert_keyword ("extern", EXTERN);
|
|
|
|
|
insert_keyword ("false", FALSE);
|
2019-01-03 12:07:05 +00:00
|
|
|
|
insert_keyword ("final", FINAL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
insert_keyword ("float", FLOAT);
|
|
|
|
|
insert_keyword ("for", FOR);
|
|
|
|
|
insert_keyword ("friend", FRIEND);
|
|
|
|
|
insert_keyword ("goto", GOTO);
|
|
|
|
|
insert_keyword ("if", IF);
|
|
|
|
|
insert_keyword ("inline", T_INLINE);
|
|
|
|
|
insert_keyword ("int", INT);
|
|
|
|
|
insert_keyword ("long", LONG);
|
|
|
|
|
insert_keyword ("mutable", MUTABLE);
|
|
|
|
|
insert_keyword ("namespace", NAMESPACE);
|
|
|
|
|
insert_keyword ("new", NEW);
|
|
|
|
|
insert_keyword ("not", '!');
|
|
|
|
|
insert_keyword ("not_eq", NE);
|
|
|
|
|
insert_keyword ("operator", OPERATOR);
|
|
|
|
|
insert_keyword ("or", LOR);
|
|
|
|
|
insert_keyword ("or_eq", ORASGN);
|
|
|
|
|
insert_keyword ("private", PRIVATE);
|
|
|
|
|
insert_keyword ("protected", PROTECTED);
|
|
|
|
|
insert_keyword ("public", PUBLIC);
|
|
|
|
|
insert_keyword ("register", REGISTER);
|
|
|
|
|
insert_keyword ("reinterpret_cast", REINTERPRET_CAST);
|
|
|
|
|
insert_keyword ("return", RETURN);
|
|
|
|
|
insert_keyword ("short", SHORT);
|
|
|
|
|
insert_keyword ("signed", SIGNED);
|
|
|
|
|
insert_keyword ("sizeof", SIZEOF);
|
|
|
|
|
insert_keyword ("static", STATIC);
|
|
|
|
|
insert_keyword ("static_cast", STATIC_CAST);
|
|
|
|
|
insert_keyword ("struct", STRUCT);
|
|
|
|
|
insert_keyword ("switch", SWITCH);
|
|
|
|
|
insert_keyword ("template", TEMPLATE);
|
|
|
|
|
insert_keyword ("this", THIS);
|
|
|
|
|
insert_keyword ("throw", THROW);
|
|
|
|
|
insert_keyword ("true", TRUE);
|
|
|
|
|
insert_keyword ("try", TRY);
|
|
|
|
|
insert_keyword ("typedef", TYPEDEF);
|
|
|
|
|
insert_keyword ("typeid", TYPEID);
|
|
|
|
|
insert_keyword ("typename", TYPENAME);
|
|
|
|
|
insert_keyword ("union", UNION);
|
|
|
|
|
insert_keyword ("unsigned", UNSIGNED);
|
|
|
|
|
insert_keyword ("using", USING);
|
|
|
|
|
insert_keyword ("virtual", VIRTUAL);
|
|
|
|
|
insert_keyword ("void", VOID);
|
|
|
|
|
insert_keyword ("volatile", VOLATILE);
|
|
|
|
|
insert_keyword ("wchar_t", WCHAR);
|
|
|
|
|
insert_keyword ("while", WHILE);
|
|
|
|
|
insert_keyword ("xor", '^');
|
|
|
|
|
insert_keyword ("xor_eq", XORASGN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
Parser
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Match the current lookahead token and set it to the next token. */
|
|
|
|
|
|
|
|
|
|
#define MATCH() (tk = yylex ())
|
|
|
|
|
|
|
|
|
|
/* Return the lookahead token. If current lookahead token is cleared,
|
|
|
|
|
read a new token. */
|
|
|
|
|
|
|
|
|
|
#define LA1 (tk == -1 ? (tk = yylex ()) : tk)
|
|
|
|
|
|
|
|
|
|
/* Is the current lookahead equal to the token T? */
|
|
|
|
|
|
|
|
|
|
#define LOOKING_AT(T) (tk == (T))
|
|
|
|
|
|
|
|
|
|
/* Is the current lookahead one of T1 or T2? */
|
|
|
|
|
|
|
|
|
|
#define LOOKING_AT2(T1, T2) (tk == (T1) || tk == (T2))
|
|
|
|
|
|
|
|
|
|
/* Is the current lookahead one of T1, T2 or T3? */
|
|
|
|
|
|
|
|
|
|
#define LOOKING_AT3(T1, T2, T3) (tk == (T1) || tk == (T2) || tk == (T3))
|
|
|
|
|
|
|
|
|
|
/* Is the current lookahead one of T1...T4? */
|
|
|
|
|
|
|
|
|
|
#define LOOKING_AT4(T1, T2, T3, T4) \
|
|
|
|
|
(tk == (T1) || tk == (T2) || tk == (T3) || tk == (T4))
|
|
|
|
|
|
|
|
|
|
/* Match token T if current lookahead is T. */
|
|
|
|
|
|
|
|
|
|
#define MATCH_IF(T) if (LOOKING_AT (T)) MATCH (); else ((void) 0)
|
|
|
|
|
|
|
|
|
|
/* Skip to matching token if current token is T. */
|
|
|
|
|
|
|
|
|
|
#define SKIP_MATCHING_IF(T) \
|
|
|
|
|
if (LOOKING_AT (T)) skip_matching (); else ((void) 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Skip forward until a given token TOKEN or YYEOF is seen and return
|
|
|
|
|
the current lookahead token after skipping. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
|
skip_to (int token)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
while (!LOOKING_AT2 (YYEOF, token))
|
|
|
|
|
MATCH ();
|
|
|
|
|
return tk;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Skip over pairs of tokens (parentheses, square brackets,
|
|
|
|
|
angle brackets, curly brackets) matching the current lookahead. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
skip_matching (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int open, close, n;
|
|
|
|
|
|
|
|
|
|
switch (open = LA1)
|
|
|
|
|
{
|
|
|
|
|
case '{':
|
|
|
|
|
close = '}';
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case '(':
|
|
|
|
|
close = ')';
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case '<':
|
|
|
|
|
close = '>';
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case '[':
|
|
|
|
|
close = ']';
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (n = 0;;)
|
|
|
|
|
{
|
|
|
|
|
if (LOOKING_AT (open))
|
|
|
|
|
++n;
|
|
|
|
|
else if (LOOKING_AT (close))
|
|
|
|
|
--n;
|
|
|
|
|
else if (LOOKING_AT (YYEOF))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (n == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
skip_initializer (void)
|
2002-03-29 11:20:40 +00:00
|
|
|
|
{
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
switch (LA1)
|
|
|
|
|
{
|
|
|
|
|
case ';':
|
|
|
|
|
case ',':
|
|
|
|
|
case YYEOF:
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case '{':
|
|
|
|
|
case '[':
|
|
|
|
|
case '(':
|
|
|
|
|
skip_matching ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2001-10-01 07:25:14 +00:00
|
|
|
|
/* Build qualified namespace alias (A::B::c) and return it. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct link *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
match_qualified_namespace_alias (void)
|
2001-10-01 07:25:14 +00:00
|
|
|
|
{
|
|
|
|
|
struct link *head = NULL;
|
|
|
|
|
struct link *cur = NULL;
|
|
|
|
|
struct link *tmp = NULL;
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
switch (LA1)
|
|
|
|
|
{
|
|
|
|
|
case IDENT:
|
|
|
|
|
tmp = (struct link *) xmalloc (sizeof *cur);
|
2010-07-03 10:46:27 +00:00
|
|
|
|
tmp->sym = find_namespace (yytext, cur ? cur->sym : NULL);
|
2001-10-01 07:25:14 +00:00
|
|
|
|
tmp->next = NULL;
|
|
|
|
|
if (head)
|
|
|
|
|
{
|
|
|
|
|
cur = cur->next = tmp;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
head = cur = tmp;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case DCOLON:
|
|
|
|
|
/* Just skip */
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return head;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Re-initialize the parser by resetting the lookahead token. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
re_init_parser (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
tk = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse a parameter list, including the const-specifier,
|
|
|
|
|
pure-specifier, and throw-list that may follow a parameter list.
|
|
|
|
|
Return in FLAGS what was seen following the parameter list.
|
|
|
|
|
Returns a hash code for the parameter types. This value is used to
|
|
|
|
|
distinguish between overloaded functions. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static unsigned
|
2010-07-03 00:50:23 +00:00
|
|
|
|
parm_list (int *flags)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned hash = 0;
|
|
|
|
|
int type_seen = 0;
|
|
|
|
|
|
|
|
|
|
while (!LOOKING_AT2 (YYEOF, ')'))
|
|
|
|
|
{
|
|
|
|
|
switch (LA1)
|
|
|
|
|
{
|
2003-02-04 14:56:31 +00:00
|
|
|
|
/* Skip over grouping parens or parameter lists in parameter
|
2000-04-09 11:15:57 +00:00
|
|
|
|
declarations. */
|
|
|
|
|
case '(':
|
|
|
|
|
skip_matching ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Next parameter. */
|
|
|
|
|
case ',':
|
|
|
|
|
MATCH ();
|
|
|
|
|
type_seen = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Ignore the scope part of types, if any. This is because
|
|
|
|
|
some types need scopes when defined outside of a class body,
|
|
|
|
|
and don't need them inside the class body. This means that
|
|
|
|
|
we have to look for the last IDENT in a sequence of
|
|
|
|
|
IDENT::IDENT::... */
|
|
|
|
|
case IDENT:
|
|
|
|
|
if (!type_seen)
|
|
|
|
|
{
|
2000-07-03 07:50:42 +00:00
|
|
|
|
char *last_id;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
unsigned ident_type_hash = 0;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-07-03 07:50:42 +00:00
|
|
|
|
parse_qualified_param_ident_or_type (&last_id);
|
|
|
|
|
if (last_id)
|
|
|
|
|
{
|
|
|
|
|
/* LAST_ID null means something like `X::*'. */
|
|
|
|
|
for (; *last_id; ++last_id)
|
|
|
|
|
ident_type_hash = (ident_type_hash << 1) ^ *last_id;
|
|
|
|
|
hash = (hash << 1) ^ ident_type_hash;
|
|
|
|
|
type_seen = 1;
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case VOID:
|
|
|
|
|
/* This distinction is made to make `func (void)' equivalent
|
|
|
|
|
to `func ()'. */
|
|
|
|
|
type_seen = 1;
|
|
|
|
|
MATCH ();
|
|
|
|
|
if (!LOOKING_AT (')'))
|
|
|
|
|
hash = (hash << 1) ^ VOID;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BOOL: case CHAR: case CLASS: case CONST:
|
|
|
|
|
case DOUBLE: case ENUM: case FLOAT: case INT:
|
|
|
|
|
case LONG: case SHORT: case SIGNED: case STRUCT:
|
|
|
|
|
case UNION: case UNSIGNED: case VOLATILE: case WCHAR:
|
2001-12-19 06:03:57 +00:00
|
|
|
|
case ELLIPSIS:
|
2000-04-09 11:15:57 +00:00
|
|
|
|
type_seen = 1;
|
|
|
|
|
hash = (hash << 1) ^ LA1;
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '*': case '&': case '[': case ']':
|
|
|
|
|
hash = (hash << 1) ^ LA1;
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT (')'))
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (LOOKING_AT (CONST))
|
|
|
|
|
{
|
|
|
|
|
/* We can overload the same function on `const' */
|
|
|
|
|
hash = (hash << 1) ^ CONST;
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (flags, F_CONST);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT (THROW))
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
SKIP_MATCHING_IF ('(');
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (flags, F_THROW);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT ('='))
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
if (LOOKING_AT (CINT) && yyival == 0)
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (flags, F_PURE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Print position info to stdout. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
print_info (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
if (info_position >= 0 && BUFFER_POS () <= info_position)
|
|
|
|
|
if (info_cls)
|
|
|
|
|
printf ("(\"%s\" \"%s\" \"%s\" %d)\n",
|
|
|
|
|
info_cls->name, sym_scope (info_cls),
|
|
|
|
|
info_member->name, info_where);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse a member declaration within the class body of CLS. VIS is
|
|
|
|
|
the access specifier for the member (private, protected,
|
|
|
|
|
public). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
member (struct sym *cls, int vis)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
char *id = NULL;
|
|
|
|
|
int sc = SC_MEMBER;
|
|
|
|
|
char *regexp = NULL;
|
|
|
|
|
int pos;
|
|
|
|
|
int is_constructor;
|
|
|
|
|
int flags = 0;
|
|
|
|
|
int class_tag;
|
2019-01-03 12:07:05 +00:00
|
|
|
|
char *class_name;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
int type_seen = 0;
|
|
|
|
|
int paren_seen = 0;
|
|
|
|
|
unsigned hash = 0;
|
|
|
|
|
int tilde = 0;
|
|
|
|
|
|
|
|
|
|
while (!LOOKING_AT4 (';', '{', '}', YYEOF))
|
|
|
|
|
{
|
|
|
|
|
switch (LA1)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* A function or class may follow. */
|
|
|
|
|
case TEMPLATE:
|
2011-09-09 01:06:52 +00:00
|
|
|
|
MATCH ();
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_TEMPLATE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Skip over template argument list */
|
|
|
|
|
SKIP_MATCHING_IF ('<');
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EXPLICIT:
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_EXPLICIT);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
goto typeseen;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case MUTABLE:
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_MUTABLE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
goto typeseen;
|
|
|
|
|
|
|
|
|
|
case T_INLINE:
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_INLINE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
goto typeseen;
|
|
|
|
|
|
|
|
|
|
case VIRTUAL:
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_VIRTUAL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
goto typeseen;
|
|
|
|
|
|
|
|
|
|
case '[':
|
|
|
|
|
skip_matching ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ENUM:
|
|
|
|
|
sc = SC_TYPE;
|
|
|
|
|
goto typeseen;
|
|
|
|
|
|
|
|
|
|
case TYPEDEF:
|
|
|
|
|
sc = SC_TYPE;
|
|
|
|
|
goto typeseen;
|
|
|
|
|
|
|
|
|
|
case FRIEND:
|
|
|
|
|
sc = SC_FRIEND;
|
|
|
|
|
goto typeseen;
|
|
|
|
|
|
|
|
|
|
case STATIC:
|
|
|
|
|
sc = SC_STATIC;
|
|
|
|
|
goto typeseen;
|
|
|
|
|
|
|
|
|
|
case '~':
|
|
|
|
|
tilde = 1;
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDENT:
|
2001-01-22 11:52:45 +00:00
|
|
|
|
/* Remember IDENTS seen so far. Among these will be the member
|
|
|
|
|
name. */
|
|
|
|
|
id = (char *) xrealloc (id, strlen (yytext) + 2);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (tilde)
|
|
|
|
|
{
|
|
|
|
|
*id = '~';
|
|
|
|
|
strcpy (id + 1, yytext);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
strcpy (id, yytext);
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OPERATOR:
|
2001-01-22 11:52:45 +00:00
|
|
|
|
{
|
|
|
|
|
char *s = operator_name (&sc);
|
|
|
|
|
id = (char *) xrealloc (id, strlen (s) + 1);
|
|
|
|
|
strcpy (id, s);
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '(':
|
|
|
|
|
/* Most probably the beginning of a parameter list. */
|
|
|
|
|
MATCH ();
|
|
|
|
|
paren_seen = 1;
|
|
|
|
|
|
|
|
|
|
if (id && cls)
|
|
|
|
|
{
|
|
|
|
|
if (!(is_constructor = streq (id, cls->name)))
|
|
|
|
|
regexp = matching_regexp ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
is_constructor = 0;
|
|
|
|
|
|
|
|
|
|
pos = BUFFER_POS ();
|
|
|
|
|
hash = parm_list (&flags);
|
|
|
|
|
|
|
|
|
|
if (is_constructor)
|
|
|
|
|
regexp = matching_regexp ();
|
|
|
|
|
|
|
|
|
|
if (id && cls != NULL)
|
|
|
|
|
add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, flags);
|
|
|
|
|
|
|
|
|
|
while (!LOOKING_AT3 (';', '{', YYEOF))
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT ('{') && id && cls)
|
|
|
|
|
add_member_defn (cls, id, regexp, pos, hash, 0, sc, flags);
|
2001-01-22 11:52:45 +00:00
|
|
|
|
|
2008-06-02 06:02:30 +00:00
|
|
|
|
free (id);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
id = NULL;
|
|
|
|
|
sc = SC_MEMBER;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STRUCT: case UNION: case CLASS:
|
|
|
|
|
/* Nested class */
|
|
|
|
|
class_tag = LA1;
|
|
|
|
|
type_seen = 1;
|
|
|
|
|
MATCH ();
|
2019-01-03 12:07:05 +00:00
|
|
|
|
class_name = NULL;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* More than one ident here to allow for MS-DOS specialties
|
|
|
|
|
like `_export class' etc. The last IDENT seen counts
|
|
|
|
|
as the class name. */
|
|
|
|
|
while (!LOOKING_AT4 (YYEOF, ';', ':', '{'))
|
|
|
|
|
{
|
|
|
|
|
if (LOOKING_AT (IDENT))
|
2019-01-03 12:07:05 +00:00
|
|
|
|
{
|
|
|
|
|
if (class_name)
|
|
|
|
|
{
|
|
|
|
|
int size = strlen (yytext);
|
|
|
|
|
|
|
|
|
|
if(strlen (class_name) < size)
|
|
|
|
|
{
|
|
|
|
|
class_name = (char *) xrealloc(class_name, size + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy(class_name, yytext, size + 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
class_name = xstrdup(yytext);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MATCH ();
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT2 (':', '{'))
|
2019-01-03 12:07:05 +00:00
|
|
|
|
class_definition (class_name ? cls : NULL, class_name ? class_name : yytext, class_tag, flags, 1);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
else
|
|
|
|
|
skip_to (';');
|
2019-01-03 12:07:05 +00:00
|
|
|
|
|
|
|
|
|
free(class_name);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case INT: case CHAR: case LONG: case UNSIGNED:
|
|
|
|
|
case SIGNED: case CONST: case DOUBLE: case VOID:
|
|
|
|
|
case SHORT: case VOLATILE: case BOOL: case WCHAR:
|
|
|
|
|
case TYPENAME:
|
|
|
|
|
typeseen:
|
|
|
|
|
type_seen = 1;
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT (';'))
|
|
|
|
|
{
|
|
|
|
|
/* The end of a member variable, a friend declaration or an access
|
|
|
|
|
declaration. We don't want to add friend classes as members. */
|
|
|
|
|
if (id && sc != SC_FRIEND && cls)
|
|
|
|
|
{
|
|
|
|
|
regexp = matching_regexp ();
|
|
|
|
|
pos = BUFFER_POS ();
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (cls != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (type_seen || !paren_seen)
|
|
|
|
|
add_member_decl (cls, id, regexp, pos, 0, 1, sc, vis, 0);
|
|
|
|
|
else
|
|
|
|
|
add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
print_info ();
|
|
|
|
|
}
|
|
|
|
|
else if (LOOKING_AT ('{'))
|
|
|
|
|
{
|
|
|
|
|
/* A named enum. */
|
|
|
|
|
if (sc == SC_TYPE && id && cls)
|
|
|
|
|
{
|
|
|
|
|
regexp = matching_regexp ();
|
|
|
|
|
pos = BUFFER_POS ();
|
|
|
|
|
|
|
|
|
|
if (cls != NULL)
|
|
|
|
|
{
|
|
|
|
|
add_member_decl (cls, id, regexp, pos, 0, 1, sc, vis, 0);
|
|
|
|
|
add_member_defn (cls, id, regexp, pos, 0, 1, sc, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
skip_matching ();
|
|
|
|
|
print_info ();
|
|
|
|
|
}
|
2001-01-22 11:52:45 +00:00
|
|
|
|
|
2008-06-02 06:02:30 +00:00
|
|
|
|
free (id);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse the body of class CLS. TAG is the tag of the class (struct,
|
|
|
|
|
union, class). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
class_body (struct sym *cls, int tag)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int vis = tag == CLASS ? PRIVATE : PUBLIC;
|
|
|
|
|
int temp;
|
|
|
|
|
|
|
|
|
|
while (!LOOKING_AT2 (YYEOF, '}'))
|
|
|
|
|
{
|
|
|
|
|
switch (LA1)
|
|
|
|
|
{
|
|
|
|
|
case PRIVATE: case PROTECTED: case PUBLIC:
|
|
|
|
|
temp = LA1;
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT (':'))
|
|
|
|
|
{
|
|
|
|
|
vis = temp;
|
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Probably conditional compilation for inheritance list.
|
|
|
|
|
We don't known whether there comes more of this.
|
|
|
|
|
This is only a crude fix that works most of the time. */
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
while (LOOKING_AT2 (IDENT, ',')
|
|
|
|
|
|| LOOKING_AT3 (PUBLIC, PROTECTED, PRIVATE));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPENAME:
|
|
|
|
|
case USING:
|
|
|
|
|
skip_to (';');
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Try to synchronize */
|
|
|
|
|
case CHAR: case CLASS: case CONST:
|
|
|
|
|
case DOUBLE: case ENUM: case FLOAT: case INT:
|
|
|
|
|
case LONG: case SHORT: case SIGNED: case STRUCT:
|
|
|
|
|
case UNION: case UNSIGNED: case VOID: case VOLATILE:
|
|
|
|
|
case TYPEDEF: case STATIC: case T_INLINE: case FRIEND:
|
|
|
|
|
case VIRTUAL: case TEMPLATE: case IDENT: case '~':
|
|
|
|
|
case BOOL: case WCHAR: case EXPLICIT: case MUTABLE:
|
|
|
|
|
member (cls, vis);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse a qualified identifier. Current lookahead is IDENT. A
|
|
|
|
|
qualified ident has the form `X<..>::Y<...>::T<...>. Returns a
|
|
|
|
|
symbol for that class. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct sym *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
parse_classname (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct sym *last_class = NULL;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
while (LOOKING_AT (IDENT))
|
|
|
|
|
{
|
|
|
|
|
last_class = add_sym (yytext, last_class);
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT ('<'))
|
|
|
|
|
{
|
|
|
|
|
skip_matching ();
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&last_class->flags, F_TEMPLATE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (!LOOKING_AT (DCOLON))
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return last_class;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse an operator name. Add the `static' flag to *SC if an
|
|
|
|
|
implicitly static operator has been parsed. Value is a pointer to
|
|
|
|
|
a static buffer holding the constructed operator name string. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
operator_name (int *sc)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2011-03-21 18:03:15 +00:00
|
|
|
|
static size_t id_size = 0;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
static char *id = NULL;
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
const char *s;
|
2011-03-21 18:03:15 +00:00
|
|
|
|
size_t len;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT2 (NEW, DELETE))
|
|
|
|
|
{
|
|
|
|
|
/* `new' and `delete' are implicitly static. */
|
|
|
|
|
if (*sc != SC_FRIEND)
|
|
|
|
|
*sc = SC_STATIC;
|
|
|
|
|
|
|
|
|
|
s = token_string (LA1);
|
|
|
|
|
MATCH ();
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
ptrdiff_t slen = strlen (s);
|
|
|
|
|
len = slen + 10;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (len > id_size)
|
|
|
|
|
{
|
2011-03-21 18:03:15 +00:00
|
|
|
|
size_t new_size = max (len, 2 * id_size);
|
2000-07-14 17:59:55 +00:00
|
|
|
|
id = (char *) xrealloc (id, new_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
id_size = new_size;
|
|
|
|
|
}
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
char *z = stpcpy (id, s);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2001-12-19 06:03:57 +00:00
|
|
|
|
/* Vector new or delete? */
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (LOOKING_AT ('['))
|
|
|
|
|
{
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
z = stpcpy (z, "[");
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (LOOKING_AT (']'))
|
|
|
|
|
{
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
strcpy (z, "]");
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-03-21 18:03:15 +00:00
|
|
|
|
size_t tokens_matched = 0;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
len = 20;
|
|
|
|
|
if (len > id_size)
|
|
|
|
|
{
|
|
|
|
|
int new_size = max (len, 2 * id_size);
|
2000-07-14 17:59:55 +00:00
|
|
|
|
id = (char *) xrealloc (id, new_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
id_size = new_size;
|
|
|
|
|
}
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
char *z = stpcpy (id, "operator");
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Beware access declarations of the form "X::f;" Beware of
|
|
|
|
|
`operator () ()'. Yet another difficulty is found in
|
|
|
|
|
GCC 2.95's STL: `operator == __STL_NULL_TMPL_ARGS (...'. */
|
|
|
|
|
while (!(LOOKING_AT ('(') && tokens_matched)
|
|
|
|
|
&& !LOOKING_AT2 (';', YYEOF))
|
|
|
|
|
{
|
|
|
|
|
s = token_string (LA1);
|
|
|
|
|
len += strlen (s) + 2;
|
|
|
|
|
if (len > id_size)
|
|
|
|
|
{
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
ptrdiff_t idlen = z - id;
|
2011-03-21 18:03:15 +00:00
|
|
|
|
size_t new_size = max (len, 2 * id_size);
|
2000-07-14 17:59:55 +00:00
|
|
|
|
id = (char *) xrealloc (id, new_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
id_size = new_size;
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
z = id + idlen;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*s != ')' && *s != ']')
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
*z++ = ' ';
|
|
|
|
|
z = stpcpy (z, s);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
/* If this is a simple operator like `+', stop now. */
|
2000-12-15 14:33:39 +00:00
|
|
|
|
if (!isalpha ((unsigned char) *s) && *s != '(' && *s != '[')
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
++tokens_matched;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* This one consumes the last IDENT of a qualified member name like
|
2001-10-01 07:25:14 +00:00
|
|
|
|
`X::Y::z'. This IDENT is returned in LAST_ID. Value is the
|
2000-04-09 11:15:57 +00:00
|
|
|
|
symbol structure for the ident. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static struct sym *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
parse_qualified_ident_or_type (char **last_id)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct sym *cls = NULL;
|
2001-03-02 12:34:45 +00:00
|
|
|
|
char *id = NULL;
|
|
|
|
|
size_t id_size = 0;
|
2001-10-01 07:25:14 +00:00
|
|
|
|
int enter = 0;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
while (LOOKING_AT (IDENT))
|
|
|
|
|
{
|
|
|
|
|
int len = strlen (yytext) + 1;
|
|
|
|
|
if (len > id_size)
|
|
|
|
|
{
|
2000-07-14 17:59:55 +00:00
|
|
|
|
id = (char *) xrealloc (id, len);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
id_size = len;
|
|
|
|
|
}
|
|
|
|
|
strcpy (id, yytext);
|
|
|
|
|
*last_id = id;
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
SKIP_MATCHING_IF ('<');
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT (DCOLON))
|
|
|
|
|
{
|
2001-10-01 07:25:14 +00:00
|
|
|
|
struct sym *pcn = NULL;
|
|
|
|
|
struct link *pna = check_namespace_alias (id);
|
|
|
|
|
if (pna)
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
enter_namespace (pna->sym->name);
|
|
|
|
|
enter++;
|
|
|
|
|
pna = pna->next;
|
|
|
|
|
}
|
|
|
|
|
while (pna);
|
|
|
|
|
}
|
|
|
|
|
else if ((pcn = check_namespace (id, current_namespace)))
|
|
|
|
|
{
|
|
|
|
|
enter_namespace (pcn->name);
|
|
|
|
|
enter++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cls = add_sym (id, cls);
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
*last_id = NULL;
|
2008-06-02 06:02:30 +00:00
|
|
|
|
free (id);
|
2001-03-02 12:34:45 +00:00
|
|
|
|
id = NULL;
|
|
|
|
|
id_size = 0;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-01 07:25:14 +00:00
|
|
|
|
while (enter--)
|
2011-09-09 01:06:52 +00:00
|
|
|
|
leave_namespace ();
|
2001-10-01 07:25:14 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return cls;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* This one consumes the last IDENT of a qualified member name like
|
2001-10-01 07:25:14 +00:00
|
|
|
|
`X::Y::z'. This IDENT is returned in LAST_ID. Value is the
|
2000-04-09 11:15:57 +00:00
|
|
|
|
symbol structure for the ident. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
parse_qualified_param_ident_or_type (char **last_id)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct sym *cls = NULL;
|
|
|
|
|
static char *id = NULL;
|
|
|
|
|
static int id_size = 0;
|
2000-07-03 07:50:42 +00:00
|
|
|
|
|
2011-02-26 05:41:42 +00:00
|
|
|
|
assert (LOOKING_AT (IDENT));
|
|
|
|
|
|
|
|
|
|
do
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int len = strlen (yytext) + 1;
|
|
|
|
|
if (len > id_size)
|
|
|
|
|
{
|
2000-07-14 17:59:55 +00:00
|
|
|
|
id = (char *) xrealloc (id, len);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
id_size = len;
|
|
|
|
|
}
|
|
|
|
|
strcpy (id, yytext);
|
|
|
|
|
*last_id = id;
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
SKIP_MATCHING_IF ('<');
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT (DCOLON))
|
|
|
|
|
{
|
|
|
|
|
cls = add_sym (id, cls);
|
|
|
|
|
*last_id = NULL;
|
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
2011-02-26 05:41:42 +00:00
|
|
|
|
while (LOOKING_AT (IDENT));
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse a class definition.
|
|
|
|
|
|
|
|
|
|
CONTAINING is the class containing the class being parsed or null.
|
|
|
|
|
This may also be null if NESTED != 0 if the containing class is
|
|
|
|
|
anonymous. TAG is the tag of the class (struct, union, class).
|
|
|
|
|
NESTED is non-zero if we are parsing a nested class.
|
|
|
|
|
|
|
|
|
|
Current lookahead is the class name. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2019-01-03 12:07:05 +00:00
|
|
|
|
class_definition (struct sym *containing, const char *class_name, int tag, int flags, int nested)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
struct sym *current;
|
|
|
|
|
struct sym *base_class;
|
|
|
|
|
|
|
|
|
|
/* Set CURRENT to null if no entry has to be made for the class
|
|
|
|
|
parsed. This is the case for certain command line flag
|
|
|
|
|
settings. */
|
|
|
|
|
if ((tag != CLASS && !f_structs) || (nested && !f_nested_classes))
|
|
|
|
|
current = NULL;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
else
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2019-01-03 12:07:05 +00:00
|
|
|
|
current = add_sym (class_name, containing);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
current->pos = BUFFER_POS ();
|
|
|
|
|
current->regexp = matching_regexp ();
|
|
|
|
|
current->filename = filename;
|
|
|
|
|
current->flags = flags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If at ':', base class list follows. */
|
|
|
|
|
if (LOOKING_AT (':'))
|
|
|
|
|
{
|
|
|
|
|
int done = 0;
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
while (!done)
|
|
|
|
|
{
|
2000-04-19 14:30:52 +00:00
|
|
|
|
switch (LA1)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2003-02-04 14:56:31 +00:00
|
|
|
|
case VIRTUAL: case PUBLIC: case PROTECTED: case PRIVATE:
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDENT:
|
|
|
|
|
base_class = parse_classname ();
|
|
|
|
|
if (base_class && current && base_class != current)
|
|
|
|
|
add_link (base_class, current);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* The `,' between base classes or the end of the base
|
|
|
|
|
class list. Add the previously found base class.
|
|
|
|
|
It's done this way to skip over sequences of
|
|
|
|
|
`A::B::C' until we reach the end.
|
|
|
|
|
|
|
|
|
|
FIXME: it is now possible to handle `class X : public B::X'
|
|
|
|
|
because we have enough information. */
|
|
|
|
|
case ',':
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
/* A syntax error, possibly due to preprocessor constructs
|
|
|
|
|
like
|
|
|
|
|
|
|
|
|
|
#ifdef SOMETHING
|
|
|
|
|
class A : public B
|
|
|
|
|
#else
|
|
|
|
|
class A : private B.
|
|
|
|
|
|
|
|
|
|
MATCH until we see something like `;' or `{'. */
|
|
|
|
|
while (!LOOKING_AT3 (';', YYEOF, '{'))
|
|
|
|
|
MATCH ();
|
Merge with gnulib, pacifying GCC 7
This incorporates:
2017-05-16 manywarnings: update for GCC 7
2017-05-15 sys_select: Avoid "was expanded before it was required"
* configure.ac (nw): Suppress GCC 7’s new -Wduplicated-branches and
-Wformat-overflow=2 options, due to too many false alarms.
* doc/misc/texinfo.tex, lib/strftime.c, m4/manywarnings.m4:
Copy from gnulib.
* m4/gnulib-comp.m4: Regenerate.
* src/coding.c (decode_coding_iso_2022):
Fix bug uncovered by -Wimplicit-fallthrough.
* src/conf_post.h (FALLTHROUGH): New macro.
Use it to mark all switch cases that fall through.
* src/editfns.c (styled_format): Use !, not ~, on bool.
* src/gtkutil.c (xg_check_special_colors):
When using sprintf, don’t trust Gtk to output colors in [0, 1] range.
(xg_update_scrollbar_pos): Avoid use of possibly-uninitialized bool;
this bug was actually caught by Clang.
* src/search.c (boyer_moore):
Tell GCC that CHAR_BASE, if nonzero, must be a non-ASCII character.
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
Tell GCC that glyph->u.glyphless.ch must be a character.
2017-05-16 17:24:19 +00:00
|
|
|
|
FALLTHROUGH;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case '{':
|
|
|
|
|
done = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse the class body if there is one. */
|
|
|
|
|
if (LOOKING_AT ('{'))
|
|
|
|
|
{
|
|
|
|
|
if (tag != CLASS && !f_structs)
|
|
|
|
|
skip_matching ();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
class_body (current, tag);
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT ('}'))
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
if (LOOKING_AT (';') && !nested)
|
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-29 11:20:40 +00:00
|
|
|
|
/* Add to class *CLS information for the declaration of variable or
|
|
|
|
|
type *ID. If *CLS is null, this means a global declaration. SC is
|
|
|
|
|
the storage class of *ID. FLAGS is a bit set giving additional
|
|
|
|
|
information about the member (see the F_* defines). */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_declarator (struct sym **cls, char **id, int flags, int sc)
|
2002-03-29 11:20:40 +00:00
|
|
|
|
{
|
|
|
|
|
if (LOOKING_AT2 (';', ','))
|
|
|
|
|
{
|
|
|
|
|
/* The end of a member variable or of an access declaration
|
|
|
|
|
`X::f'. To distinguish between them we have to know whether
|
|
|
|
|
type information has been seen. */
|
|
|
|
|
if (*id)
|
|
|
|
|
{
|
|
|
|
|
char *regexp = matching_regexp ();
|
|
|
|
|
int pos = BUFFER_POS ();
|
|
|
|
|
|
2002-04-21 12:49:36 +00:00
|
|
|
|
if (*cls)
|
2002-03-30 07:40:54 +00:00
|
|
|
|
add_member_defn (*cls, *id, regexp, pos, 0, 1, SC_UNKNOWN, flags);
|
2002-03-29 11:20:40 +00:00
|
|
|
|
else
|
|
|
|
|
add_global_defn (*id, regexp, pos, 0, 1, sc, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MATCH ();
|
|
|
|
|
print_info ();
|
|
|
|
|
}
|
|
|
|
|
else if (LOOKING_AT ('{'))
|
|
|
|
|
{
|
|
|
|
|
if (sc == SC_TYPE && *id)
|
|
|
|
|
{
|
|
|
|
|
/* A named enumeration. */
|
|
|
|
|
char *regexp = matching_regexp ();
|
|
|
|
|
int pos = BUFFER_POS ();
|
|
|
|
|
add_global_defn (*id, regexp, pos, 0, 1, sc, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
skip_matching ();
|
|
|
|
|
print_info ();
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-02 06:02:30 +00:00
|
|
|
|
free (*id);
|
2002-03-29 11:20:40 +00:00
|
|
|
|
*id = NULL;
|
|
|
|
|
*cls = NULL;
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Parse a declaration. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
declaration (int flags)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
char *id = NULL;
|
|
|
|
|
struct sym *cls = NULL;
|
|
|
|
|
char *regexp = NULL;
|
|
|
|
|
int pos = 0;
|
|
|
|
|
unsigned hash = 0;
|
|
|
|
|
int is_constructor;
|
|
|
|
|
int sc = 0;
|
|
|
|
|
|
|
|
|
|
while (!LOOKING_AT3 (';', '{', YYEOF))
|
|
|
|
|
{
|
|
|
|
|
switch (LA1)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '[':
|
|
|
|
|
skip_matching ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ENUM:
|
|
|
|
|
case TYPEDEF:
|
|
|
|
|
sc = SC_TYPE;
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case STATIC:
|
|
|
|
|
sc = SC_STATIC;
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case INT: case CHAR: case LONG: case UNSIGNED:
|
|
|
|
|
case SIGNED: case CONST: case DOUBLE: case VOID:
|
|
|
|
|
case SHORT: case VOLATILE: case BOOL: case WCHAR:
|
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CLASS: case STRUCT: case UNION:
|
|
|
|
|
/* This is for the case `STARTWRAP class X : ...' or
|
|
|
|
|
`declare (X, Y)\n class A : ...'. */
|
|
|
|
|
if (id)
|
2001-01-22 11:52:45 +00:00
|
|
|
|
{
|
2008-06-02 06:02:30 +00:00
|
|
|
|
free (id);
|
2001-01-22 11:52:45 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
Merge with gnulib, pacifying GCC 7
This incorporates:
2017-05-16 manywarnings: update for GCC 7
2017-05-15 sys_select: Avoid "was expanded before it was required"
* configure.ac (nw): Suppress GCC 7’s new -Wduplicated-branches and
-Wformat-overflow=2 options, due to too many false alarms.
* doc/misc/texinfo.tex, lib/strftime.c, m4/manywarnings.m4:
Copy from gnulib.
* m4/gnulib-comp.m4: Regenerate.
* src/coding.c (decode_coding_iso_2022):
Fix bug uncovered by -Wimplicit-fallthrough.
* src/conf_post.h (FALLTHROUGH): New macro.
Use it to mark all switch cases that fall through.
* src/editfns.c (styled_format): Use !, not ~, on bool.
* src/gtkutil.c (xg_check_special_colors):
When using sprintf, don’t trust Gtk to output colors in [0, 1] range.
(xg_update_scrollbar_pos): Avoid use of possibly-uninitialized bool;
this bug was actually caught by Clang.
* src/search.c (boyer_moore):
Tell GCC that CHAR_BASE, if nonzero, must be a non-ASCII character.
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
Tell GCC that glyph->u.glyphless.ch must be a character.
2017-05-16 17:24:19 +00:00
|
|
|
|
FALLTHROUGH;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case '=':
|
2002-03-29 11:20:40 +00:00
|
|
|
|
/* Assumed to be the start of an initialization in this
|
|
|
|
|
context. */
|
|
|
|
|
skip_initializer ();
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2002-03-29 11:20:40 +00:00
|
|
|
|
case ',':
|
|
|
|
|
add_declarator (&cls, &id, flags, sc);
|
|
|
|
|
break;
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case OPERATOR:
|
2001-01-22 11:52:45 +00:00
|
|
|
|
{
|
|
|
|
|
char *s = operator_name (&sc);
|
|
|
|
|
id = (char *) xrealloc (id, strlen (s) + 1);
|
|
|
|
|
strcpy (id, s);
|
|
|
|
|
}
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case T_INLINE:
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_INLINE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '~':
|
|
|
|
|
MATCH ();
|
|
|
|
|
if (LOOKING_AT (IDENT))
|
|
|
|
|
{
|
2001-01-22 11:52:45 +00:00
|
|
|
|
id = (char *) xrealloc (id, strlen (yytext) + 2);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
*id = '~';
|
|
|
|
|
strcpy (id + 1, yytext);
|
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IDENT:
|
|
|
|
|
cls = parse_qualified_ident_or_type (&id);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '(':
|
|
|
|
|
/* Most probably the beginning of a parameter list. */
|
|
|
|
|
if (cls)
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (id && cls)
|
|
|
|
|
{
|
|
|
|
|
if (!(is_constructor = streq (id, cls->name)))
|
|
|
|
|
regexp = matching_regexp ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
is_constructor = 0;
|
|
|
|
|
|
|
|
|
|
pos = BUFFER_POS ();
|
|
|
|
|
hash = parm_list (&flags);
|
|
|
|
|
|
|
|
|
|
if (is_constructor)
|
|
|
|
|
regexp = matching_regexp ();
|
|
|
|
|
|
|
|
|
|
if (id && cls)
|
|
|
|
|
add_member_defn (cls, id, regexp, pos, hash, 0,
|
|
|
|
|
SC_UNKNOWN, flags);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* This may be a C functions, but also a macro
|
|
|
|
|
call of the form `declare (A, B)' --- such macros
|
|
|
|
|
can be found in some class libraries. */
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (id)
|
|
|
|
|
{
|
|
|
|
|
regexp = matching_regexp ();
|
|
|
|
|
pos = BUFFER_POS ();
|
|
|
|
|
hash = parm_list (&flags);
|
|
|
|
|
add_global_decl (id, regexp, pos, hash, 0, sc, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This is for the case that the function really is
|
|
|
|
|
a macro with no `;' following it. If a CLASS directly
|
|
|
|
|
follows, we would miss it otherwise. */
|
|
|
|
|
if (LOOKING_AT3 (CLASS, STRUCT, UNION))
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!LOOKING_AT3 (';', '{', YYEOF))
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (!cls && id && LOOKING_AT ('{'))
|
|
|
|
|
add_global_defn (id, regexp, pos, hash, 0, sc, flags);
|
2001-01-22 11:52:45 +00:00
|
|
|
|
|
2008-06-02 06:02:30 +00:00
|
|
|
|
free (id);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
id = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-29 11:20:40 +00:00
|
|
|
|
add_declarator (&cls, &id, flags, sc);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse a list of top-level declarations/definitions. START_FLAGS
|
|
|
|
|
says in which context we are parsing. If it is F_EXTERNC, we are
|
|
|
|
|
parsing in an `extern "C"' block. Value is 1 if EOF is reached, 0
|
|
|
|
|
otherwise. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
|
globals (int start_flags)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int class_tk;
|
2019-01-03 12:07:05 +00:00
|
|
|
|
char *class_name;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
int flags = start_flags;
|
|
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
char *prev_in = in;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
switch (LA1)
|
|
|
|
|
{
|
|
|
|
|
case NAMESPACE:
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
|
|
|
|
|
if (LOOKING_AT (IDENT))
|
|
|
|
|
{
|
2001-01-22 11:52:45 +00:00
|
|
|
|
char *namespace_name = xstrdup (yytext);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (LOOKING_AT ('='))
|
|
|
|
|
{
|
2001-10-01 07:25:14 +00:00
|
|
|
|
struct link *qna = match_qualified_namespace_alias ();
|
|
|
|
|
if (qna)
|
|
|
|
|
register_namespace_alias (namespace_name, qna);
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (skip_to (';') == ';')
|
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
else if (LOOKING_AT ('{'))
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
enter_namespace (namespace_name);
|
|
|
|
|
globals (0);
|
|
|
|
|
leave_namespace ();
|
|
|
|
|
MATCH_IF ('}');
|
|
|
|
|
}
|
2001-01-22 11:52:45 +00:00
|
|
|
|
|
2008-06-02 06:02:30 +00:00
|
|
|
|
free (namespace_name);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EXTERN:
|
|
|
|
|
MATCH ();
|
|
|
|
|
if (LOOKING_AT (CSTRING) && *string_start == 'C'
|
|
|
|
|
&& *(string_start + 1) == '"')
|
|
|
|
|
{
|
|
|
|
|
/* This is `extern "C"'. */
|
|
|
|
|
MATCH ();
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (LOOKING_AT ('{'))
|
|
|
|
|
{
|
|
|
|
|
MATCH ();
|
|
|
|
|
globals (F_EXTERNC);
|
|
|
|
|
MATCH_IF ('}');
|
|
|
|
|
}
|
|
|
|
|
else
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_EXTERNC);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case TEMPLATE:
|
|
|
|
|
MATCH ();
|
|
|
|
|
SKIP_MATCHING_IF ('<');
|
Unmacroize ebrowse.c and etags.c a bit
* lib-src/ebrowse.c (READ_CHUNK_SIZE): Now an enum constant.
(streq, filename_eq, set_flag, has_flag): Now inline functions.
(set_flag): First arg is now an address, not an lvalue.
All callers changed.
(filename_eq, set_flag, has_flag):
Rename from FILENAME_EQ, SET_FLAG, HAS_FLAG.
All callers changed.
* lib-src/etags.c (streq, strcaseeq, strneq, strncaseeq):
Now inline functions. Remove asserts that are unnecessary these
days (and in some cases were too-generous anyway).
2015-10-12 22:30:18 +00:00
|
|
|
|
set_flag (&flags, F_TEMPLATE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CLASS: case STRUCT: case UNION:
|
|
|
|
|
class_tk = LA1;
|
|
|
|
|
MATCH ();
|
2019-01-03 12:07:05 +00:00
|
|
|
|
class_name = NULL;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* More than one ident here to allow for MS-DOS and OS/2
|
|
|
|
|
specialties like `far', `_Export' etc. Some C++ libs
|
|
|
|
|
have constructs like `_OS_DLLIMPORT(_OS_CLIENT)' in front
|
|
|
|
|
of the class name. */
|
|
|
|
|
while (!LOOKING_AT4 (YYEOF, ';', ':', '{'))
|
|
|
|
|
{
|
|
|
|
|
if (LOOKING_AT (IDENT))
|
2019-01-03 12:07:05 +00:00
|
|
|
|
{
|
|
|
|
|
if (class_name)
|
|
|
|
|
{
|
|
|
|
|
int size = strlen (yytext);
|
|
|
|
|
|
|
|
|
|
if(strlen (class_name) < size)
|
|
|
|
|
{
|
|
|
|
|
class_name = (char *) xrealloc(class_name, size + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy(class_name, yytext, size + 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
class_name = xstrdup(yytext);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Don't add anonymous unions. */
|
2019-01-03 12:07:05 +00:00
|
|
|
|
if (LOOKING_AT2 (':', '{') && class_name)
|
|
|
|
|
class_definition (NULL, class_name, class_tk, flags, 0);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (skip_to (';') == ';')
|
|
|
|
|
MATCH ();
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-03 12:07:05 +00:00
|
|
|
|
free(class_name);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
flags = start_flags;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case YYEOF:
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
case '}':
|
|
|
|
|
return 0;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
default:
|
2000-04-19 14:30:52 +00:00
|
|
|
|
declaration (flags);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
flags = start_flags;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (prev_in == in)
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("parse error", NULL);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse the current input file. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
yyparse (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
while (globals (0) == 0)
|
|
|
|
|
MATCH_IF ('}');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
Main Program
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Add the list of paths PATH_LIST to the current search path for
|
|
|
|
|
input files. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
add_search_path (char *path_list)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
while (*path_list)
|
|
|
|
|
{
|
|
|
|
|
char *start = path_list;
|
|
|
|
|
struct search_path *p;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2012-08-09 23:53:07 +00:00
|
|
|
|
while (*path_list && *path_list != SEPCHAR)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
++path_list;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-07-14 17:59:55 +00:00
|
|
|
|
p = (struct search_path *) xmalloc (sizeof *p);
|
|
|
|
|
p->path = (char *) xmalloc (path_list - start + 1);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
memcpy (p->path, start, path_list - start);
|
|
|
|
|
p->path[path_list - start] = '\0';
|
|
|
|
|
p->next = NULL;
|
|
|
|
|
|
|
|
|
|
if (search_path_tail)
|
|
|
|
|
{
|
|
|
|
|
search_path_tail->next = p;
|
|
|
|
|
search_path_tail = p;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
search_path = search_path_tail = p;
|
|
|
|
|
|
2012-08-09 23:53:07 +00:00
|
|
|
|
while (*path_list == SEPCHAR)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
++path_list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Open FILE and return a file handle for it, or -1 if FILE cannot be
|
|
|
|
|
opened. Try to find FILE in search_path first, then try the
|
|
|
|
|
unchanged file name. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static FILE *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
open_file (char *file)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
FILE *fp = NULL;
|
|
|
|
|
static char *buffer;
|
|
|
|
|
static int buffer_size;
|
|
|
|
|
struct search_path *path;
|
2000-05-02 11:01:29 +00:00
|
|
|
|
int flen = strlen (file) + 1; /* +1 for the slash */
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
filename = xstrdup (file);
|
|
|
|
|
|
|
|
|
|
for (path = search_path; path && fp == NULL; path = path->next)
|
|
|
|
|
{
|
2000-05-02 11:01:29 +00:00
|
|
|
|
int len = strlen (path->path) + flen;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
if (len + 1 >= buffer_size)
|
|
|
|
|
{
|
|
|
|
|
buffer_size = max (len + 1, 2 * buffer_size);
|
2000-07-14 17:59:55 +00:00
|
|
|
|
buffer = (char *) xrealloc (buffer, buffer_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
|
char *z = stpcpy (buffer, path->path);
|
|
|
|
|
*z++ = '/';
|
|
|
|
|
strcpy (z, file);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
fp = fopen (buffer, "r");
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Try the original file name. */
|
|
|
|
|
if (fp == NULL)
|
|
|
|
|
fp = fopen (file, "r");
|
|
|
|
|
|
|
|
|
|
if (fp == NULL)
|
2001-01-02 14:32:37 +00:00
|
|
|
|
yyerror ("cannot open", NULL);
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return fp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Display usage information and exit program. */
|
|
|
|
|
|
Port to C89.
* lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ...
(usage_message): ... and replace it with this new static constant
containing multiple literals. All uses changed.
* lib-src/emacsclient.c (print_help_and_exit):
Rewrite to avoid string literals longer than the C89 limits.
(start_daemon_and_retry_set_socket):
Rewrite to avoid non-constant array initializer.
* lib-src/make-docfile.c (enum global_type): Omit trailing comma.
* src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
(B__dummy__): New dummy symbol, to pacify C89.
* src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
they can't grok varargs macros.
* src/dispnew.c (add_window_display_history)
(add_frame_display_history):
* src/print.c (print_object):
* src/xdisp.c (debug_method_add):
Use %p printf format only for void pointers.
* src/emacs.c (usage_message): New constant, replacing ...
(USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
(main): Adjust to usage reorg.
* src/fns.c (syms_of_fns):
* src/profiler.c (syms_of_profiler):
Don't use non-constant struct initializers.
* src/gnutls.h (gnutls_initstage_t):
* src/lisp.h (enum Lisp_Fwd_Type):
* src/lread.c (lisp_file_lexically_bound_p):
* src/xsettings.c (anonymous enum):
Remove trailing comma.
* src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
* src/lisp.h (ENUM_BF): Use unsigned if pedantic.
(DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
(DEFUN): Use it.
* src/regex.c (const_re_char): New type, to pacify strict C89.
All uses of 'const re_char' replaced to use it.
* src/regex.h (_Restrict_): Rename from __restrict, to avoid clash
with glibc when strict C89. This change is imported from gnulib.
All uses changed.
(_Restrict_arr_): Rename from __restrict_arr, similarly.
* src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
Omit GNU_LINUX implementation, since it requires long long.
* src/xterm.c (x_draw_underwave):
Do not assume the traditional order of struct's members.
(x_term_init): Rewrite to avoid the need for non-constant structure
initializers.
2013-07-10 23:23:57 +00:00
|
|
|
|
static char const *const usage_message[] =
|
|
|
|
|
{
|
|
|
|
|
"\
|
2000-04-09 11:15:57 +00:00
|
|
|
|
Usage: ebrowse [options] {files}\n\
|
|
|
|
|
\n\
|
2001-07-16 11:20:25 +00:00
|
|
|
|
-a, --append append output to existing file\n\
|
2000-04-09 11:15:57 +00:00
|
|
|
|
-f, --files=FILES read input file names from FILE\n\
|
|
|
|
|
-I, --search-path=LIST set search path for input files\n\
|
|
|
|
|
-m, --min-regexp-length=N set minimum regexp length to N\n\
|
|
|
|
|
-M, --max-regexp-length=N set maximum regexp length to N\n\
|
Port to C89.
* lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ...
(usage_message): ... and replace it with this new static constant
containing multiple literals. All uses changed.
* lib-src/emacsclient.c (print_help_and_exit):
Rewrite to avoid string literals longer than the C89 limits.
(start_daemon_and_retry_set_socket):
Rewrite to avoid non-constant array initializer.
* lib-src/make-docfile.c (enum global_type): Omit trailing comma.
* src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
(B__dummy__): New dummy symbol, to pacify C89.
* src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
they can't grok varargs macros.
* src/dispnew.c (add_window_display_history)
(add_frame_display_history):
* src/print.c (print_object):
* src/xdisp.c (debug_method_add):
Use %p printf format only for void pointers.
* src/emacs.c (usage_message): New constant, replacing ...
(USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
(main): Adjust to usage reorg.
* src/fns.c (syms_of_fns):
* src/profiler.c (syms_of_profiler):
Don't use non-constant struct initializers.
* src/gnutls.h (gnutls_initstage_t):
* src/lisp.h (enum Lisp_Fwd_Type):
* src/lread.c (lisp_file_lexically_bound_p):
* src/xsettings.c (anonymous enum):
Remove trailing comma.
* src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
* src/lisp.h (ENUM_BF): Use unsigned if pedantic.
(DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
(DEFUN): Use it.
* src/regex.c (const_re_char): New type, to pacify strict C89.
All uses of 'const re_char' replaced to use it.
* src/regex.h (_Restrict_): Rename from __restrict, to avoid clash
with glibc when strict C89. This change is imported from gnulib.
All uses changed.
(_Restrict_arr_): Rename from __restrict_arr, similarly.
* src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
Omit GNU_LINUX implementation, since it requires long long.
* src/xterm.c (x_draw_underwave):
Do not assume the traditional order of struct's members.
(x_term_init): Rewrite to avoid the need for non-constant structure
initializers.
2013-07-10 23:23:57 +00:00
|
|
|
|
",
|
|
|
|
|
"\
|
2000-04-09 11:15:57 +00:00
|
|
|
|
-n, --no-nested-classes exclude nested classes\n\
|
|
|
|
|
-o, --output-file=FILE set output file name to FILE\n\
|
|
|
|
|
-p, --position-info print info about position in file\n\
|
|
|
|
|
-s, --no-structs-or-unions don't record structs or unions\n\
|
|
|
|
|
-v, --verbose be verbose\n\
|
|
|
|
|
-V, --very-verbose be very verbose\n\
|
|
|
|
|
-x, --no-regexps don't record regular expressions\n\
|
|
|
|
|
--help display this help\n\
|
|
|
|
|
--version display version info\n\
|
Port to C89.
* lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ...
(usage_message): ... and replace it with this new static constant
containing multiple literals. All uses changed.
* lib-src/emacsclient.c (print_help_and_exit):
Rewrite to avoid string literals longer than the C89 limits.
(start_daemon_and_retry_set_socket):
Rewrite to avoid non-constant array initializer.
* lib-src/make-docfile.c (enum global_type): Omit trailing comma.
* src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
(B__dummy__): New dummy symbol, to pacify C89.
* src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
they can't grok varargs macros.
* src/dispnew.c (add_window_display_history)
(add_frame_display_history):
* src/print.c (print_object):
* src/xdisp.c (debug_method_add):
Use %p printf format only for void pointers.
* src/emacs.c (usage_message): New constant, replacing ...
(USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
(main): Adjust to usage reorg.
* src/fns.c (syms_of_fns):
* src/profiler.c (syms_of_profiler):
Don't use non-constant struct initializers.
* src/gnutls.h (gnutls_initstage_t):
* src/lisp.h (enum Lisp_Fwd_Type):
* src/lread.c (lisp_file_lexically_bound_p):
* src/xsettings.c (anonymous enum):
Remove trailing comma.
* src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
* src/lisp.h (ENUM_BF): Use unsigned if pedantic.
(DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
(DEFUN): Use it.
* src/regex.c (const_re_char): New type, to pacify strict C89.
All uses of 'const re_char' replaced to use it.
* src/regex.h (_Restrict_): Rename from __restrict, to avoid clash
with glibc when strict C89. This change is imported from gnulib.
All uses changed.
(_Restrict_arr_): Rename from __restrict_arr, similarly.
* src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
Omit GNU_LINUX implementation, since it requires long long.
* src/xterm.c (x_draw_underwave):
Do not assume the traditional order of struct's members.
(x_term_init): Rewrite to avoid the need for non-constant structure
initializers.
2013-07-10 23:23:57 +00:00
|
|
|
|
\n\
|
2000-04-09 11:15:57 +00:00
|
|
|
|
"
|
Port to C89.
* lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ...
(usage_message): ... and replace it with this new static constant
containing multiple literals. All uses changed.
* lib-src/emacsclient.c (print_help_and_exit):
Rewrite to avoid string literals longer than the C89 limits.
(start_daemon_and_retry_set_socket):
Rewrite to avoid non-constant array initializer.
* lib-src/make-docfile.c (enum global_type): Omit trailing comma.
* src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
(B__dummy__): New dummy symbol, to pacify C89.
* src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
they can't grok varargs macros.
* src/dispnew.c (add_window_display_history)
(add_frame_display_history):
* src/print.c (print_object):
* src/xdisp.c (debug_method_add):
Use %p printf format only for void pointers.
* src/emacs.c (usage_message): New constant, replacing ...
(USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
(main): Adjust to usage reorg.
* src/fns.c (syms_of_fns):
* src/profiler.c (syms_of_profiler):
Don't use non-constant struct initializers.
* src/gnutls.h (gnutls_initstage_t):
* src/lisp.h (enum Lisp_Fwd_Type):
* src/lread.c (lisp_file_lexically_bound_p):
* src/xsettings.c (anonymous enum):
Remove trailing comma.
* src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
* src/lisp.h (ENUM_BF): Use unsigned if pedantic.
(DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
(DEFUN): Use it.
* src/regex.c (const_re_char): New type, to pacify strict C89.
All uses of 'const re_char' replaced to use it.
* src/regex.h (_Restrict_): Rename from __restrict, to avoid clash
with glibc when strict C89. This change is imported from gnulib.
All uses changed.
(_Restrict_arr_): Rename from __restrict_arr, similarly.
* src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
Omit GNU_LINUX implementation, since it requires long long.
* src/xterm.c (x_draw_underwave):
Do not assume the traditional order of struct's members.
(x_term_init): Rewrite to avoid the need for non-constant structure
initializers.
2013-07-10 23:23:57 +00:00
|
|
|
|
};
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
2012-06-24 17:39:14 +00:00
|
|
|
|
static _Noreturn void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
usage (int error)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
Port to C89.
* lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ...
(usage_message): ... and replace it with this new static constant
containing multiple literals. All uses changed.
* lib-src/emacsclient.c (print_help_and_exit):
Rewrite to avoid string literals longer than the C89 limits.
(start_daemon_and_retry_set_socket):
Rewrite to avoid non-constant array initializer.
* lib-src/make-docfile.c (enum global_type): Omit trailing comma.
* src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
(B__dummy__): New dummy symbol, to pacify C89.
* src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
they can't grok varargs macros.
* src/dispnew.c (add_window_display_history)
(add_frame_display_history):
* src/print.c (print_object):
* src/xdisp.c (debug_method_add):
Use %p printf format only for void pointers.
* src/emacs.c (usage_message): New constant, replacing ...
(USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
(main): Adjust to usage reorg.
* src/fns.c (syms_of_fns):
* src/profiler.c (syms_of_profiler):
Don't use non-constant struct initializers.
* src/gnutls.h (gnutls_initstage_t):
* src/lisp.h (enum Lisp_Fwd_Type):
* src/lread.c (lisp_file_lexically_bound_p):
* src/xsettings.c (anonymous enum):
Remove trailing comma.
* src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
* src/lisp.h (ENUM_BF): Use unsigned if pedantic.
(DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
(DEFUN): Use it.
* src/regex.c (const_re_char): New type, to pacify strict C89.
All uses of 'const re_char' replaced to use it.
* src/regex.h (_Restrict_): Rename from __restrict, to avoid clash
with glibc when strict C89. This change is imported from gnulib.
All uses changed.
(_Restrict_arr_): Rename from __restrict_arr, similarly.
* src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
Omit GNU_LINUX implementation, since it requires long long.
* src/xterm.c (x_draw_underwave):
Do not assume the traditional order of struct's members.
(x_term_init): Rewrite to avoid the need for non-constant structure
initializers.
2013-07-10 23:23:57 +00:00
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++)
|
|
|
|
|
fputs (usage_message[i], stdout);
|
2004-05-08 15:26:33 +00:00
|
|
|
|
exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-06-20 15:56:22 +00:00
|
|
|
|
/* Display version and copyright info. */
|
2000-12-06 13:42:18 +00:00
|
|
|
|
|
2012-06-24 17:39:14 +00:00
|
|
|
|
static _Noreturn void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
version (void)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
2019-06-20 15:56:22 +00:00
|
|
|
|
fputs (("ebrowse " PACKAGE_VERSION "\n"
|
|
|
|
|
COPYRIGHT "\n"
|
|
|
|
|
"This program is distributed under the same terms as Emacs.\n"),
|
|
|
|
|
stdout);
|
2004-05-08 15:26:33 +00:00
|
|
|
|
exit (EXIT_SUCCESS);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Parse one input file FILE, adding classes and members to the symbol
|
|
|
|
|
table. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
|
process_file (char *file)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
fp = open_file (file);
|
|
|
|
|
if (fp)
|
2001-12-19 06:03:57 +00:00
|
|
|
|
{
|
2011-03-21 18:03:15 +00:00
|
|
|
|
size_t nread, nbytes;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
|
|
|
|
|
/* Give a progress indication if needed. */
|
|
|
|
|
if (f_very_verbose)
|
|
|
|
|
{
|
|
|
|
|
puts (filename);
|
|
|
|
|
fflush (stdout);
|
|
|
|
|
}
|
|
|
|
|
else if (f_verbose)
|
|
|
|
|
{
|
|
|
|
|
putchar ('.');
|
|
|
|
|
fflush (stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read file to inbuffer. */
|
|
|
|
|
for (nread = 0;;)
|
|
|
|
|
{
|
|
|
|
|
if (nread + READ_CHUNK_SIZE >= inbuffer_size)
|
|
|
|
|
{
|
|
|
|
|
inbuffer_size = nread + READ_CHUNK_SIZE + 1;
|
2000-07-14 17:59:55 +00:00
|
|
|
|
inbuffer = (char *) xrealloc (inbuffer, inbuffer_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp);
|
2011-03-21 18:03:15 +00:00
|
|
|
|
if (nbytes == 0)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
break;
|
2000-05-02 11:01:29 +00:00
|
|
|
|
nread += nbytes;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
inbuffer[nread] = '\0';
|
|
|
|
|
|
|
|
|
|
/* Reinitialize scanner and parser for the new input file. */
|
|
|
|
|
re_init_scanner ();
|
|
|
|
|
re_init_parser ();
|
|
|
|
|
|
|
|
|
|
/* Parse it and close the file. */
|
|
|
|
|
yyparse ();
|
|
|
|
|
fclose (fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Read a line from stream FP and return a pointer to a static buffer
|
|
|
|
|
containing its contents without the terminating newline. Value
|
|
|
|
|
is null when EOF is reached. */
|
|
|
|
|
|
2011-02-21 18:06:25 +00:00
|
|
|
|
static char *
|
2010-07-03 00:50:23 +00:00
|
|
|
|
read_line (FILE *fp)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
static char *buffer;
|
|
|
|
|
static int buffer_size;
|
|
|
|
|
int i = 0, c;
|
|
|
|
|
|
|
|
|
|
while ((c = getc (fp)) != EOF && c != '\n')
|
|
|
|
|
{
|
|
|
|
|
if (i >= buffer_size)
|
|
|
|
|
{
|
|
|
|
|
buffer_size = max (100, buffer_size * 2);
|
2000-07-14 17:59:55 +00:00
|
|
|
|
buffer = (char *) xrealloc (buffer, buffer_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buffer[i++] = c;
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (c == EOF && i == 0)
|
|
|
|
|
return NULL;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (i == buffer_size)
|
|
|
|
|
{
|
|
|
|
|
buffer_size = max (100, buffer_size * 2);
|
2000-07-14 17:59:55 +00:00
|
|
|
|
buffer = (char *) xrealloc (buffer, buffer_size);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buffer[i] = '\0';
|
2001-03-02 12:34:45 +00:00
|
|
|
|
if (i > 0 && buffer[i - 1] == '\r')
|
|
|
|
|
buffer[i - 1] = '\0';
|
2000-04-09 11:15:57 +00:00
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Main entry point. */
|
|
|
|
|
|
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
|
main (int argc, char **argv)
|
2000-04-09 11:15:57 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
int any_inputfiles = 0;
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
|
static const char *out_filename = DEFAULT_OUTFILE;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
static char **input_filenames = NULL;
|
|
|
|
|
static int input_filenames_size = 0;
|
|
|
|
|
static int n_input_files;
|
|
|
|
|
|
|
|
|
|
filename = "command line";
|
|
|
|
|
yyout = stdout;
|
|
|
|
|
|
|
|
|
|
while ((i = getopt_long (argc, argv, "af:I:m:M:no:p:svVx",
|
|
|
|
|
options, NULL)) != EOF)
|
|
|
|
|
{
|
|
|
|
|
switch (i)
|
|
|
|
|
{
|
|
|
|
|
/* Experimental. */
|
|
|
|
|
case 'p':
|
|
|
|
|
info_position = atoi (optarg);
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
case 'n':
|
|
|
|
|
f_nested_classes = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'x':
|
|
|
|
|
f_regexps = 0;
|
|
|
|
|
break;
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
/* Add the name of a file containing more input files. */
|
|
|
|
|
case 'f':
|
|
|
|
|
if (n_input_files == input_filenames_size)
|
|
|
|
|
{
|
|
|
|
|
input_filenames_size = max (10, 2 * input_filenames_size);
|
2001-01-02 13:53:32 +00:00
|
|
|
|
input_filenames = (char **) xrealloc ((void *)input_filenames,
|
2000-04-09 11:15:57 +00:00
|
|
|
|
input_filenames_size);
|
|
|
|
|
}
|
|
|
|
|
input_filenames[n_input_files++] = xstrdup (optarg);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Append new output to output file instead of truncating it. */
|
|
|
|
|
case 'a':
|
|
|
|
|
f_append = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Include structs in the output */
|
|
|
|
|
case 's':
|
|
|
|
|
f_structs = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Be verbose (give a progress indication). */
|
|
|
|
|
case 'v':
|
|
|
|
|
f_verbose = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Be very verbose (print file names as they are processed). */
|
|
|
|
|
case 'V':
|
|
|
|
|
f_verbose = 1;
|
|
|
|
|
f_very_verbose = 1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Change the name of the output file. */
|
|
|
|
|
case 'o':
|
|
|
|
|
out_filename = optarg;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Set minimum length for regular expression strings
|
|
|
|
|
when recorded in the output file. */
|
|
|
|
|
case 'm':
|
|
|
|
|
min_regexp = atoi (optarg);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Set maximum length for regular expression strings
|
|
|
|
|
when recorded in the output file. */
|
|
|
|
|
case 'M':
|
|
|
|
|
max_regexp = atoi (optarg);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Add to search path. */
|
|
|
|
|
case 'I':
|
|
|
|
|
add_search_path (optarg);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* Display help */
|
|
|
|
|
case -2:
|
|
|
|
|
usage (0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case -3:
|
|
|
|
|
version ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Call init_scanner after command line flags have been processed to be
|
|
|
|
|
able to add keywords depending on command line (not yet
|
|
|
|
|
implemented). */
|
|
|
|
|
init_scanner ();
|
|
|
|
|
init_sym ();
|
|
|
|
|
|
|
|
|
|
/* Open output file */
|
|
|
|
|
if (*out_filename)
|
|
|
|
|
{
|
2001-07-16 11:20:25 +00:00
|
|
|
|
if (f_append)
|
|
|
|
|
{
|
|
|
|
|
/* Check that the file to append to exists, and is not
|
|
|
|
|
empty. More specifically, it should be a valid file
|
2001-08-09 17:40:59 +00:00
|
|
|
|
produced by a previous run of ebrowse, but that's too
|
2001-07-16 11:20:25 +00:00
|
|
|
|
difficult to check. */
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
fp = fopen (out_filename, "r");
|
|
|
|
|
if (fp == NULL)
|
2006-06-03 17:49:36 +00:00
|
|
|
|
{
|
Use straight quotes in lib-src diagnostics
These auxiliary programs can’t use Emacs’s text-quoting-style,
and it’s too much trouble to redo that mechanism by hand.
So just use straight quotes for now.
* lib-src/ebrowse.c (main):
* lib-src/emacsclient.c (decode_options, main):
* lib-src/etags.c (Ada_help, default_C_help, Cplusplus_help)
(Forth_help, HTML_help, Lisp_help, Makefile_help, Objc_help)
(Perl_help, PHP_help, Python_help, Scheme_help, TeX_help, auto_help)
(none_help, print_language_names, print_help, add_regex)
(suggest_asking_for_help):
* lib-src/make-docfile.c (write_c_args, scan_c_stream):
Use straight quotes in diagnostics.
2015-08-27 09:36:56 +00:00
|
|
|
|
yyerror ("file '%s' must exist for --append", out_filename);
|
2006-06-03 17:49:36 +00:00
|
|
|
|
exit (EXIT_FAILURE);
|
|
|
|
|
}
|
2001-07-16 11:20:25 +00:00
|
|
|
|
|
|
|
|
|
rc = fseek (fp, 0, SEEK_END);
|
|
|
|
|
if (rc == -1)
|
2006-06-03 17:49:36 +00:00
|
|
|
|
{
|
Use straight quotes in lib-src diagnostics
These auxiliary programs can’t use Emacs’s text-quoting-style,
and it’s too much trouble to redo that mechanism by hand.
So just use straight quotes for now.
* lib-src/ebrowse.c (main):
* lib-src/emacsclient.c (decode_options, main):
* lib-src/etags.c (Ada_help, default_C_help, Cplusplus_help)
(Forth_help, HTML_help, Lisp_help, Makefile_help, Objc_help)
(Perl_help, PHP_help, Python_help, Scheme_help, TeX_help, auto_help)
(none_help, print_language_names, print_help, add_regex)
(suggest_asking_for_help):
* lib-src/make-docfile.c (write_c_args, scan_c_stream):
Use straight quotes in diagnostics.
2015-08-27 09:36:56 +00:00
|
|
|
|
yyerror ("error seeking in file '%s'", out_filename);
|
2006-06-03 17:49:36 +00:00
|
|
|
|
exit (EXIT_FAILURE);
|
|
|
|
|
}
|
2001-07-16 11:20:25 +00:00
|
|
|
|
|
|
|
|
|
rc = ftell (fp);
|
|
|
|
|
if (rc == -1)
|
2006-06-03 17:49:36 +00:00
|
|
|
|
{
|
Use straight quotes in lib-src diagnostics
These auxiliary programs can’t use Emacs’s text-quoting-style,
and it’s too much trouble to redo that mechanism by hand.
So just use straight quotes for now.
* lib-src/ebrowse.c (main):
* lib-src/emacsclient.c (decode_options, main):
* lib-src/etags.c (Ada_help, default_C_help, Cplusplus_help)
(Forth_help, HTML_help, Lisp_help, Makefile_help, Objc_help)
(Perl_help, PHP_help, Python_help, Scheme_help, TeX_help, auto_help)
(none_help, print_language_names, print_help, add_regex)
(suggest_asking_for_help):
* lib-src/make-docfile.c (write_c_args, scan_c_stream):
Use straight quotes in diagnostics.
2015-08-27 09:36:56 +00:00
|
|
|
|
yyerror ("error getting size of file '%s'", out_filename);
|
2006-06-03 17:49:36 +00:00
|
|
|
|
exit (EXIT_FAILURE);
|
|
|
|
|
}
|
2011-01-31 08:12:52 +00:00
|
|
|
|
|
2001-07-16 11:20:25 +00:00
|
|
|
|
else if (rc == 0)
|
2006-06-03 17:49:36 +00:00
|
|
|
|
{
|
Use straight quotes in lib-src diagnostics
These auxiliary programs can’t use Emacs’s text-quoting-style,
and it’s too much trouble to redo that mechanism by hand.
So just use straight quotes for now.
* lib-src/ebrowse.c (main):
* lib-src/emacsclient.c (decode_options, main):
* lib-src/etags.c (Ada_help, default_C_help, Cplusplus_help)
(Forth_help, HTML_help, Lisp_help, Makefile_help, Objc_help)
(Perl_help, PHP_help, Python_help, Scheme_help, TeX_help, auto_help)
(none_help, print_language_names, print_help, add_regex)
(suggest_asking_for_help):
* lib-src/make-docfile.c (write_c_args, scan_c_stream):
Use straight quotes in diagnostics.
2015-08-27 09:36:56 +00:00
|
|
|
|
yyerror ("file '%s' is empty", out_filename);
|
2006-06-03 17:49:36 +00:00
|
|
|
|
/* It may be ok to use an empty file for appending.
|
|
|
|
|
exit (EXIT_FAILURE); */
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2001-07-16 11:20:25 +00:00
|
|
|
|
fclose (fp);
|
|
|
|
|
}
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
yyout = fopen (out_filename, f_append ? "a" : "w");
|
|
|
|
|
if (yyout == NULL)
|
|
|
|
|
{
|
Use straight quotes in lib-src diagnostics
These auxiliary programs can’t use Emacs’s text-quoting-style,
and it’s too much trouble to redo that mechanism by hand.
So just use straight quotes for now.
* lib-src/ebrowse.c (main):
* lib-src/emacsclient.c (decode_options, main):
* lib-src/etags.c (Ada_help, default_C_help, Cplusplus_help)
(Forth_help, HTML_help, Lisp_help, Makefile_help, Objc_help)
(Perl_help, PHP_help, Python_help, Scheme_help, TeX_help, auto_help)
(none_help, print_language_names, print_help, add_regex)
(suggest_asking_for_help):
* lib-src/make-docfile.c (write_c_args, scan_c_stream):
Use straight quotes in diagnostics.
2015-08-27 09:36:56 +00:00
|
|
|
|
yyerror ("cannot open output file '%s'", out_filename);
|
2004-05-08 15:26:33 +00:00
|
|
|
|
exit (EXIT_FAILURE);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process input files specified on the command line. */
|
|
|
|
|
while (optind < argc)
|
|
|
|
|
{
|
|
|
|
|
process_file (argv[optind++]);
|
|
|
|
|
any_inputfiles = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Process files given on stdin if no files specified. */
|
|
|
|
|
if (!any_inputfiles && n_input_files == 0)
|
|
|
|
|
{
|
|
|
|
|
char *file;
|
|
|
|
|
while ((file = read_line (stdin)) != NULL)
|
|
|
|
|
process_file (file);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Process files from `--files=FILE'. Every line in FILE names
|
|
|
|
|
one input file to process. */
|
|
|
|
|
for (i = 0; i < n_input_files; ++i)
|
|
|
|
|
{
|
|
|
|
|
FILE *fp = fopen (input_filenames[i], "r");
|
2001-12-19 06:03:57 +00:00
|
|
|
|
|
2000-04-09 11:15:57 +00:00
|
|
|
|
if (fp == NULL)
|
Use straight quotes in lib-src diagnostics
These auxiliary programs can’t use Emacs’s text-quoting-style,
and it’s too much trouble to redo that mechanism by hand.
So just use straight quotes for now.
* lib-src/ebrowse.c (main):
* lib-src/emacsclient.c (decode_options, main):
* lib-src/etags.c (Ada_help, default_C_help, Cplusplus_help)
(Forth_help, HTML_help, Lisp_help, Makefile_help, Objc_help)
(Perl_help, PHP_help, Python_help, Scheme_help, TeX_help, auto_help)
(none_help, print_language_names, print_help, add_regex)
(suggest_asking_for_help):
* lib-src/make-docfile.c (write_c_args, scan_c_stream):
Use straight quotes in diagnostics.
2015-08-27 09:36:56 +00:00
|
|
|
|
yyerror ("cannot open input file '%s'", input_filenames[i]);
|
2000-04-09 11:15:57 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char *file;
|
|
|
|
|
while ((file = read_line (fp)) != NULL)
|
|
|
|
|
process_file (file);
|
|
|
|
|
fclose (fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write output file. */
|
|
|
|
|
dump_roots (yyout);
|
|
|
|
|
|
|
|
|
|
/* Close output file. */
|
|
|
|
|
if (yyout != stdout)
|
|
|
|
|
fclose (yyout);
|
|
|
|
|
|
2004-05-08 15:26:33 +00:00
|
|
|
|
return EXIT_SUCCESS;
|
2000-04-09 11:15:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-05-08 15:26:33 +00:00
|
|
|
|
/* ebrowse.c ends here */
|