Declare file-scope functions and variables static if not exported.
[bpt/emacs.git] / lib-src / ebrowse.c
index 59a1dde..2cb656a 100644 (file)
@@ -465,59 +465,16 @@ struct search_path *search_path_tail;
 
 /* Function prototypes.  */
 
-int yylex (void);
-void yyparse (void);
-void re_init_parser (void);
-const char *token_string (int);
-char *matching_regexp (void);
-void init_sym (void);
-struct sym *add_sym (const char *, struct sym *);
-void add_link (struct sym *, struct sym *);
-void add_member_defn (struct sym *, char *, char *,
-                      int, unsigned, int, int, int);
-void add_member_decl (struct sym *, char *, char *, int,
-                      unsigned, int, int, int, int);
-void dump_roots (FILE *);
-void *xmalloc (int);
-void xfree (void *);
-void add_global_defn (char *, char *, int, unsigned, int, int, int);
-void add_global_decl (char *, char *, int, unsigned, int, int, int);
-void add_define (char *, char *, int);
-void mark_inherited_virtual (void);
-void leave_namespace (void);
-void enter_namespace (char *);
-void register_namespace_alias (char *, struct link *);
-void insert_keyword (const char *, int);
-void re_init_scanner (void);
-void init_scanner (void);
-void process_file (char *);
-void add_search_path (char *);
-FILE *open_file (char *);
-int process_pp_line (void);
-int dump_members (FILE *, struct member *);
-void dump_sym (FILE *, struct sym *);
-int dump_tree (FILE *, struct sym *);
-struct member *find_member (struct sym *, char *, int, int, unsigned);
-struct member *add_member (struct sym *, char *, int, int, unsigned);
-void mark_virtual (struct sym *);
-struct sym *make_namespace (char *, struct sym *);
-char *sym_scope (struct sym *);
-char *sym_scope_1 (struct sym *);
-int skip_to (int);
-void skip_matching (void);
-void member (struct sym *, int);
-void class_body (struct sym *, int);
-void class_definition (struct sym *, int, int, int);
-void declaration (int);
-unsigned parm_list (int *);
-char *operator_name (int *);
-struct sym *parse_classname (void);
-struct sym *parse_qualified_ident_or_type (char **);
-void parse_qualified_param_ident_or_type (char **);
-int globals (int);
-void yyerror (const char *, const char *);
-void usage (int) NO_RETURN;
-void version (void) NO_RETURN;
+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);
+static void class_definition (struct sym *, int, int, int);
+static char *operator_name (int *);
+static void parse_qualified_param_ident_or_type (char **);
+static void usage (int) NO_RETURN;
+static void version (void) NO_RETURN;
 
 
 \f
@@ -528,7 +485,7 @@ void version (void) NO_RETURN;
 /* Print an error in a printf-like style with the current input file
    name and line number.  */
 
-void
+static void
 yyerror (const char *format, const char *s)
 {
   fprintf (stderr, "%s:%d: ", filename, yyline);
@@ -540,7 +497,7 @@ yyerror (const char *format, const char *s)
 /* Like malloc but print an error and exit if not enough memory is
    available.  */
 
-void *
+static void *
 xmalloc (int nbytes)
 {
   void *p = malloc (nbytes);
@@ -555,7 +512,7 @@ xmalloc (int nbytes)
 
 /* Like realloc but print an error and exit if out of memory.  */
 
-void *
+static void *
 xrealloc (void *p, int sz)
 {
   p = realloc (p, sz);
@@ -571,7 +528,7 @@ xrealloc (void *p, int sz)
 /* Like strdup, but print an error and exit if not enough memory is
    available..  If S is null, return null.  */
 
-char *
+static char *
 xstrdup (char *s)
 {
   if (s)
@@ -588,7 +545,7 @@ xstrdup (char *s)
 /* Initialize the symbol table.  This currently only sets up the
    special symbol for globals (`*Globals*').  */
 
-void
+static void
 init_sym (void)
 {
   global_symbols = add_sym (GLOBALS_NAME, NULL);
@@ -602,7 +559,7 @@ init_sym (void)
    If a symbol for NAME already exists, return that.  Otherwise
    create a new symbol and set it to default values.  */
 
-struct sym *
+static struct sym *
 add_sym (const char *name, struct sym *nested_in_class)
 {
   struct sym *sym;
@@ -643,7 +600,7 @@ add_sym (const char *name, struct sym *nested_in_class)
 
 /* Add links between superclass SUPER and subclass SUB.  */
 
-void
+static void
 add_link (struct sym *super, struct sym *sub)
 {
   struct link *lnk, *lnk2, *p, *prev;
@@ -683,7 +640,7 @@ add_link (struct sym *super, struct sym *sub)
    parameter types of functions.  Value is a pointer to the member
    found or null if not found.  */
 
-struct member *
+static struct member *
 find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
 {
   struct member **list;
@@ -733,7 +690,7 @@ find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
    a bit set giving additional information about the member (see the
    F_* defines).  */
 
-void
+static void
 add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags)
 {
   struct member *m;
@@ -781,7 +738,7 @@ add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned in
    a bit set giving additional information about the member (see the
    F_* defines).  */
 
-void
+static void
 add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
 {
   struct member *m;
@@ -823,7 +780,7 @@ add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned in
    REGEXP is a regular expression matching the define in the source,
    if it is non-null.  POS is the position in the file.  */
 
-void
+static void
 add_define (char *name, char *regexp, int pos)
 {
   add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
@@ -841,7 +798,7 @@ add_define (char *name, char *regexp, int pos)
    a bit set giving additional information about the member (see the
    F_* defines).  */
 
-void
+static void
 add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
 {
   int i;
@@ -872,7 +829,7 @@ add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var,
    a bit set giving additional information about the member (see the
    F_* defines).  */
 
-void
+static void
 add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
 {
   /* Add declaration only if not already declared.  Header files must
@@ -911,7 +868,7 @@ add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var,
    member.  HASH is a hash code for the parameter types of a function.
    Value is a pointer to the member's structure.  */
 
-struct member *
+static struct member *
 add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
 {
   struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name));
@@ -982,7 +939,7 @@ add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
    recursively, marking functions as virtual that are declared virtual
    in base classes.  */
 
-void
+static void
 mark_virtual (struct sym *r)
 {
   struct link *p;
@@ -1006,7 +963,7 @@ mark_virtual (struct sym *r)
 /* For all roots of the class tree, mark functions as virtual that
    are virtual because of a virtual declaration in a base class.  */
 
-void
+static void
 mark_inherited_virtual (void)
 {
   struct sym *r;
@@ -1021,7 +978,7 @@ mark_inherited_virtual (void)
 
 /* Create and return a symbol for a namespace with name NAME.  */
 
-struct sym *
+static struct sym *
 make_namespace (char *name, struct sym *context)
 {
   struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
@@ -1036,7 +993,7 @@ make_namespace (char *name, struct sym *context)
 
 /* Find the symbol for namespace NAME.  If not found, retrun NULL */
 
-struct sym *
+static struct sym *
 check_namespace (char *name, struct sym *context)
 {
   struct sym *p = NULL;
@@ -1053,7 +1010,7 @@ check_namespace (char *name, struct sym *context)
 /* Find the symbol for namespace NAME.  If not found, add a new symbol
    for NAME to all_namespaces.  */
 
-struct sym *
+static struct sym *
 find_namespace (char *name, struct sym *context)
 {
   struct sym *p = check_namespace (name, context);
@@ -1067,7 +1024,7 @@ find_namespace (char *name, struct sym *context)
 
 /* Find namespace alias with name NAME. If not found return NULL. */
 
-struct link *
+static struct link *
 check_namespace_alias (char *name)
 {
   struct link *p = NULL;
@@ -1091,7 +1048,7 @@ check_namespace_alias (char *name)
 
 /* Register the name NEW_NAME as an alias for namespace list OLD_NAME.  */
 
-void
+static void
 register_namespace_alias (char *new_name, struct link *old_name)
 {
   unsigned h;
@@ -1119,7 +1076,7 @@ register_namespace_alias (char *new_name, struct link *old_name)
 
 /* Enter namespace with name NAME.  */
 
-void
+static void
 enter_namespace (char *name)
 {
   struct sym *p = find_namespace (name, current_namespace);
@@ -1140,7 +1097,7 @@ enter_namespace (char *name)
 
 /* Leave the current namespace.  */
 
-void
+static void
 leave_namespace (void)
 {
   assert (namespace_sp > 0);
@@ -1182,7 +1139,7 @@ int scope_buffer_len;
 
 /* Make sure scope_buffer has enough room to add LEN chars to it.  */
 
-void
+static void
 ensure_scope_buffer_room (int len)
 {
   if (scope_buffer_len + len >= scope_buffer_size)
@@ -1198,7 +1155,7 @@ ensure_scope_buffer_room (int len)
    namespaces to scope_buffer.  Value is a pointer to the complete
    scope name constructed.  */
 
-char *
+static char *
 sym_scope_1 (struct sym *p)
 {
   int len;
@@ -1232,7 +1189,7 @@ sym_scope_1 (struct sym *p)
 /* Return the scope of symbol P in printed representation, i.e.
    as it would appear in a C*+ source file.  */
 
-char *
+static char *
 sym_scope (struct sym *p)
 {
   if (!scope_buffer)
@@ -1254,7 +1211,7 @@ sym_scope (struct sym *p)
 /* Dump the list of members M to file FP.  Value is the length of the
    list.  */
 
-int
+static int
 dump_members (FILE *fp, struct member *m)
 {
   int n;
@@ -1287,7 +1244,7 @@ dump_members (FILE *fp, struct member *m)
 
 /* Dump class ROOT to stream FP.  */
 
-void
+static void
 dump_sym (FILE *fp, struct sym *root)
 {
   fputs (CLASS_STRUCT, fp);
@@ -1313,7 +1270,7 @@ dump_sym (FILE *fp, struct sym *root)
 /* Dump class ROOT and its subclasses to file FP.  Value is the
    number of classes written.  */
 
-int
+static int
 dump_tree (FILE *fp, struct sym *root)
 {
   struct link *lk;
@@ -1360,7 +1317,7 @@ dump_tree (FILE *fp, struct sym *root)
 
 /* Dump the entire class tree to file FP.  */
 
-void
+static void
 dump_roots (FILE *fp)
 {
   int i, n = 0;
@@ -1434,7 +1391,7 @@ do {                                              \
 /* Process a preprocessor line.  Value is the next character from the
    input buffer not consumed.  */
 
-int
+static int
 process_pp_line (void)
 {
   int in_comment = 0, in_string = 0;
@@ -1505,7 +1462,7 @@ process_pp_line (void)
 
 /* Value is the next token from the input buffer.  */
 
-int
+static int
 yylex (void)
 {
   int c;
@@ -1927,7 +1884,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf;
    position in the input buffer, or maybe a bit more if that string is
    shorter than min_regexp.  */
 
-char *
+static char *
 matching_regexp (void)
 {
   char *p;
@@ -1978,7 +1935,7 @@ matching_regexp (void)
 
 /* Return a printable representation of token T.  */
 
-const char *
+static const char *
 token_string (int t)
 {
   static char b[3];
@@ -2095,7 +2052,7 @@ token_string (int t)
 
 /* Reinitialize the scanner for a new input file.  */
 
-void
+static void
 re_init_scanner (void)
 {
   in = inbuffer;
@@ -2113,7 +2070,7 @@ re_init_scanner (void)
 /* Insert a keyword NAME with token value TK into the keyword hash
    table.  */
 
-void
+static void
 insert_keyword (const char *name, int tk)
 {
   const char *s;
@@ -2134,7 +2091,7 @@ insert_keyword (const char *name, int tk)
 /* Initialize the scanner for the first file.  This sets up the
    character class vectors and fills the keyword hash table.  */
 
-void
+static void
 init_scanner (void)
 {
   int i;
@@ -2278,7 +2235,7 @@ init_scanner (void)
 /* Skip forward until a given token TOKEN or YYEOF is seen and return
    the current lookahead token after skipping.  */
 
-int
+static int
 skip_to (int token)
 {
   while (!LOOKING_AT2 (YYEOF, token))
@@ -2289,7 +2246,7 @@ skip_to (int token)
 /* Skip over pairs of tokens (parentheses, square brackets,
    angle brackets, curly brackets) matching the current lookahead.  */
 
-void
+static void
 skip_matching (void)
 {
   int open, close, n;
@@ -2332,7 +2289,7 @@ skip_matching (void)
     }
 }
 
-void
+static void
 skip_initializer (void)
 {
   for (;;)
@@ -2359,7 +2316,7 @@ skip_initializer (void)
 
 /* Build qualified namespace alias (A::B::c) and return it. */
 
-struct link *
+static struct link *
 match_qualified_namespace_alias (void)
 {
   struct link *head = NULL;
@@ -2396,7 +2353,7 @@ match_qualified_namespace_alias (void)
 
 /* Re-initialize the parser by resetting the lookahead token.  */
 
-void
+static void
 re_init_parser (void)
 {
   tk = -1;
@@ -2409,7 +2366,7 @@ re_init_parser (void)
    Returns a hash code for the parameter types.  This value is used to
    distinguish between overloaded functions.  */
 
-unsigned
+static unsigned
 parm_list (int *flags)
 {
   unsigned hash = 0;
@@ -2522,7 +2479,7 @@ parm_list (int *flags)
 
 /* Print position info to stdout.  */
 
-void
+static void
 print_info (void)
 {
   if (info_position >= 0 && BUFFER_POS () <= info_position)
@@ -2537,7 +2494,7 @@ print_info (void)
    the access specifier for the member (private, protected,
    public).  */
 
-void
+static void
 member (struct sym *cls, int vis)
 {
   char *id = NULL;
@@ -2746,7 +2703,7 @@ member (struct sym *cls, int vis)
 /* Parse the body of class CLS.  TAG is the tag of the class (struct,
    union, class).  */
 
-void
+static void
 class_body (struct sym *cls, int tag)
 {
   int vis = tag == CLASS ? PRIVATE : PUBLIC;
@@ -2807,7 +2764,7 @@ class_body (struct sym *cls, int tag)
    qualified ident has the form `X<..>::Y<...>::T<...>.  Returns a
    symbol for that class.  */
 
-struct sym *
+static struct sym *
 parse_classname (void)
 {
   struct sym *last_class = NULL;
@@ -2837,7 +2794,7 @@ parse_classname (void)
    implicitly static operator has been parsed.  Value is a pointer to
    a static buffer holding the constructed operator name string.  */
 
-char *
+static char *
 operator_name (int *sc)
 {
   static int id_size = 0;
@@ -2927,7 +2884,7 @@ operator_name (int *sc)
    `X::Y::z'.  This IDENT is returned in LAST_ID.  Value is the
    symbol structure for the ident.  */
 
-struct sym *
+static struct sym *
 parse_qualified_ident_or_type (char **last_id)
 {
   struct sym *cls = NULL;
@@ -2992,7 +2949,7 @@ parse_qualified_ident_or_type (char **last_id)
    `X::Y::z'.  This IDENT is returned in LAST_ID.  Value is the
    symbol structure for the ident.  */
 
-void
+static void
 parse_qualified_param_ident_or_type (char **last_id)
 {
   struct sym *cls = NULL;
@@ -3034,7 +2991,7 @@ parse_qualified_param_ident_or_type (char **last_id)
 
    Current lookahead is the class name.  */
 
-void
+static void
 class_definition (struct sym *containing, int tag, int flags, int nested)
 {
   struct sym *current;
@@ -3131,7 +3088,7 @@ class_definition (struct sym *containing, int tag, int flags, int nested)
    the storage class of *ID.  FLAGS is a bit set giving additional
    information about the member (see the F_* defines).  */
 
-void
+static void
 add_declarator (struct sym **cls, char **id, int flags, int sc)
 {
   if (LOOKING_AT2 (';', ','))
@@ -3174,7 +3131,7 @@ add_declarator (struct sym **cls, char **id, int flags, int sc)
 
 /* Parse a declaration.  */
 
-void
+static void
 declaration (int flags)
 {
   char *id = NULL;
@@ -3328,7 +3285,7 @@ declaration (int flags)
    parsing in an `extern "C"' block.  Value is 1 if EOF is reached, 0
    otherwise.  */
 
-int
+static int
 globals (int start_flags)
 {
   int anonymous;
@@ -3446,7 +3403,7 @@ globals (int start_flags)
 
 /* Parse the current input file.  */
 
-void
+static void
 yyparse (void)
 {
   while (globals (0) == 0)
@@ -3462,7 +3419,7 @@ yyparse (void)
 /* Add the list of paths PATH_LIST to the current search path for
    input files.  */
 
-void
+static void
 add_search_path (char *path_list)
 {
   while (*path_list)
@@ -3497,7 +3454,7 @@ add_search_path (char *path_list)
    opened.  Try to find FILE in search_path first, then try the
    unchanged file name.  */
 
-FILE *
+static FILE *
 open_file (char *file)
 {
   FILE *fp = NULL;
@@ -3556,7 +3513,7 @@ Usage: ebrowse [options] {files}\n\
       --version                        display version info\n\
 "
 
-void
+static void
 usage (int error)
 {
   puts (USAGE);
@@ -3571,7 +3528,7 @@ usage (int error)
 # define VERSION "21"
 #endif
 
-void
+static void
 version (void)
 {
   /* Makes it easier to update automatically. */
@@ -3587,7 +3544,7 @@ version (void)
 /* Parse one input file FILE, adding classes and members to the symbol
    table.  */
 
-void
+static void
 process_file (char *file)
 {
   FILE *fp;
@@ -3642,7 +3599,7 @@ process_file (char *file)
    containing its contents without the terminating newline.  Value
    is null when EOF is reached.  */
 
-char *
+static char *
 read_line (FILE *fp)
 {
   static char *buffer;