aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/ebrowse.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src/ebrowse.c')
-rw-r--r--lib-src/ebrowse.c355
1 files changed, 123 insertions, 232 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index b51b4aa6965..a9f7ba4f3a7 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -20,20 +20,14 @@ You should have received a copy of the GNU General Public License
20along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 20along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22 22
23#ifdef HAVE_CONFIG_H
24#include <config.h> 23#include <config.h>
25#endif
26
27#include <stdio.h> 24#include <stdio.h>
28 25
29#ifdef HAVE_STDLIB_H 26#ifdef HAVE_STDLIB_H
30#include <stdlib.h> 27#include <stdlib.h>
31#endif 28#endif
32 29
33#ifdef HAVE_STRING_H
34#include <string.h> 30#include <string.h>
35#endif
36
37#include <ctype.h> 31#include <ctype.h>
38#include <assert.h> 32#include <assert.h>
39#include "getopt.h" 33#include "getopt.h"
@@ -45,12 +39,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45 39
46/* Conditionalize function prototypes. */ 40/* Conditionalize function prototypes. */
47 41
48#ifdef PROTOTYPES /* From config.h. */
49#define P_(x) x
50#else
51#define P_(x) ()
52#endif
53
54/* Value is non-zero if strings X and Y compare equal. */ 42/* Value is non-zero if strings X and Y compare equal. */
55 43
56#define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) 44#define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0)
@@ -479,62 +467,62 @@ struct search_path *search_path_tail;
479 467
480/* Function prototypes. */ 468/* Function prototypes. */
481 469
482int yylex P_ ((void)); 470int yylex (void);
483void yyparse P_ ((void)); 471void yyparse (void);
484void re_init_parser P_ ((void)); 472void re_init_parser (void);
485char *token_string P_ ((int)); 473char *token_string (int);
486char *matching_regexp P_ ((void)); 474char *matching_regexp (void);
487void init_sym P_ ((void)); 475void init_sym (void);
488struct sym *add_sym P_ ((char *, struct sym *)); 476struct sym *add_sym (char *, struct sym *);
489void add_link P_ ((struct sym *, struct sym *)); 477void add_link (struct sym *, struct sym *);
490void add_member_defn P_ ((struct sym *, char *, char *, 478void add_member_defn (struct sym *, char *, char *,
491 int, unsigned, int, int, int)); 479 int, unsigned, int, int, int);
492void add_member_decl P_ ((struct sym *, char *, char *, int, 480void add_member_decl (struct sym *, char *, char *, int,
493 unsigned, int, int, int, int)); 481 unsigned, int, int, int, int);
494void dump_roots P_ ((FILE *)); 482void dump_roots (FILE *);
495void *xmalloc P_ ((int)); 483void *xmalloc (int);
496void xfree P_ ((void *)); 484void xfree (void *);
497void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int)); 485void add_global_defn (char *, char *, int, unsigned, int, int, int);
498void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int)); 486void add_global_decl (char *, char *, int, unsigned, int, int, int);
499void add_define P_ ((char *, char *, int)); 487void add_define (char *, char *, int);
500void mark_inherited_virtual P_ ((void)); 488void mark_inherited_virtual (void);
501void leave_namespace P_ ((void)); 489void leave_namespace (void);
502void enter_namespace P_ ((char *)); 490void enter_namespace (char *);
503void register_namespace_alias P_ ((char *, struct link *)); 491void register_namespace_alias (char *, struct link *);
504void insert_keyword P_ ((char *, int)); 492void insert_keyword (char *, int);
505void re_init_scanner P_ ((void)); 493void re_init_scanner (void);
506void init_scanner P_ ((void)); 494void init_scanner (void);
507void usage P_ ((int)); 495void usage (int);
508void version P_ ((void)); 496void version (void);
509void process_file P_ ((char *)); 497void process_file (char *);
510void add_search_path P_ ((char *)); 498void add_search_path (char *);
511FILE *open_file P_ ((char *)); 499FILE *open_file (char *);
512int process_pp_line P_ ((void)); 500int process_pp_line (void);
513int dump_members P_ ((FILE *, struct member *)); 501int dump_members (FILE *, struct member *);
514void dump_sym P_ ((FILE *, struct sym *)); 502void dump_sym (FILE *, struct sym *);
515int dump_tree P_ ((FILE *, struct sym *)); 503int dump_tree (FILE *, struct sym *);
516struct member *find_member P_ ((struct sym *, char *, int, int, unsigned)); 504struct member *find_member (struct sym *, char *, int, int, unsigned);
517struct member *add_member P_ ((struct sym *, char *, int, int, unsigned)); 505struct member *add_member (struct sym *, char *, int, int, unsigned);
518void mark_virtual P_ ((struct sym *)); 506void mark_virtual (struct sym *);
519void mark_virtual P_ ((struct sym *)); 507void mark_virtual (struct sym *);
520struct sym *make_namespace P_ ((char *, struct sym *)); 508struct sym *make_namespace (char *, struct sym *);
521char *sym_scope P_ ((struct sym *)); 509char *sym_scope (struct sym *);
522char *sym_scope_1 P_ ((struct sym *)); 510char *sym_scope_1 (struct sym *);
523int skip_to P_ ((int)); 511int skip_to (int);
524void skip_matching P_ ((void)); 512void skip_matching (void);
525void member P_ ((struct sym *, int)); 513void member (struct sym *, int);
526void class_body P_ ((struct sym *, int)); 514void class_body (struct sym *, int);
527void class_definition P_ ((struct sym *, int, int, int)); 515void class_definition (struct sym *, int, int, int);
528void declaration P_ ((int)); 516void declaration (int);
529unsigned parm_list P_ ((int *)); 517unsigned parm_list (int *);
530char *operator_name P_ ((int *)); 518char *operator_name (int *);
531struct sym *parse_classname P_ ((void)); 519struct sym *parse_classname (void);
532struct sym *parse_qualified_ident_or_type P_ ((char **)); 520struct sym *parse_qualified_ident_or_type (char **);
533void parse_qualified_param_ident_or_type P_ ((char **)); 521void parse_qualified_param_ident_or_type (char **);
534int globals P_ ((int)); 522int globals (int);
535void yyerror P_ ((char *, char *)); 523void yyerror (char *, char *);
536void usage P_ ((int)) NO_RETURN; 524void usage (int) NO_RETURN;
537void version P_ (()) NO_RETURN; 525void version (void) NO_RETURN;
538 526
539 527
540 528
@@ -546,8 +534,7 @@ void version P_ (()) NO_RETURN;
546 name and line number. */ 534 name and line number. */
547 535
548void 536void
549yyerror (format, s) 537yyerror (char *format, char *s)
550 char *format, *s;
551{ 538{
552 fprintf (stderr, "%s:%d: ", filename, yyline); 539 fprintf (stderr, "%s:%d: ", filename, yyline);
553 fprintf (stderr, format, s); 540 fprintf (stderr, format, s);
@@ -559,8 +546,7 @@ yyerror (format, s)
559 available. */ 546 available. */
560 547
561void * 548void *
562xmalloc (nbytes) 549xmalloc (int nbytes)
563 int nbytes;
564{ 550{
565 void *p = malloc (nbytes); 551 void *p = malloc (nbytes);
566 if (p == NULL) 552 if (p == NULL)
@@ -575,9 +561,7 @@ xmalloc (nbytes)
575/* Like realloc but print an error and exit if out of memory. */ 561/* Like realloc but print an error and exit if out of memory. */
576 562
577void * 563void *
578xrealloc (p, sz) 564xrealloc (void *p, int sz)
579 void *p;
580 int sz;
581{ 565{
582 p = realloc (p, sz); 566 p = realloc (p, sz);
583 if (p == NULL) 567 if (p == NULL)
@@ -593,8 +577,7 @@ xrealloc (p, sz)
593 available.. If S is null, return null. */ 577 available.. If S is null, return null. */
594 578
595char * 579char *
596xstrdup (s) 580xstrdup (char *s)
597 char *s;
598{ 581{
599 if (s) 582 if (s)
600 s = strcpy (xmalloc (strlen (s) + 1), s); 583 s = strcpy (xmalloc (strlen (s) + 1), s);
@@ -611,7 +594,7 @@ xstrdup (s)
611 special symbol for globals (`*Globals*'). */ 594 special symbol for globals (`*Globals*'). */
612 595
613void 596void
614init_sym () 597init_sym (void)
615{ 598{
616 global_symbols = add_sym (GLOBALS_NAME, NULL); 599 global_symbols = add_sym (GLOBALS_NAME, NULL);
617} 600}
@@ -625,9 +608,7 @@ init_sym ()
625 create a new symbol and set it to default values. */ 608 create a new symbol and set it to default values. */
626 609
627struct sym * 610struct sym *
628add_sym (name, nested_in_class) 611add_sym (char *name, struct sym *nested_in_class)
629 char *name;
630 struct sym *nested_in_class;
631{ 612{
632 struct sym *sym; 613 struct sym *sym;
633 unsigned h; 614 unsigned h;
@@ -654,7 +635,7 @@ add_sym (name, nested_in_class)
654 } 635 }
655 636
656 sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); 637 sym = (struct sym *) xmalloc (sizeof *sym + strlen (name));
657 bzero (sym, sizeof *sym); 638 memset (sym, 0, sizeof *sym);
658 strcpy (sym->name, name); 639 strcpy (sym->name, name);
659 sym->namesp = scope; 640 sym->namesp = scope;
660 sym->next = class_table[h]; 641 sym->next = class_table[h];
@@ -668,8 +649,7 @@ add_sym (name, nested_in_class)
668/* Add links between superclass SUPER and subclass SUB. */ 649/* Add links between superclass SUPER and subclass SUB. */
669 650
670void 651void
671add_link (super, sub) 652add_link (struct sym *super, struct sym *sub)
672 struct sym *super, *sub;
673{ 653{
674 struct link *lnk, *lnk2, *p, *prev; 654 struct link *lnk, *lnk2, *p, *prev;
675 655
@@ -709,11 +689,7 @@ add_link (super, sub)
709 found or null if not found. */ 689 found or null if not found. */
710 690
711struct member * 691struct member *
712find_member (cls, name, var, sc, hash) 692find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
713 struct sym *cls;
714 char *name;
715 int var, sc;
716 unsigned hash;
717{ 693{
718 struct member **list; 694 struct member **list;
719 struct member *p; 695 struct member *p;
@@ -763,16 +739,7 @@ find_member (cls, name, var, sc, hash)
763 F_* defines). */ 739 F_* defines). */
764 740
765void 741void
766add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) 742add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags)
767 struct sym *cls;
768 char *name;
769 char *regexp;
770 int pos;
771 unsigned hash;
772 int var;
773 int sc;
774 int vis;
775 int flags;
776{ 743{
777 struct member *m; 744 struct member *m;
778 745
@@ -820,15 +787,7 @@ add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags)
820 F_* defines). */ 787 F_* defines). */
821 788
822void 789void
823add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) 790add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
824 struct sym *cls;
825 char *name;
826 char *regexp;
827 int pos;
828 unsigned hash;
829 int var;
830 int sc;
831 int flags;
832{ 791{
833 struct member *m; 792 struct member *m;
834 793
@@ -870,9 +829,7 @@ add_member_defn (cls, name, regexp, pos, hash, var, sc, flags)
870 if it is non-null. POS is the position in the file. */ 829 if it is non-null. POS is the position in the file. */
871 830
872void 831void
873add_define (name, regexp, pos) 832add_define (char *name, char *regexp, int pos)
874 char *name, *regexp;
875 int pos;
876{ 833{
877 add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); 834 add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
878 add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); 835 add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
@@ -890,13 +847,7 @@ add_define (name, regexp, pos)
890 F_* defines). */ 847 F_* defines). */
891 848
892void 849void
893add_global_defn (name, regexp, pos, hash, var, sc, flags) 850add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
894 char *name, *regexp;
895 int pos;
896 unsigned hash;
897 int var;
898 int sc;
899 int flags;
900{ 851{
901 int i; 852 int i;
902 struct sym *sym; 853 struct sym *sym;
@@ -927,13 +878,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags)
927 F_* defines). */ 878 F_* defines). */
928 879
929void 880void
930add_global_decl (name, regexp, pos, hash, var, sc, flags) 881add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
931 char *name, *regexp;
932 int pos;
933 unsigned hash;
934 int var;
935 int sc;
936 int flags;
937{ 882{
938 /* Add declaration only if not already declared. Header files must 883 /* Add declaration only if not already declared. Header files must
939 be processed before source files for this to have the right effect. 884 be processed before source files for this to have the right effect.
@@ -972,12 +917,7 @@ add_global_decl (name, regexp, pos, hash, var, sc, flags)
972 Value is a pointer to the member's structure. */ 917 Value is a pointer to the member's structure. */
973 918
974struct member * 919struct member *
975add_member (cls, name, var, sc, hash) 920add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
976 struct sym *cls;
977 char *name;
978 int var;
979 int sc;
980 unsigned hash;
981{ 921{
982 struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); 922 struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name));
983 struct member **list; 923 struct member **list;
@@ -1048,8 +988,7 @@ add_member (cls, name, var, sc, hash)
1048 in base classes. */ 988 in base classes. */
1049 989
1050void 990void
1051mark_virtual (r) 991mark_virtual (struct sym *r)
1052 struct sym *r;
1053{ 992{
1054 struct link *p; 993 struct link *p;
1055 struct member *m, *m2; 994 struct member *m, *m2;
@@ -1073,7 +1012,7 @@ mark_virtual (r)
1073 are virtual because of a virtual declaration in a base class. */ 1012 are virtual because of a virtual declaration in a base class. */
1074 1013
1075void 1014void
1076mark_inherited_virtual () 1015mark_inherited_virtual (void)
1077{ 1016{
1078 struct sym *r; 1017 struct sym *r;
1079 int i; 1018 int i;
@@ -1088,12 +1027,10 @@ mark_inherited_virtual ()
1088/* Create and return a symbol for a namespace with name NAME. */ 1027/* Create and return a symbol for a namespace with name NAME. */
1089 1028
1090struct sym * 1029struct sym *
1091make_namespace (name, context) 1030make_namespace (char *name, struct sym *context)
1092 char *name;
1093 struct sym *context;
1094{ 1031{
1095 struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); 1032 struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
1096 bzero (s, sizeof *s); 1033 memset (s, 0, sizeof *s);
1097 strcpy (s->name, name); 1034 strcpy (s->name, name);
1098 s->next = all_namespaces; 1035 s->next = all_namespaces;
1099 s->namesp = context; 1036 s->namesp = context;
@@ -1105,9 +1042,7 @@ make_namespace (name, context)
1105/* Find the symbol for namespace NAME. If not found, retrun NULL */ 1042/* Find the symbol for namespace NAME. If not found, retrun NULL */
1106 1043
1107struct sym * 1044struct sym *
1108check_namespace (name, context) 1045check_namespace (char *name, struct sym *context)
1109 char *name;
1110 struct sym *context;
1111{ 1046{
1112 struct sym *p = NULL; 1047 struct sym *p = NULL;
1113 1048
@@ -1115,18 +1050,16 @@ check_namespace (name, context)
1115 { 1050 {
1116 if (streq (p->name, name) && (p->namesp == context)) 1051 if (streq (p->name, name) && (p->namesp == context))
1117 break; 1052 break;
1118 } 1053 }
1119 1054
1120 return p; 1055 return p;
1121 } 1056}
1122 1057
1123/* Find the symbol for namespace NAME. If not found, add a new symbol 1058/* Find the symbol for namespace NAME. If not found, add a new symbol
1124 for NAME to all_namespaces. */ 1059 for NAME to all_namespaces. */
1125 1060
1126struct sym * 1061struct sym *
1127find_namespace (name, context) 1062find_namespace (char *name, struct sym *context)
1128 char *name;
1129 struct sym *context;
1130{ 1063{
1131 struct sym *p = check_namespace (name, context); 1064 struct sym *p = check_namespace (name, context);
1132 1065
@@ -1140,8 +1073,7 @@ find_namespace (name, context)
1140/* Find namespace alias with name NAME. If not found return NULL. */ 1073/* Find namespace alias with name NAME. If not found return NULL. */
1141 1074
1142struct link * 1075struct link *
1143check_namespace_alias (name) 1076check_namespace_alias (char *name)
1144 char *name;
1145{ 1077{
1146 struct link *p = NULL; 1078 struct link *p = NULL;
1147 struct alias *al; 1079 struct alias *al;
@@ -1165,9 +1097,7 @@ check_namespace_alias (name)
1165/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ 1097/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */
1166 1098
1167void 1099void
1168register_namespace_alias (new_name, old_name) 1100register_namespace_alias (char *new_name, struct link *old_name)
1169 char *new_name;
1170 struct link *old_name;
1171{ 1101{
1172 unsigned h; 1102 unsigned h;
1173 char *s; 1103 char *s;
@@ -1195,8 +1125,7 @@ register_namespace_alias (new_name, old_name)
1195/* Enter namespace with name NAME. */ 1125/* Enter namespace with name NAME. */
1196 1126
1197void 1127void
1198enter_namespace (name) 1128enter_namespace (char *name)
1199 char *name;
1200{ 1129{
1201 struct sym *p = find_namespace (name, current_namespace); 1130 struct sym *p = find_namespace (name, current_namespace);
1202 1131
@@ -1217,7 +1146,7 @@ enter_namespace (name)
1217/* Leave the current namespace. */ 1146/* Leave the current namespace. */
1218 1147
1219void 1148void
1220leave_namespace () 1149leave_namespace (void)
1221{ 1150{
1222 assert (namespace_sp > 0); 1151 assert (namespace_sp > 0);
1223 current_namespace = namespace_stack[--namespace_sp]; 1152 current_namespace = namespace_stack[--namespace_sp];
@@ -1259,8 +1188,7 @@ int scope_buffer_len;
1259/* Make sure scope_buffer has enough room to add LEN chars to it. */ 1188/* Make sure scope_buffer has enough room to add LEN chars to it. */
1260 1189
1261void 1190void
1262ensure_scope_buffer_room (len) 1191ensure_scope_buffer_room (int len)
1263 int len;
1264{ 1192{
1265 if (scope_buffer_len + len >= scope_buffer_size) 1193 if (scope_buffer_len + len >= scope_buffer_size)
1266 { 1194 {
@@ -1276,8 +1204,7 @@ ensure_scope_buffer_room (len)
1276 scope name constructed. */ 1204 scope name constructed. */
1277 1205
1278char * 1206char *
1279sym_scope_1 (p) 1207sym_scope_1 (struct sym *p)
1280 struct sym *p;
1281{ 1208{
1282 int len; 1209 int len;
1283 1210
@@ -1311,8 +1238,7 @@ sym_scope_1 (p)
1311 as it would appear in a C*+ source file. */ 1238 as it would appear in a C*+ source file. */
1312 1239
1313char * 1240char *
1314sym_scope (p) 1241sym_scope (struct sym *p)
1315 struct sym *p;
1316{ 1242{
1317 if (!scope_buffer) 1243 if (!scope_buffer)
1318 { 1244 {
@@ -1334,9 +1260,7 @@ sym_scope (p)
1334 list. */ 1260 list. */
1335 1261
1336int 1262int
1337dump_members (fp, m) 1263dump_members (FILE *fp, struct member *m)
1338 FILE *fp;
1339 struct member *m;
1340{ 1264{
1341 int n; 1265 int n;
1342 1266
@@ -1369,9 +1293,7 @@ dump_members (fp, m)
1369/* Dump class ROOT to stream FP. */ 1293/* Dump class ROOT to stream FP. */
1370 1294
1371void 1295void
1372dump_sym (fp, root) 1296dump_sym (FILE *fp, struct sym *root)
1373 FILE *fp;
1374 struct sym *root;
1375{ 1297{
1376 fputs (CLASS_STRUCT, fp); 1298 fputs (CLASS_STRUCT, fp);
1377 PUTSTR (root->name, fp); 1299 PUTSTR (root->name, fp);
@@ -1397,9 +1319,7 @@ dump_sym (fp, root)
1397 number of classes written. */ 1319 number of classes written. */
1398 1320
1399int 1321int
1400dump_tree (fp, root) 1322dump_tree (FILE *fp, struct sym *root)
1401 FILE *fp;
1402 struct sym *root;
1403{ 1323{
1404 struct link *lk; 1324 struct link *lk;
1405 unsigned n = 0; 1325 unsigned n = 0;
@@ -1446,8 +1366,7 @@ dump_tree (fp, root)
1446/* Dump the entire class tree to file FP. */ 1366/* Dump the entire class tree to file FP. */
1447 1367
1448void 1368void
1449dump_roots (fp) 1369dump_roots (FILE *fp)
1450 FILE *fp;
1451{ 1370{
1452 int i, n = 0; 1371 int i, n = 0;
1453 struct sym *r; 1372 struct sym *r;
@@ -1521,7 +1440,7 @@ do { \
1521 input buffer not consumed. */ 1440 input buffer not consumed. */
1522 1441
1523int 1442int
1524process_pp_line () 1443process_pp_line (void)
1525{ 1444{
1526 int in_comment = 0, in_string = 0; 1445 int in_comment = 0, in_string = 0;
1527 int c; 1446 int c;
@@ -1592,7 +1511,7 @@ process_pp_line ()
1592/* Value is the next token from the input buffer. */ 1511/* Value is the next token from the input buffer. */
1593 1512
1594int 1513int
1595yylex () 1514yylex (void)
1596{ 1515{
1597 int c; 1516 int c;
1598 char end_char; 1517 char end_char;
@@ -2009,7 +1928,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf;
2009 shorter than min_regexp. */ 1928 shorter than min_regexp. */
2010 1929
2011char * 1930char *
2012matching_regexp () 1931matching_regexp (void)
2013{ 1932{
2014 char *p; 1933 char *p;
2015 char *s; 1934 char *s;
@@ -2060,8 +1979,7 @@ matching_regexp ()
2060/* Return a printable representation of token T. */ 1979/* Return a printable representation of token T. */
2061 1980
2062char * 1981char *
2063token_string (t) 1982token_string (int t)
2064 int t;
2065{ 1983{
2066 static char b[3]; 1984 static char b[3];
2067 1985
@@ -2178,7 +2096,7 @@ token_string (t)
2178/* Reinitialize the scanner for a new input file. */ 2096/* Reinitialize the scanner for a new input file. */
2179 2097
2180void 2098void
2181re_init_scanner () 2099re_init_scanner (void)
2182{ 2100{
2183 in = inbuffer; 2101 in = inbuffer;
2184 yyline = 1; 2102 yyline = 1;
@@ -2196,9 +2114,7 @@ re_init_scanner ()
2196 table. */ 2114 table. */
2197 2115
2198void 2116void
2199insert_keyword (name, tk) 2117insert_keyword (char *name, int tk)
2200 char *name;
2201 int tk;
2202{ 2118{
2203 char *s; 2119 char *s;
2204 unsigned h = 0; 2120 unsigned h = 0;
@@ -2219,7 +2135,7 @@ insert_keyword (name, tk)
2219 character class vectors and fills the keyword hash table. */ 2135 character class vectors and fills the keyword hash table. */
2220 2136
2221void 2137void
2222init_scanner () 2138init_scanner (void)
2223{ 2139{
2224 int i; 2140 int i;
2225 2141
@@ -2363,8 +2279,7 @@ init_scanner ()
2363 the current lookahead token after skipping. */ 2279 the current lookahead token after skipping. */
2364 2280
2365int 2281int
2366skip_to (token) 2282skip_to (int token)
2367 int token;
2368{ 2283{
2369 while (!LOOKING_AT2 (YYEOF, token)) 2284 while (!LOOKING_AT2 (YYEOF, token))
2370 MATCH (); 2285 MATCH ();
@@ -2375,7 +2290,7 @@ skip_to (token)
2375 angle brackets, curly brackets) matching the current lookahead. */ 2290 angle brackets, curly brackets) matching the current lookahead. */
2376 2291
2377void 2292void
2378skip_matching () 2293skip_matching (void)
2379{ 2294{
2380 int open, close, n; 2295 int open, close, n;
2381 2296
@@ -2418,7 +2333,7 @@ skip_matching ()
2418} 2333}
2419 2334
2420void 2335void
2421skip_initializer () 2336skip_initializer (void)
2422{ 2337{
2423 for (;;) 2338 for (;;)
2424 { 2339 {
@@ -2445,7 +2360,7 @@ skip_initializer ()
2445/* Build qualified namespace alias (A::B::c) and return it. */ 2360/* Build qualified namespace alias (A::B::c) and return it. */
2446 2361
2447struct link * 2362struct link *
2448match_qualified_namespace_alias () 2363match_qualified_namespace_alias (void)
2449{ 2364{
2450 struct link *head = NULL; 2365 struct link *head = NULL;
2451 struct link *cur = NULL; 2366 struct link *cur = NULL;
@@ -2458,7 +2373,7 @@ match_qualified_namespace_alias ()
2458 { 2373 {
2459 case IDENT: 2374 case IDENT:
2460 tmp = (struct link *) xmalloc (sizeof *cur); 2375 tmp = (struct link *) xmalloc (sizeof *cur);
2461 tmp->sym = find_namespace (yytext, cur); 2376 tmp->sym = find_namespace (yytext, cur ? cur->sym : NULL);
2462 tmp->next = NULL; 2377 tmp->next = NULL;
2463 if (head) 2378 if (head)
2464 { 2379 {
@@ -2482,7 +2397,7 @@ match_qualified_namespace_alias ()
2482/* Re-initialize the parser by resetting the lookahead token. */ 2397/* Re-initialize the parser by resetting the lookahead token. */
2483 2398
2484void 2399void
2485re_init_parser () 2400re_init_parser (void)
2486{ 2401{
2487 tk = -1; 2402 tk = -1;
2488} 2403}
@@ -2495,8 +2410,7 @@ re_init_parser ()
2495 distinguish between overloaded functions. */ 2410 distinguish between overloaded functions. */
2496 2411
2497unsigned 2412unsigned
2498parm_list (flags) 2413parm_list (int *flags)
2499 int *flags;
2500{ 2414{
2501 unsigned hash = 0; 2415 unsigned hash = 0;
2502 int type_seen = 0; 2416 int type_seen = 0;
@@ -2609,7 +2523,7 @@ parm_list (flags)
2609/* Print position info to stdout. */ 2523/* Print position info to stdout. */
2610 2524
2611void 2525void
2612print_info () 2526print_info (void)
2613{ 2527{
2614 if (info_position >= 0 && BUFFER_POS () <= info_position) 2528 if (info_position >= 0 && BUFFER_POS () <= info_position)
2615 if (info_cls) 2529 if (info_cls)
@@ -2624,9 +2538,7 @@ print_info ()
2624 public). */ 2538 public). */
2625 2539
2626void 2540void
2627member (cls, vis) 2541member (struct sym *cls, int vis)
2628 struct sym *cls;
2629 int vis;
2630{ 2542{
2631 char *id = NULL; 2543 char *id = NULL;
2632 int sc = SC_MEMBER; 2544 int sc = SC_MEMBER;
@@ -2835,9 +2747,7 @@ member (cls, vis)
2835 union, class). */ 2747 union, class). */
2836 2748
2837void 2749void
2838class_body (cls, tag) 2750class_body (struct sym *cls, int tag)
2839 struct sym *cls;
2840 int tag;
2841{ 2751{
2842 int vis = tag == CLASS ? PRIVATE : PUBLIC; 2752 int vis = tag == CLASS ? PRIVATE : PUBLIC;
2843 int temp; 2753 int temp;
@@ -2898,7 +2808,7 @@ class_body (cls, tag)
2898 symbol for that class. */ 2808 symbol for that class. */
2899 2809
2900struct sym * 2810struct sym *
2901parse_classname () 2811parse_classname (void)
2902{ 2812{
2903 struct sym *last_class = NULL; 2813 struct sym *last_class = NULL;
2904 2814
@@ -2928,8 +2838,7 @@ parse_classname ()
2928 a static buffer holding the constructed operator name string. */ 2838 a static buffer holding the constructed operator name string. */
2929 2839
2930char * 2840char *
2931operator_name (sc) 2841operator_name (int *sc)
2932 int *sc;
2933{ 2842{
2934 static int id_size = 0; 2843 static int id_size = 0;
2935 static char *id = NULL; 2844 static char *id = NULL;
@@ -3019,8 +2928,7 @@ operator_name (sc)
3019 symbol structure for the ident. */ 2928 symbol structure for the ident. */
3020 2929
3021struct sym * 2930struct sym *
3022parse_qualified_ident_or_type (last_id) 2931parse_qualified_ident_or_type (char **last_id)
3023 char **last_id;
3024{ 2932{
3025 struct sym *cls = NULL; 2933 struct sym *cls = NULL;
3026 char *id = NULL; 2934 char *id = NULL;
@@ -3085,8 +2993,7 @@ parse_qualified_ident_or_type (last_id)
3085 symbol structure for the ident. */ 2993 symbol structure for the ident. */
3086 2994
3087void 2995void
3088parse_qualified_param_ident_or_type (last_id) 2996parse_qualified_param_ident_or_type (char **last_id)
3089 char **last_id;
3090{ 2997{
3091 struct sym *cls = NULL; 2998 struct sym *cls = NULL;
3092 static char *id = NULL; 2999 static char *id = NULL;
@@ -3128,11 +3035,7 @@ parse_qualified_param_ident_or_type (last_id)
3128 Current lookahead is the class name. */ 3035 Current lookahead is the class name. */
3129 3036
3130void 3037void
3131class_definition (containing, tag, flags, nested) 3038class_definition (struct sym *containing, int tag, int flags, int nested)
3132 struct sym *containing;
3133 int tag;
3134 int flags;
3135 int nested;
3136{ 3039{
3137 struct sym *current; 3040 struct sym *current;
3138 struct sym *base_class; 3041 struct sym *base_class;
@@ -3229,10 +3132,7 @@ class_definition (containing, tag, flags, nested)
3229 information about the member (see the F_* defines). */ 3132 information about the member (see the F_* defines). */
3230 3133
3231void 3134void
3232add_declarator (cls, id, flags, sc) 3135add_declarator (struct sym **cls, char **id, int flags, int sc)
3233 struct sym **cls;
3234 char **id;
3235 int flags, sc;
3236{ 3136{
3237 if (LOOKING_AT2 (';', ',')) 3137 if (LOOKING_AT2 (';', ','))
3238 { 3138 {
@@ -3275,8 +3175,7 @@ add_declarator (cls, id, flags, sc)
3275/* Parse a declaration. */ 3175/* Parse a declaration. */
3276 3176
3277void 3177void
3278declaration (flags) 3178declaration (int flags)
3279 int flags;
3280{ 3179{
3281 char *id = NULL; 3180 char *id = NULL;
3282 struct sym *cls = NULL; 3181 struct sym *cls = NULL;
@@ -3430,8 +3329,7 @@ declaration (flags)
3430 otherwise. */ 3329 otherwise. */
3431 3330
3432int 3331int
3433globals (start_flags) 3332globals (int start_flags)
3434 int start_flags;
3435{ 3333{
3436 int anonymous; 3334 int anonymous;
3437 int class_tk; 3335 int class_tk;
@@ -3549,7 +3447,7 @@ globals (start_flags)
3549/* Parse the current input file. */ 3447/* Parse the current input file. */
3550 3448
3551void 3449void
3552yyparse () 3450yyparse (void)
3553{ 3451{
3554 while (globals (0) == 0) 3452 while (globals (0) == 0)
3555 MATCH_IF ('}'); 3453 MATCH_IF ('}');
@@ -3565,8 +3463,7 @@ yyparse ()
3565 input files. */ 3463 input files. */
3566 3464
3567void 3465void
3568add_search_path (path_list) 3466add_search_path (char *path_list)
3569 char *path_list;
3570{ 3467{
3571 while (*path_list) 3468 while (*path_list)
3572 { 3469 {
@@ -3601,8 +3498,7 @@ add_search_path (path_list)
3601 unchanged file name. */ 3498 unchanged file name. */
3602 3499
3603FILE * 3500FILE *
3604open_file (file) 3501open_file (char *file)
3605 char *file;
3606{ 3502{
3607 FILE *fp = NULL; 3503 FILE *fp = NULL;
3608 static char *buffer; 3504 static char *buffer;
@@ -3661,8 +3557,7 @@ Usage: ebrowse [options] {files}\n\
3661" 3557"
3662 3558
3663void 3559void
3664usage (error) 3560usage (int error)
3665 int error;
3666{ 3561{
3667 puts (USAGE); 3562 puts (USAGE);
3668 exit (error ? EXIT_FAILURE : EXIT_SUCCESS); 3563 exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
@@ -3677,7 +3572,7 @@ usage (error)
3677#endif 3572#endif
3678 3573
3679void 3574void
3680version () 3575version (void)
3681{ 3576{
3682 /* Makes it easier to update automatically. */ 3577 /* Makes it easier to update automatically. */
3683 char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; 3578 char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
@@ -3693,8 +3588,7 @@ version ()
3693 table. */ 3588 table. */
3694 3589
3695void 3590void
3696process_file (file) 3591process_file (char *file)
3697 char *file;
3698{ 3592{
3699 FILE *fp; 3593 FILE *fp;
3700 3594
@@ -3749,8 +3643,7 @@ process_file (file)
3749 is null when EOF is reached. */ 3643 is null when EOF is reached. */
3750 3644
3751char * 3645char *
3752read_line (fp) 3646read_line (FILE *fp)
3753 FILE *fp;
3754{ 3647{
3755 static char *buffer; 3648 static char *buffer;
3756 static int buffer_size; 3649 static int buffer_size;
@@ -3786,9 +3679,7 @@ read_line (fp)
3786/* Main entry point. */ 3679/* Main entry point. */
3787 3680
3788int 3681int
3789main (argc, argv) 3682main (int argc, char **argv)
3790 int argc;
3791 char **argv;
3792{ 3683{
3793 int i; 3684 int i;
3794 int any_inputfiles = 0; 3685 int any_inputfiles = 0;