diff options
Diffstat (limited to 'lib-src/ebrowse.c')
| -rw-r--r-- | lib-src/ebrowse.c | 355 |
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 | |||
| 20 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 20 | along 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 | ||
| 482 | int yylex P_ ((void)); | 470 | int yylex (void); |
| 483 | void yyparse P_ ((void)); | 471 | void yyparse (void); |
| 484 | void re_init_parser P_ ((void)); | 472 | void re_init_parser (void); |
| 485 | char *token_string P_ ((int)); | 473 | char *token_string (int); |
| 486 | char *matching_regexp P_ ((void)); | 474 | char *matching_regexp (void); |
| 487 | void init_sym P_ ((void)); | 475 | void init_sym (void); |
| 488 | struct sym *add_sym P_ ((char *, struct sym *)); | 476 | struct sym *add_sym (char *, struct sym *); |
| 489 | void add_link P_ ((struct sym *, struct sym *)); | 477 | void add_link (struct sym *, struct sym *); |
| 490 | void add_member_defn P_ ((struct sym *, char *, char *, | 478 | void add_member_defn (struct sym *, char *, char *, |
| 491 | int, unsigned, int, int, int)); | 479 | int, unsigned, int, int, int); |
| 492 | void add_member_decl P_ ((struct sym *, char *, char *, int, | 480 | void add_member_decl (struct sym *, char *, char *, int, |
| 493 | unsigned, int, int, int, int)); | 481 | unsigned, int, int, int, int); |
| 494 | void dump_roots P_ ((FILE *)); | 482 | void dump_roots (FILE *); |
| 495 | void *xmalloc P_ ((int)); | 483 | void *xmalloc (int); |
| 496 | void xfree P_ ((void *)); | 484 | void xfree (void *); |
| 497 | void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int)); | 485 | void add_global_defn (char *, char *, int, unsigned, int, int, int); |
| 498 | void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int)); | 486 | void add_global_decl (char *, char *, int, unsigned, int, int, int); |
| 499 | void add_define P_ ((char *, char *, int)); | 487 | void add_define (char *, char *, int); |
| 500 | void mark_inherited_virtual P_ ((void)); | 488 | void mark_inherited_virtual (void); |
| 501 | void leave_namespace P_ ((void)); | 489 | void leave_namespace (void); |
| 502 | void enter_namespace P_ ((char *)); | 490 | void enter_namespace (char *); |
| 503 | void register_namespace_alias P_ ((char *, struct link *)); | 491 | void register_namespace_alias (char *, struct link *); |
| 504 | void insert_keyword P_ ((char *, int)); | 492 | void insert_keyword (char *, int); |
| 505 | void re_init_scanner P_ ((void)); | 493 | void re_init_scanner (void); |
| 506 | void init_scanner P_ ((void)); | 494 | void init_scanner (void); |
| 507 | void usage P_ ((int)); | 495 | void usage (int); |
| 508 | void version P_ ((void)); | 496 | void version (void); |
| 509 | void process_file P_ ((char *)); | 497 | void process_file (char *); |
| 510 | void add_search_path P_ ((char *)); | 498 | void add_search_path (char *); |
| 511 | FILE *open_file P_ ((char *)); | 499 | FILE *open_file (char *); |
| 512 | int process_pp_line P_ ((void)); | 500 | int process_pp_line (void); |
| 513 | int dump_members P_ ((FILE *, struct member *)); | 501 | int dump_members (FILE *, struct member *); |
| 514 | void dump_sym P_ ((FILE *, struct sym *)); | 502 | void dump_sym (FILE *, struct sym *); |
| 515 | int dump_tree P_ ((FILE *, struct sym *)); | 503 | int dump_tree (FILE *, struct sym *); |
| 516 | struct member *find_member P_ ((struct sym *, char *, int, int, unsigned)); | 504 | struct member *find_member (struct sym *, char *, int, int, unsigned); |
| 517 | struct member *add_member P_ ((struct sym *, char *, int, int, unsigned)); | 505 | struct member *add_member (struct sym *, char *, int, int, unsigned); |
| 518 | void mark_virtual P_ ((struct sym *)); | 506 | void mark_virtual (struct sym *); |
| 519 | void mark_virtual P_ ((struct sym *)); | 507 | void mark_virtual (struct sym *); |
| 520 | struct sym *make_namespace P_ ((char *, struct sym *)); | 508 | struct sym *make_namespace (char *, struct sym *); |
| 521 | char *sym_scope P_ ((struct sym *)); | 509 | char *sym_scope (struct sym *); |
| 522 | char *sym_scope_1 P_ ((struct sym *)); | 510 | char *sym_scope_1 (struct sym *); |
| 523 | int skip_to P_ ((int)); | 511 | int skip_to (int); |
| 524 | void skip_matching P_ ((void)); | 512 | void skip_matching (void); |
| 525 | void member P_ ((struct sym *, int)); | 513 | void member (struct sym *, int); |
| 526 | void class_body P_ ((struct sym *, int)); | 514 | void class_body (struct sym *, int); |
| 527 | void class_definition P_ ((struct sym *, int, int, int)); | 515 | void class_definition (struct sym *, int, int, int); |
| 528 | void declaration P_ ((int)); | 516 | void declaration (int); |
| 529 | unsigned parm_list P_ ((int *)); | 517 | unsigned parm_list (int *); |
| 530 | char *operator_name P_ ((int *)); | 518 | char *operator_name (int *); |
| 531 | struct sym *parse_classname P_ ((void)); | 519 | struct sym *parse_classname (void); |
| 532 | struct sym *parse_qualified_ident_or_type P_ ((char **)); | 520 | struct sym *parse_qualified_ident_or_type (char **); |
| 533 | void parse_qualified_param_ident_or_type P_ ((char **)); | 521 | void parse_qualified_param_ident_or_type (char **); |
| 534 | int globals P_ ((int)); | 522 | int globals (int); |
| 535 | void yyerror P_ ((char *, char *)); | 523 | void yyerror (char *, char *); |
| 536 | void usage P_ ((int)) NO_RETURN; | 524 | void usage (int) NO_RETURN; |
| 537 | void version P_ (()) NO_RETURN; | 525 | void 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 | ||
| 548 | void | 536 | void |
| 549 | yyerror (format, s) | 537 | yyerror (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 | ||
| 561 | void * | 548 | void * |
| 562 | xmalloc (nbytes) | 549 | xmalloc (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 | ||
| 577 | void * | 563 | void * |
| 578 | xrealloc (p, sz) | 564 | xrealloc (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 | ||
| 595 | char * | 579 | char * |
| 596 | xstrdup (s) | 580 | xstrdup (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 | ||
| 613 | void | 596 | void |
| 614 | init_sym () | 597 | init_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 | ||
| 627 | struct sym * | 610 | struct sym * |
| 628 | add_sym (name, nested_in_class) | 611 | add_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 | ||
| 670 | void | 651 | void |
| 671 | add_link (super, sub) | 652 | add_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 | ||
| 711 | struct member * | 691 | struct member * |
| 712 | find_member (cls, name, var, sc, hash) | 692 | find_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 | ||
| 765 | void | 741 | void |
| 766 | add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) | 742 | add_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 | ||
| 822 | void | 789 | void |
| 823 | add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) | 790 | add_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 | ||
| 872 | void | 831 | void |
| 873 | add_define (name, regexp, pos) | 832 | add_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 | ||
| 892 | void | 849 | void |
| 893 | add_global_defn (name, regexp, pos, hash, var, sc, flags) | 850 | add_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 | ||
| 929 | void | 880 | void |
| 930 | add_global_decl (name, regexp, pos, hash, var, sc, flags) | 881 | add_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 | ||
| 974 | struct member * | 919 | struct member * |
| 975 | add_member (cls, name, var, sc, hash) | 920 | add_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 | ||
| 1050 | void | 990 | void |
| 1051 | mark_virtual (r) | 991 | mark_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 | ||
| 1075 | void | 1014 | void |
| 1076 | mark_inherited_virtual () | 1015 | mark_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 | ||
| 1090 | struct sym * | 1029 | struct sym * |
| 1091 | make_namespace (name, context) | 1030 | make_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 | ||
| 1107 | struct sym * | 1044 | struct sym * |
| 1108 | check_namespace (name, context) | 1045 | check_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 | ||
| 1126 | struct sym * | 1061 | struct sym * |
| 1127 | find_namespace (name, context) | 1062 | find_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 | ||
| 1142 | struct link * | 1075 | struct link * |
| 1143 | check_namespace_alias (name) | 1076 | check_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 | ||
| 1167 | void | 1099 | void |
| 1168 | register_namespace_alias (new_name, old_name) | 1100 | register_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 | ||
| 1197 | void | 1127 | void |
| 1198 | enter_namespace (name) | 1128 | enter_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 | ||
| 1219 | void | 1148 | void |
| 1220 | leave_namespace () | 1149 | leave_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 | ||
| 1261 | void | 1190 | void |
| 1262 | ensure_scope_buffer_room (len) | 1191 | ensure_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 | ||
| 1278 | char * | 1206 | char * |
| 1279 | sym_scope_1 (p) | 1207 | sym_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 | ||
| 1313 | char * | 1240 | char * |
| 1314 | sym_scope (p) | 1241 | sym_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 | ||
| 1336 | int | 1262 | int |
| 1337 | dump_members (fp, m) | 1263 | dump_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 | ||
| 1371 | void | 1295 | void |
| 1372 | dump_sym (fp, root) | 1296 | dump_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 | ||
| 1399 | int | 1321 | int |
| 1400 | dump_tree (fp, root) | 1322 | dump_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 | ||
| 1448 | void | 1368 | void |
| 1449 | dump_roots (fp) | 1369 | dump_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 | ||
| 1523 | int | 1442 | int |
| 1524 | process_pp_line () | 1443 | process_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 | ||
| 1594 | int | 1513 | int |
| 1595 | yylex () | 1514 | yylex (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 | ||
| 2011 | char * | 1930 | char * |
| 2012 | matching_regexp () | 1931 | matching_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 | ||
| 2062 | char * | 1981 | char * |
| 2063 | token_string (t) | 1982 | token_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 | ||
| 2180 | void | 2098 | void |
| 2181 | re_init_scanner () | 2099 | re_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 | ||
| 2198 | void | 2116 | void |
| 2199 | insert_keyword (name, tk) | 2117 | insert_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 | ||
| 2221 | void | 2137 | void |
| 2222 | init_scanner () | 2138 | init_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 | ||
| 2365 | int | 2281 | int |
| 2366 | skip_to (token) | 2282 | skip_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 | ||
| 2377 | void | 2292 | void |
| 2378 | skip_matching () | 2293 | skip_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 | ||
| 2420 | void | 2335 | void |
| 2421 | skip_initializer () | 2336 | skip_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 | ||
| 2447 | struct link * | 2362 | struct link * |
| 2448 | match_qualified_namespace_alias () | 2363 | match_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 | ||
| 2484 | void | 2399 | void |
| 2485 | re_init_parser () | 2400 | re_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 | ||
| 2497 | unsigned | 2412 | unsigned |
| 2498 | parm_list (flags) | 2413 | parm_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 | ||
| 2611 | void | 2525 | void |
| 2612 | print_info () | 2526 | print_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 | ||
| 2626 | void | 2540 | void |
| 2627 | member (cls, vis) | 2541 | member (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 | ||
| 2837 | void | 2749 | void |
| 2838 | class_body (cls, tag) | 2750 | class_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 | ||
| 2900 | struct sym * | 2810 | struct sym * |
| 2901 | parse_classname () | 2811 | parse_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 | ||
| 2930 | char * | 2840 | char * |
| 2931 | operator_name (sc) | 2841 | operator_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 | ||
| 3021 | struct sym * | 2930 | struct sym * |
| 3022 | parse_qualified_ident_or_type (last_id) | 2931 | parse_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 | ||
| 3087 | void | 2995 | void |
| 3088 | parse_qualified_param_ident_or_type (last_id) | 2996 | parse_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 | ||
| 3130 | void | 3037 | void |
| 3131 | class_definition (containing, tag, flags, nested) | 3038 | class_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 | ||
| 3231 | void | 3134 | void |
| 3232 | add_declarator (cls, id, flags, sc) | 3135 | add_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 | ||
| 3277 | void | 3177 | void |
| 3278 | declaration (flags) | 3178 | declaration (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 | ||
| 3432 | int | 3331 | int |
| 3433 | globals (start_flags) | 3332 | globals (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 | ||
| 3551 | void | 3449 | void |
| 3552 | yyparse () | 3450 | yyparse (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 | ||
| 3567 | void | 3465 | void |
| 3568 | add_search_path (path_list) | 3466 | add_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 | ||
| 3603 | FILE * | 3500 | FILE * |
| 3604 | open_file (file) | 3501 | open_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 | ||
| 3663 | void | 3559 | void |
| 3664 | usage (error) | 3560 | usage (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 | ||
| 3679 | void | 3574 | void |
| 3680 | version () | 3575 | version (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 | ||
| 3695 | void | 3590 | void |
| 3696 | process_file (file) | 3591 | process_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 | ||
| 3751 | char * | 3645 | char * |
| 3752 | read_line (fp) | 3646 | read_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 | ||
| 3788 | int | 3681 | int |
| 3789 | main (argc, argv) | 3682 | main (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; |