diff options
| author | Joakim Verona | 2011-06-16 00:22:07 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-06-16 00:22:07 +0200 |
| commit | a7513ade3bc0fe79430d5541d88c9dcda0932bec (patch) | |
| tree | 4383951ba698a11e9f8933a9d8c72e00aa872a10 /lib-src/ebrowse.c | |
| parent | 4bd51ad5c3445b644dfb017d5b57b10a90aa325f (diff) | |
| parent | 4bba86e6210a74326e843a8fdc8409127105e1fe (diff) | |
| download | emacs-a7513ade3bc0fe79430d5541d88c9dcda0932bec.tar.gz emacs-a7513ade3bc0fe79430d5541d88c9dcda0932bec.zip | |
merge from upstream
Diffstat (limited to 'lib-src/ebrowse.c')
| -rw-r--r-- | lib-src/ebrowse.c | 285 |
1 files changed, 119 insertions, 166 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 59a1dde7634..7871a804997 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -41,12 +41,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 41 | 41 | ||
| 42 | #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) | 42 | #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) |
| 43 | 43 | ||
| 44 | /* The ubiquitous `max' and `min' macros. */ | 44 | #include <min-max.h> |
| 45 | |||
| 46 | #ifndef max | ||
| 47 | #define max(X, Y) ((X) > (Y) ? (X) : (Y)) | ||
| 48 | #define min(X, Y) ((X) < (Y) ? (X) : (Y)) | ||
| 49 | #endif | ||
| 50 | 45 | ||
| 51 | /* Files are read in chunks of this number of bytes. */ | 46 | /* Files are read in chunks of this number of bytes. */ |
| 52 | 47 | ||
| @@ -82,7 +77,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 82 | #define TREE_HEADER_STRUCT "[ebrowse-hs " | 77 | #define TREE_HEADER_STRUCT "[ebrowse-hs " |
| 83 | #define TREE_STRUCT "[ebrowse-ts " | 78 | #define TREE_STRUCT "[ebrowse-ts " |
| 84 | #define MEMBER_STRUCT "[ebrowse-ms " | 79 | #define MEMBER_STRUCT "[ebrowse-ms " |
| 85 | #define BROWSE_STRUCT "[ebrowse-bs " | ||
| 86 | #define CLASS_STRUCT "[ebrowse-cs " | 80 | #define CLASS_STRUCT "[ebrowse-cs " |
| 87 | 81 | ||
| 88 | /* The name of the symbol table entry for global functions, variables, | 82 | /* The name of the symbol table entry for global functions, variables, |
| @@ -384,7 +378,7 @@ int max_regexp = 50; | |||
| 384 | 378 | ||
| 385 | char *inbuffer; | 379 | char *inbuffer; |
| 386 | char *in; | 380 | char *in; |
| 387 | int inbuffer_size; | 381 | size_t inbuffer_size; |
| 388 | 382 | ||
| 389 | /* Return the current buffer position in the input file. */ | 383 | /* Return the current buffer position in the input file. */ |
| 390 | 384 | ||
| @@ -465,59 +459,16 @@ struct search_path *search_path_tail; | |||
| 465 | 459 | ||
| 466 | /* Function prototypes. */ | 460 | /* Function prototypes. */ |
| 467 | 461 | ||
| 468 | int yylex (void); | 462 | static char *matching_regexp (void); |
| 469 | void yyparse (void); | 463 | static struct sym *add_sym (const char *, struct sym *); |
| 470 | void re_init_parser (void); | 464 | static void add_global_defn (char *, char *, int, unsigned, int, int, int); |
| 471 | const char *token_string (int); | 465 | static void add_global_decl (char *, char *, int, unsigned, int, int, int); |
| 472 | char *matching_regexp (void); | 466 | static struct member *add_member (struct sym *, char *, int, int, unsigned); |
| 473 | void init_sym (void); | 467 | static void class_definition (struct sym *, int, int, int); |
| 474 | struct sym *add_sym (const char *, struct sym *); | 468 | static char *operator_name (int *); |
| 475 | void add_link (struct sym *, struct sym *); | 469 | static void parse_qualified_param_ident_or_type (char **); |
| 476 | void add_member_defn (struct sym *, char *, char *, | 470 | static void usage (int) NO_RETURN; |
| 477 | int, unsigned, int, int, int); | 471 | static void version (void) NO_RETURN; |
| 478 | void add_member_decl (struct sym *, char *, char *, int, | ||
| 479 | unsigned, int, int, int, int); | ||
| 480 | void dump_roots (FILE *); | ||
| 481 | void *xmalloc (int); | ||
| 482 | void xfree (void *); | ||
| 483 | void add_global_defn (char *, char *, int, unsigned, int, int, int); | ||
| 484 | void add_global_decl (char *, char *, int, unsigned, int, int, int); | ||
| 485 | void add_define (char *, char *, int); | ||
| 486 | void mark_inherited_virtual (void); | ||
| 487 | void leave_namespace (void); | ||
| 488 | void enter_namespace (char *); | ||
| 489 | void register_namespace_alias (char *, struct link *); | ||
| 490 | void insert_keyword (const char *, int); | ||
| 491 | void re_init_scanner (void); | ||
| 492 | void init_scanner (void); | ||
| 493 | void process_file (char *); | ||
| 494 | void add_search_path (char *); | ||
| 495 | FILE *open_file (char *); | ||
| 496 | int process_pp_line (void); | ||
| 497 | int dump_members (FILE *, struct member *); | ||
| 498 | void dump_sym (FILE *, struct sym *); | ||
| 499 | int dump_tree (FILE *, struct sym *); | ||
| 500 | struct member *find_member (struct sym *, char *, int, int, unsigned); | ||
| 501 | struct member *add_member (struct sym *, char *, int, int, unsigned); | ||
| 502 | void mark_virtual (struct sym *); | ||
| 503 | struct sym *make_namespace (char *, struct sym *); | ||
| 504 | char *sym_scope (struct sym *); | ||
| 505 | char *sym_scope_1 (struct sym *); | ||
| 506 | int skip_to (int); | ||
| 507 | void skip_matching (void); | ||
| 508 | void member (struct sym *, int); | ||
| 509 | void class_body (struct sym *, int); | ||
| 510 | void class_definition (struct sym *, int, int, int); | ||
| 511 | void declaration (int); | ||
| 512 | unsigned parm_list (int *); | ||
| 513 | char *operator_name (int *); | ||
| 514 | struct sym *parse_classname (void); | ||
| 515 | struct sym *parse_qualified_ident_or_type (char **); | ||
| 516 | void parse_qualified_param_ident_or_type (char **); | ||
| 517 | int globals (int); | ||
| 518 | void yyerror (const char *, const char *); | ||
| 519 | void usage (int) NO_RETURN; | ||
| 520 | void version (void) NO_RETURN; | ||
| 521 | 472 | ||
| 522 | 473 | ||
| 523 | 474 | ||
| @@ -528,7 +479,7 @@ void version (void) NO_RETURN; | |||
| 528 | /* Print an error in a printf-like style with the current input file | 479 | /* Print an error in a printf-like style with the current input file |
| 529 | name and line number. */ | 480 | name and line number. */ |
| 530 | 481 | ||
| 531 | void | 482 | static void |
| 532 | yyerror (const char *format, const char *s) | 483 | yyerror (const char *format, const char *s) |
| 533 | { | 484 | { |
| 534 | fprintf (stderr, "%s:%d: ", filename, yyline); | 485 | fprintf (stderr, "%s:%d: ", filename, yyline); |
| @@ -540,8 +491,8 @@ yyerror (const char *format, const char *s) | |||
| 540 | /* Like malloc but print an error and exit if not enough memory is | 491 | /* Like malloc but print an error and exit if not enough memory is |
| 541 | available. */ | 492 | available. */ |
| 542 | 493 | ||
| 543 | void * | 494 | static void * |
| 544 | xmalloc (int nbytes) | 495 | xmalloc (size_t nbytes) |
| 545 | { | 496 | { |
| 546 | void *p = malloc (nbytes); | 497 | void *p = malloc (nbytes); |
| 547 | if (p == NULL) | 498 | if (p == NULL) |
| @@ -555,8 +506,8 @@ xmalloc (int nbytes) | |||
| 555 | 506 | ||
| 556 | /* Like realloc but print an error and exit if out of memory. */ | 507 | /* Like realloc but print an error and exit if out of memory. */ |
| 557 | 508 | ||
| 558 | void * | 509 | static void * |
| 559 | xrealloc (void *p, int sz) | 510 | xrealloc (void *p, size_t sz) |
| 560 | { | 511 | { |
| 561 | p = realloc (p, sz); | 512 | p = realloc (p, sz); |
| 562 | if (p == NULL) | 513 | if (p == NULL) |
| @@ -571,7 +522,7 @@ xrealloc (void *p, int sz) | |||
| 571 | /* Like strdup, but print an error and exit if not enough memory is | 522 | /* Like strdup, but print an error and exit if not enough memory is |
| 572 | available.. If S is null, return null. */ | 523 | available.. If S is null, return null. */ |
| 573 | 524 | ||
| 574 | char * | 525 | static char * |
| 575 | xstrdup (char *s) | 526 | xstrdup (char *s) |
| 576 | { | 527 | { |
| 577 | if (s) | 528 | if (s) |
| @@ -588,7 +539,7 @@ xstrdup (char *s) | |||
| 588 | /* Initialize the symbol table. This currently only sets up the | 539 | /* Initialize the symbol table. This currently only sets up the |
| 589 | special symbol for globals (`*Globals*'). */ | 540 | special symbol for globals (`*Globals*'). */ |
| 590 | 541 | ||
| 591 | void | 542 | static void |
| 592 | init_sym (void) | 543 | init_sym (void) |
| 593 | { | 544 | { |
| 594 | global_symbols = add_sym (GLOBALS_NAME, NULL); | 545 | global_symbols = add_sym (GLOBALS_NAME, NULL); |
| @@ -602,7 +553,7 @@ init_sym (void) | |||
| 602 | If a symbol for NAME already exists, return that. Otherwise | 553 | If a symbol for NAME already exists, return that. Otherwise |
| 603 | create a new symbol and set it to default values. */ | 554 | create a new symbol and set it to default values. */ |
| 604 | 555 | ||
| 605 | struct sym * | 556 | static struct sym * |
| 606 | add_sym (const char *name, struct sym *nested_in_class) | 557 | add_sym (const char *name, struct sym *nested_in_class) |
| 607 | { | 558 | { |
| 608 | struct sym *sym; | 559 | struct sym *sym; |
| @@ -643,7 +594,7 @@ add_sym (const char *name, struct sym *nested_in_class) | |||
| 643 | 594 | ||
| 644 | /* Add links between superclass SUPER and subclass SUB. */ | 595 | /* Add links between superclass SUPER and subclass SUB. */ |
| 645 | 596 | ||
| 646 | void | 597 | static void |
| 647 | add_link (struct sym *super, struct sym *sub) | 598 | add_link (struct sym *super, struct sym *sub) |
| 648 | { | 599 | { |
| 649 | struct link *lnk, *lnk2, *p, *prev; | 600 | struct link *lnk, *lnk2, *p, *prev; |
| @@ -683,7 +634,7 @@ add_link (struct sym *super, struct sym *sub) | |||
| 683 | parameter types of functions. Value is a pointer to the member | 634 | parameter types of functions. Value is a pointer to the member |
| 684 | found or null if not found. */ | 635 | found or null if not found. */ |
| 685 | 636 | ||
| 686 | struct member * | 637 | static struct member * |
| 687 | find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) | 638 | find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) |
| 688 | { | 639 | { |
| 689 | struct member **list; | 640 | struct member **list; |
| @@ -733,7 +684,7 @@ find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) | |||
| 733 | a bit set giving additional information about the member (see the | 684 | a bit set giving additional information about the member (see the |
| 734 | F_* defines). */ | 685 | F_* defines). */ |
| 735 | 686 | ||
| 736 | void | 687 | static void |
| 737 | add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags) | 688 | add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags) |
| 738 | { | 689 | { |
| 739 | struct member *m; | 690 | struct member *m; |
| @@ -781,7 +732,7 @@ add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned in | |||
| 781 | a bit set giving additional information about the member (see the | 732 | a bit set giving additional information about the member (see the |
| 782 | F_* defines). */ | 733 | F_* defines). */ |
| 783 | 734 | ||
| 784 | void | 735 | static void |
| 785 | add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) | 736 | add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) |
| 786 | { | 737 | { |
| 787 | struct member *m; | 738 | struct member *m; |
| @@ -823,7 +774,7 @@ add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned in | |||
| 823 | REGEXP is a regular expression matching the define in the source, | 774 | REGEXP is a regular expression matching the define in the source, |
| 824 | if it is non-null. POS is the position in the file. */ | 775 | if it is non-null. POS is the position in the file. */ |
| 825 | 776 | ||
| 826 | void | 777 | static void |
| 827 | add_define (char *name, char *regexp, int pos) | 778 | add_define (char *name, char *regexp, int pos) |
| 828 | { | 779 | { |
| 829 | add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); | 780 | add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); |
| @@ -841,7 +792,7 @@ add_define (char *name, char *regexp, int pos) | |||
| 841 | a bit set giving additional information about the member (see the | 792 | a bit set giving additional information about the member (see the |
| 842 | F_* defines). */ | 793 | F_* defines). */ |
| 843 | 794 | ||
| 844 | void | 795 | static void |
| 845 | add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) | 796 | add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) |
| 846 | { | 797 | { |
| 847 | int i; | 798 | int i; |
| @@ -872,7 +823,7 @@ add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, | |||
| 872 | a bit set giving additional information about the member (see the | 823 | a bit set giving additional information about the member (see the |
| 873 | F_* defines). */ | 824 | F_* defines). */ |
| 874 | 825 | ||
| 875 | void | 826 | static void |
| 876 | add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) | 827 | add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) |
| 877 | { | 828 | { |
| 878 | /* Add declaration only if not already declared. Header files must | 829 | /* Add declaration only if not already declared. Header files must |
| @@ -911,7 +862,7 @@ add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, | |||
| 911 | member. HASH is a hash code for the parameter types of a function. | 862 | member. HASH is a hash code for the parameter types of a function. |
| 912 | Value is a pointer to the member's structure. */ | 863 | Value is a pointer to the member's structure. */ |
| 913 | 864 | ||
| 914 | struct member * | 865 | static struct member * |
| 915 | add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) | 866 | add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) |
| 916 | { | 867 | { |
| 917 | struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); | 868 | struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); |
| @@ -982,7 +933,7 @@ add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) | |||
| 982 | recursively, marking functions as virtual that are declared virtual | 933 | recursively, marking functions as virtual that are declared virtual |
| 983 | in base classes. */ | 934 | in base classes. */ |
| 984 | 935 | ||
| 985 | void | 936 | static void |
| 986 | mark_virtual (struct sym *r) | 937 | mark_virtual (struct sym *r) |
| 987 | { | 938 | { |
| 988 | struct link *p; | 939 | struct link *p; |
| @@ -1006,7 +957,7 @@ mark_virtual (struct sym *r) | |||
| 1006 | /* For all roots of the class tree, mark functions as virtual that | 957 | /* For all roots of the class tree, mark functions as virtual that |
| 1007 | are virtual because of a virtual declaration in a base class. */ | 958 | are virtual because of a virtual declaration in a base class. */ |
| 1008 | 959 | ||
| 1009 | void | 960 | static void |
| 1010 | mark_inherited_virtual (void) | 961 | mark_inherited_virtual (void) |
| 1011 | { | 962 | { |
| 1012 | struct sym *r; | 963 | struct sym *r; |
| @@ -1021,7 +972,7 @@ mark_inherited_virtual (void) | |||
| 1021 | 972 | ||
| 1022 | /* Create and return a symbol for a namespace with name NAME. */ | 973 | /* Create and return a symbol for a namespace with name NAME. */ |
| 1023 | 974 | ||
| 1024 | struct sym * | 975 | static struct sym * |
| 1025 | make_namespace (char *name, struct sym *context) | 976 | make_namespace (char *name, struct sym *context) |
| 1026 | { | 977 | { |
| 1027 | struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); | 978 | struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); |
| @@ -1036,7 +987,7 @@ make_namespace (char *name, struct sym *context) | |||
| 1036 | 987 | ||
| 1037 | /* Find the symbol for namespace NAME. If not found, retrun NULL */ | 988 | /* Find the symbol for namespace NAME. If not found, retrun NULL */ |
| 1038 | 989 | ||
| 1039 | struct sym * | 990 | static struct sym * |
| 1040 | check_namespace (char *name, struct sym *context) | 991 | check_namespace (char *name, struct sym *context) |
| 1041 | { | 992 | { |
| 1042 | struct sym *p = NULL; | 993 | struct sym *p = NULL; |
| @@ -1053,7 +1004,7 @@ check_namespace (char *name, struct sym *context) | |||
| 1053 | /* Find the symbol for namespace NAME. If not found, add a new symbol | 1004 | /* Find the symbol for namespace NAME. If not found, add a new symbol |
| 1054 | for NAME to all_namespaces. */ | 1005 | for NAME to all_namespaces. */ |
| 1055 | 1006 | ||
| 1056 | struct sym * | 1007 | static struct sym * |
| 1057 | find_namespace (char *name, struct sym *context) | 1008 | find_namespace (char *name, struct sym *context) |
| 1058 | { | 1009 | { |
| 1059 | struct sym *p = check_namespace (name, context); | 1010 | struct sym *p = check_namespace (name, context); |
| @@ -1067,7 +1018,7 @@ find_namespace (char *name, struct sym *context) | |||
| 1067 | 1018 | ||
| 1068 | /* Find namespace alias with name NAME. If not found return NULL. */ | 1019 | /* Find namespace alias with name NAME. If not found return NULL. */ |
| 1069 | 1020 | ||
| 1070 | struct link * | 1021 | static struct link * |
| 1071 | check_namespace_alias (char *name) | 1022 | check_namespace_alias (char *name) |
| 1072 | { | 1023 | { |
| 1073 | struct link *p = NULL; | 1024 | struct link *p = NULL; |
| @@ -1091,7 +1042,7 @@ check_namespace_alias (char *name) | |||
| 1091 | 1042 | ||
| 1092 | /* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ | 1043 | /* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ |
| 1093 | 1044 | ||
| 1094 | void | 1045 | static void |
| 1095 | register_namespace_alias (char *new_name, struct link *old_name) | 1046 | register_namespace_alias (char *new_name, struct link *old_name) |
| 1096 | { | 1047 | { |
| 1097 | unsigned h; | 1048 | unsigned h; |
| @@ -1119,7 +1070,7 @@ register_namespace_alias (char *new_name, struct link *old_name) | |||
| 1119 | 1070 | ||
| 1120 | /* Enter namespace with name NAME. */ | 1071 | /* Enter namespace with name NAME. */ |
| 1121 | 1072 | ||
| 1122 | void | 1073 | static void |
| 1123 | enter_namespace (char *name) | 1074 | enter_namespace (char *name) |
| 1124 | { | 1075 | { |
| 1125 | struct sym *p = find_namespace (name, current_namespace); | 1076 | struct sym *p = find_namespace (name, current_namespace); |
| @@ -1140,7 +1091,7 @@ enter_namespace (char *name) | |||
| 1140 | 1091 | ||
| 1141 | /* Leave the current namespace. */ | 1092 | /* Leave the current namespace. */ |
| 1142 | 1093 | ||
| 1143 | void | 1094 | static void |
| 1144 | leave_namespace (void) | 1095 | leave_namespace (void) |
| 1145 | { | 1096 | { |
| 1146 | assert (namespace_sp > 0); | 1097 | assert (namespace_sp > 0); |
| @@ -1156,22 +1107,23 @@ leave_namespace (void) | |||
| 1156 | /* Write string S to the output file FP in a Lisp-readable form. | 1107 | /* Write string S to the output file FP in a Lisp-readable form. |
| 1157 | If S is null, write out `()'. */ | 1108 | If S is null, write out `()'. */ |
| 1158 | 1109 | ||
| 1159 | #define PUTSTR(s, fp) \ | 1110 | static inline void |
| 1160 | do { \ | 1111 | putstr (const char *s, FILE *fp) |
| 1161 | if (!s) \ | 1112 | { |
| 1162 | { \ | 1113 | if (!s) |
| 1163 | putc ('(', fp); \ | 1114 | { |
| 1164 | putc (')', fp); \ | 1115 | putc ('(', fp); |
| 1165 | putc (' ', fp); \ | 1116 | putc (')', fp); |
| 1166 | } \ | 1117 | putc (' ', fp); |
| 1167 | else \ | 1118 | } |
| 1168 | { \ | 1119 | else |
| 1169 | putc ('"', fp); \ | 1120 | { |
| 1170 | fputs (s, fp); \ | 1121 | putc ('"', fp); |
| 1171 | putc ('"', fp); \ | 1122 | fputs (s, fp); |
| 1172 | putc (' ', fp); \ | 1123 | putc ('"', fp); |
| 1173 | } \ | 1124 | putc (' ', fp); |
| 1174 | } while (0) | 1125 | } |
| 1126 | } | ||
| 1175 | 1127 | ||
| 1176 | /* A dynamically allocated buffer for constructing a scope name. */ | 1128 | /* A dynamically allocated buffer for constructing a scope name. */ |
| 1177 | 1129 | ||
| @@ -1182,7 +1134,7 @@ int scope_buffer_len; | |||
| 1182 | 1134 | ||
| 1183 | /* Make sure scope_buffer has enough room to add LEN chars to it. */ | 1135 | /* Make sure scope_buffer has enough room to add LEN chars to it. */ |
| 1184 | 1136 | ||
| 1185 | void | 1137 | static void |
| 1186 | ensure_scope_buffer_room (int len) | 1138 | ensure_scope_buffer_room (int len) |
| 1187 | { | 1139 | { |
| 1188 | if (scope_buffer_len + len >= scope_buffer_size) | 1140 | if (scope_buffer_len + len >= scope_buffer_size) |
| @@ -1198,7 +1150,7 @@ ensure_scope_buffer_room (int len) | |||
| 1198 | namespaces to scope_buffer. Value is a pointer to the complete | 1150 | namespaces to scope_buffer. Value is a pointer to the complete |
| 1199 | scope name constructed. */ | 1151 | scope name constructed. */ |
| 1200 | 1152 | ||
| 1201 | char * | 1153 | static char * |
| 1202 | sym_scope_1 (struct sym *p) | 1154 | sym_scope_1 (struct sym *p) |
| 1203 | { | 1155 | { |
| 1204 | int len; | 1156 | int len; |
| @@ -1232,7 +1184,7 @@ sym_scope_1 (struct sym *p) | |||
| 1232 | /* Return the scope of symbol P in printed representation, i.e. | 1184 | /* Return the scope of symbol P in printed representation, i.e. |
| 1233 | as it would appear in a C*+ source file. */ | 1185 | as it would appear in a C*+ source file. */ |
| 1234 | 1186 | ||
| 1235 | char * | 1187 | static char * |
| 1236 | sym_scope (struct sym *p) | 1188 | sym_scope (struct sym *p) |
| 1237 | { | 1189 | { |
| 1238 | if (!scope_buffer) | 1190 | if (!scope_buffer) |
| @@ -1254,7 +1206,7 @@ sym_scope (struct sym *p) | |||
| 1254 | /* Dump the list of members M to file FP. Value is the length of the | 1206 | /* Dump the list of members M to file FP. Value is the length of the |
| 1255 | list. */ | 1207 | list. */ |
| 1256 | 1208 | ||
| 1257 | int | 1209 | static int |
| 1258 | dump_members (FILE *fp, struct member *m) | 1210 | dump_members (FILE *fp, struct member *m) |
| 1259 | { | 1211 | { |
| 1260 | int n; | 1212 | int n; |
| @@ -1264,16 +1216,16 @@ dump_members (FILE *fp, struct member *m) | |||
| 1264 | for (n = 0; m; m = m->next, ++n) | 1216 | for (n = 0; m; m = m->next, ++n) |
| 1265 | { | 1217 | { |
| 1266 | fputs (MEMBER_STRUCT, fp); | 1218 | fputs (MEMBER_STRUCT, fp); |
| 1267 | PUTSTR (m->name, fp); | 1219 | putstr (m->name, fp); |
| 1268 | PUTSTR (NULL, fp); /* FIXME? scope for globals */ | 1220 | putstr (NULL, fp); /* FIXME? scope for globals */ |
| 1269 | fprintf (fp, "%u ", (unsigned) m->flags); | 1221 | fprintf (fp, "%u ", (unsigned) m->flags); |
| 1270 | PUTSTR (m->filename, fp); | 1222 | putstr (m->filename, fp); |
| 1271 | PUTSTR (m->regexp, fp); | 1223 | putstr (m->regexp, fp); |
| 1272 | fprintf (fp, "%u ", (unsigned) m->pos); | 1224 | fprintf (fp, "%u ", (unsigned) m->pos); |
| 1273 | fprintf (fp, "%u ", (unsigned) m->vis); | 1225 | fprintf (fp, "%u ", (unsigned) m->vis); |
| 1274 | putc (' ', fp); | 1226 | putc (' ', fp); |
| 1275 | PUTSTR (m->def_filename, fp); | 1227 | putstr (m->def_filename, fp); |
| 1276 | PUTSTR (m->def_regexp, fp); | 1228 | putstr (m->def_regexp, fp); |
| 1277 | fprintf (fp, "%u", (unsigned) m->def_pos); | 1229 | fprintf (fp, "%u", (unsigned) m->def_pos); |
| 1278 | putc (']', fp); | 1230 | putc (']', fp); |
| 1279 | putc ('\n', fp); | 1231 | putc ('\n', fp); |
| @@ -1287,24 +1239,24 @@ dump_members (FILE *fp, struct member *m) | |||
| 1287 | 1239 | ||
| 1288 | /* Dump class ROOT to stream FP. */ | 1240 | /* Dump class ROOT to stream FP. */ |
| 1289 | 1241 | ||
| 1290 | void | 1242 | static void |
| 1291 | dump_sym (FILE *fp, struct sym *root) | 1243 | dump_sym (FILE *fp, struct sym *root) |
| 1292 | { | 1244 | { |
| 1293 | fputs (CLASS_STRUCT, fp); | 1245 | fputs (CLASS_STRUCT, fp); |
| 1294 | PUTSTR (root->name, fp); | 1246 | putstr (root->name, fp); |
| 1295 | 1247 | ||
| 1296 | /* Print scope, if any. */ | 1248 | /* Print scope, if any. */ |
| 1297 | if (root->namesp) | 1249 | if (root->namesp) |
| 1298 | PUTSTR (sym_scope (root), fp); | 1250 | putstr (sym_scope (root), fp); |
| 1299 | else | 1251 | else |
| 1300 | PUTSTR (NULL, fp); | 1252 | putstr (NULL, fp); |
| 1301 | 1253 | ||
| 1302 | /* Print flags. */ | 1254 | /* Print flags. */ |
| 1303 | fprintf (fp, "%u", root->flags); | 1255 | fprintf (fp, "%u", root->flags); |
| 1304 | PUTSTR (root->filename, fp); | 1256 | putstr (root->filename, fp); |
| 1305 | PUTSTR (root->regexp, fp); | 1257 | putstr (root->regexp, fp); |
| 1306 | fprintf (fp, "%u", (unsigned) root->pos); | 1258 | fprintf (fp, "%u", (unsigned) root->pos); |
| 1307 | PUTSTR (root->sfilename, fp); | 1259 | putstr (root->sfilename, fp); |
| 1308 | putc (']', fp); | 1260 | putc (']', fp); |
| 1309 | putc ('\n', fp); | 1261 | putc ('\n', fp); |
| 1310 | } | 1262 | } |
| @@ -1313,7 +1265,7 @@ dump_sym (FILE *fp, struct sym *root) | |||
| 1313 | /* Dump class ROOT and its subclasses to file FP. Value is the | 1265 | /* Dump class ROOT and its subclasses to file FP. Value is the |
| 1314 | number of classes written. */ | 1266 | number of classes written. */ |
| 1315 | 1267 | ||
| 1316 | int | 1268 | static int |
| 1317 | dump_tree (FILE *fp, struct sym *root) | 1269 | dump_tree (FILE *fp, struct sym *root) |
| 1318 | { | 1270 | { |
| 1319 | struct link *lk; | 1271 | struct link *lk; |
| @@ -1360,7 +1312,7 @@ dump_tree (FILE *fp, struct sym *root) | |||
| 1360 | 1312 | ||
| 1361 | /* Dump the entire class tree to file FP. */ | 1313 | /* Dump the entire class tree to file FP. */ |
| 1362 | 1314 | ||
| 1363 | void | 1315 | static void |
| 1364 | dump_roots (FILE *fp) | 1316 | dump_roots (FILE *fp) |
| 1365 | { | 1317 | { |
| 1366 | int i, n = 0; | 1318 | int i, n = 0; |
| @@ -1371,7 +1323,7 @@ dump_roots (FILE *fp) | |||
| 1371 | if (!f_append) | 1323 | if (!f_append) |
| 1372 | { | 1324 | { |
| 1373 | fputs (TREE_HEADER_STRUCT, fp); | 1325 | fputs (TREE_HEADER_STRUCT, fp); |
| 1374 | PUTSTR (EBROWSE_FILE_VERSION, fp); | 1326 | putstr (EBROWSE_FILE_VERSION, fp); |
| 1375 | 1327 | ||
| 1376 | putc ('\"', fp); | 1328 | putc ('\"', fp); |
| 1377 | if (!f_structs) | 1329 | if (!f_structs) |
| @@ -1434,7 +1386,7 @@ do { \ | |||
| 1434 | /* Process a preprocessor line. Value is the next character from the | 1386 | /* Process a preprocessor line. Value is the next character from the |
| 1435 | input buffer not consumed. */ | 1387 | input buffer not consumed. */ |
| 1436 | 1388 | ||
| 1437 | int | 1389 | static int |
| 1438 | process_pp_line (void) | 1390 | process_pp_line (void) |
| 1439 | { | 1391 | { |
| 1440 | int in_comment = 0, in_string = 0; | 1392 | int in_comment = 0, in_string = 0; |
| @@ -1505,7 +1457,7 @@ process_pp_line (void) | |||
| 1505 | 1457 | ||
| 1506 | /* Value is the next token from the input buffer. */ | 1458 | /* Value is the next token from the input buffer. */ |
| 1507 | 1459 | ||
| 1508 | int | 1460 | static int |
| 1509 | yylex (void) | 1461 | yylex (void) |
| 1510 | { | 1462 | { |
| 1511 | int c; | 1463 | int c; |
| @@ -1927,7 +1879,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf; | |||
| 1927 | position in the input buffer, or maybe a bit more if that string is | 1879 | position in the input buffer, or maybe a bit more if that string is |
| 1928 | shorter than min_regexp. */ | 1880 | shorter than min_regexp. */ |
| 1929 | 1881 | ||
| 1930 | char * | 1882 | static char * |
| 1931 | matching_regexp (void) | 1883 | matching_regexp (void) |
| 1932 | { | 1884 | { |
| 1933 | char *p; | 1885 | char *p; |
| @@ -1978,7 +1930,7 @@ matching_regexp (void) | |||
| 1978 | 1930 | ||
| 1979 | /* Return a printable representation of token T. */ | 1931 | /* Return a printable representation of token T. */ |
| 1980 | 1932 | ||
| 1981 | const char * | 1933 | static const char * |
| 1982 | token_string (int t) | 1934 | token_string (int t) |
| 1983 | { | 1935 | { |
| 1984 | static char b[3]; | 1936 | static char b[3]; |
| @@ -2095,7 +2047,7 @@ token_string (int t) | |||
| 2095 | 2047 | ||
| 2096 | /* Reinitialize the scanner for a new input file. */ | 2048 | /* Reinitialize the scanner for a new input file. */ |
| 2097 | 2049 | ||
| 2098 | void | 2050 | static void |
| 2099 | re_init_scanner (void) | 2051 | re_init_scanner (void) |
| 2100 | { | 2052 | { |
| 2101 | in = inbuffer; | 2053 | in = inbuffer; |
| @@ -2110,11 +2062,11 @@ re_init_scanner (void) | |||
| 2110 | } | 2062 | } |
| 2111 | 2063 | ||
| 2112 | 2064 | ||
| 2113 | /* Insert a keyword NAME with token value TK into the keyword hash | 2065 | /* Insert a keyword NAME with token value TKV into the keyword hash |
| 2114 | table. */ | 2066 | table. */ |
| 2115 | 2067 | ||
| 2116 | void | 2068 | static void |
| 2117 | insert_keyword (const char *name, int tk) | 2069 | insert_keyword (const char *name, int tkv) |
| 2118 | { | 2070 | { |
| 2119 | const char *s; | 2071 | const char *s; |
| 2120 | unsigned h = 0; | 2072 | unsigned h = 0; |
| @@ -2125,7 +2077,7 @@ insert_keyword (const char *name, int tk) | |||
| 2125 | 2077 | ||
| 2126 | h %= KEYWORD_TABLE_SIZE; | 2078 | h %= KEYWORD_TABLE_SIZE; |
| 2127 | k->name = name; | 2079 | k->name = name; |
| 2128 | k->tk = tk; | 2080 | k->tk = tkv; |
| 2129 | k->next = keyword_table[h]; | 2081 | k->next = keyword_table[h]; |
| 2130 | keyword_table[h] = k; | 2082 | keyword_table[h] = k; |
| 2131 | } | 2083 | } |
| @@ -2134,7 +2086,7 @@ insert_keyword (const char *name, int tk) | |||
| 2134 | /* Initialize the scanner for the first file. This sets up the | 2086 | /* Initialize the scanner for the first file. This sets up the |
| 2135 | character class vectors and fills the keyword hash table. */ | 2087 | character class vectors and fills the keyword hash table. */ |
| 2136 | 2088 | ||
| 2137 | void | 2089 | static void |
| 2138 | init_scanner (void) | 2090 | init_scanner (void) |
| 2139 | { | 2091 | { |
| 2140 | int i; | 2092 | int i; |
| @@ -2278,7 +2230,7 @@ init_scanner (void) | |||
| 2278 | /* Skip forward until a given token TOKEN or YYEOF is seen and return | 2230 | /* Skip forward until a given token TOKEN or YYEOF is seen and return |
| 2279 | the current lookahead token after skipping. */ | 2231 | the current lookahead token after skipping. */ |
| 2280 | 2232 | ||
| 2281 | int | 2233 | static int |
| 2282 | skip_to (int token) | 2234 | skip_to (int token) |
| 2283 | { | 2235 | { |
| 2284 | while (!LOOKING_AT2 (YYEOF, token)) | 2236 | while (!LOOKING_AT2 (YYEOF, token)) |
| @@ -2289,7 +2241,7 @@ skip_to (int token) | |||
| 2289 | /* Skip over pairs of tokens (parentheses, square brackets, | 2241 | /* Skip over pairs of tokens (parentheses, square brackets, |
| 2290 | angle brackets, curly brackets) matching the current lookahead. */ | 2242 | angle brackets, curly brackets) matching the current lookahead. */ |
| 2291 | 2243 | ||
| 2292 | void | 2244 | static void |
| 2293 | skip_matching (void) | 2245 | skip_matching (void) |
| 2294 | { | 2246 | { |
| 2295 | int open, close, n; | 2247 | int open, close, n; |
| @@ -2332,7 +2284,7 @@ skip_matching (void) | |||
| 2332 | } | 2284 | } |
| 2333 | } | 2285 | } |
| 2334 | 2286 | ||
| 2335 | void | 2287 | static void |
| 2336 | skip_initializer (void) | 2288 | skip_initializer (void) |
| 2337 | { | 2289 | { |
| 2338 | for (;;) | 2290 | for (;;) |
| @@ -2359,7 +2311,7 @@ skip_initializer (void) | |||
| 2359 | 2311 | ||
| 2360 | /* Build qualified namespace alias (A::B::c) and return it. */ | 2312 | /* Build qualified namespace alias (A::B::c) and return it. */ |
| 2361 | 2313 | ||
| 2362 | struct link * | 2314 | static struct link * |
| 2363 | match_qualified_namespace_alias (void) | 2315 | match_qualified_namespace_alias (void) |
| 2364 | { | 2316 | { |
| 2365 | struct link *head = NULL; | 2317 | struct link *head = NULL; |
| @@ -2396,7 +2348,7 @@ match_qualified_namespace_alias (void) | |||
| 2396 | 2348 | ||
| 2397 | /* Re-initialize the parser by resetting the lookahead token. */ | 2349 | /* Re-initialize the parser by resetting the lookahead token. */ |
| 2398 | 2350 | ||
| 2399 | void | 2351 | static void |
| 2400 | re_init_parser (void) | 2352 | re_init_parser (void) |
| 2401 | { | 2353 | { |
| 2402 | tk = -1; | 2354 | tk = -1; |
| @@ -2409,7 +2361,7 @@ re_init_parser (void) | |||
| 2409 | Returns a hash code for the parameter types. This value is used to | 2361 | Returns a hash code for the parameter types. This value is used to |
| 2410 | distinguish between overloaded functions. */ | 2362 | distinguish between overloaded functions. */ |
| 2411 | 2363 | ||
| 2412 | unsigned | 2364 | static unsigned |
| 2413 | parm_list (int *flags) | 2365 | parm_list (int *flags) |
| 2414 | { | 2366 | { |
| 2415 | unsigned hash = 0; | 2367 | unsigned hash = 0; |
| @@ -2522,7 +2474,7 @@ parm_list (int *flags) | |||
| 2522 | 2474 | ||
| 2523 | /* Print position info to stdout. */ | 2475 | /* Print position info to stdout. */ |
| 2524 | 2476 | ||
| 2525 | void | 2477 | static void |
| 2526 | print_info (void) | 2478 | print_info (void) |
| 2527 | { | 2479 | { |
| 2528 | if (info_position >= 0 && BUFFER_POS () <= info_position) | 2480 | if (info_position >= 0 && BUFFER_POS () <= info_position) |
| @@ -2537,7 +2489,7 @@ print_info (void) | |||
| 2537 | the access specifier for the member (private, protected, | 2489 | the access specifier for the member (private, protected, |
| 2538 | public). */ | 2490 | public). */ |
| 2539 | 2491 | ||
| 2540 | void | 2492 | static void |
| 2541 | member (struct sym *cls, int vis) | 2493 | member (struct sym *cls, int vis) |
| 2542 | { | 2494 | { |
| 2543 | char *id = NULL; | 2495 | char *id = NULL; |
| @@ -2746,7 +2698,7 @@ member (struct sym *cls, int vis) | |||
| 2746 | /* Parse the body of class CLS. TAG is the tag of the class (struct, | 2698 | /* Parse the body of class CLS. TAG is the tag of the class (struct, |
| 2747 | union, class). */ | 2699 | union, class). */ |
| 2748 | 2700 | ||
| 2749 | void | 2701 | static void |
| 2750 | class_body (struct sym *cls, int tag) | 2702 | class_body (struct sym *cls, int tag) |
| 2751 | { | 2703 | { |
| 2752 | int vis = tag == CLASS ? PRIVATE : PUBLIC; | 2704 | int vis = tag == CLASS ? PRIVATE : PUBLIC; |
| @@ -2807,7 +2759,7 @@ class_body (struct sym *cls, int tag) | |||
| 2807 | qualified ident has the form `X<..>::Y<...>::T<...>. Returns a | 2759 | qualified ident has the form `X<..>::Y<...>::T<...>. Returns a |
| 2808 | symbol for that class. */ | 2760 | symbol for that class. */ |
| 2809 | 2761 | ||
| 2810 | struct sym * | 2762 | static struct sym * |
| 2811 | parse_classname (void) | 2763 | parse_classname (void) |
| 2812 | { | 2764 | { |
| 2813 | struct sym *last_class = NULL; | 2765 | struct sym *last_class = NULL; |
| @@ -2837,13 +2789,13 @@ parse_classname (void) | |||
| 2837 | implicitly static operator has been parsed. Value is a pointer to | 2789 | implicitly static operator has been parsed. Value is a pointer to |
| 2838 | a static buffer holding the constructed operator name string. */ | 2790 | a static buffer holding the constructed operator name string. */ |
| 2839 | 2791 | ||
| 2840 | char * | 2792 | static char * |
| 2841 | operator_name (int *sc) | 2793 | operator_name (int *sc) |
| 2842 | { | 2794 | { |
| 2843 | static int id_size = 0; | 2795 | static size_t id_size = 0; |
| 2844 | static char *id = NULL; | 2796 | static char *id = NULL; |
| 2845 | const char *s; | 2797 | const char *s; |
| 2846 | int len; | 2798 | size_t len; |
| 2847 | 2799 | ||
| 2848 | MATCH (); | 2800 | MATCH (); |
| 2849 | 2801 | ||
| @@ -2859,7 +2811,7 @@ operator_name (int *sc) | |||
| 2859 | len = strlen (s) + 10; | 2811 | len = strlen (s) + 10; |
| 2860 | if (len > id_size) | 2812 | if (len > id_size) |
| 2861 | { | 2813 | { |
| 2862 | int new_size = max (len, 2 * id_size); | 2814 | size_t new_size = max (len, 2 * id_size); |
| 2863 | id = (char *) xrealloc (id, new_size); | 2815 | id = (char *) xrealloc (id, new_size); |
| 2864 | id_size = new_size; | 2816 | id_size = new_size; |
| 2865 | } | 2817 | } |
| @@ -2880,7 +2832,7 @@ operator_name (int *sc) | |||
| 2880 | } | 2832 | } |
| 2881 | else | 2833 | else |
| 2882 | { | 2834 | { |
| 2883 | int tokens_matched = 0; | 2835 | size_t tokens_matched = 0; |
| 2884 | 2836 | ||
| 2885 | len = 20; | 2837 | len = 20; |
| 2886 | if (len > id_size) | 2838 | if (len > id_size) |
| @@ -2901,7 +2853,7 @@ operator_name (int *sc) | |||
| 2901 | len += strlen (s) + 2; | 2853 | len += strlen (s) + 2; |
| 2902 | if (len > id_size) | 2854 | if (len > id_size) |
| 2903 | { | 2855 | { |
| 2904 | int new_size = max (len, 2 * id_size); | 2856 | size_t new_size = max (len, 2 * id_size); |
| 2905 | id = (char *) xrealloc (id, new_size); | 2857 | id = (char *) xrealloc (id, new_size); |
| 2906 | id_size = new_size; | 2858 | id_size = new_size; |
| 2907 | } | 2859 | } |
| @@ -2927,7 +2879,7 @@ operator_name (int *sc) | |||
| 2927 | `X::Y::z'. This IDENT is returned in LAST_ID. Value is the | 2879 | `X::Y::z'. This IDENT is returned in LAST_ID. Value is the |
| 2928 | symbol structure for the ident. */ | 2880 | symbol structure for the ident. */ |
| 2929 | 2881 | ||
| 2930 | struct sym * | 2882 | static struct sym * |
| 2931 | parse_qualified_ident_or_type (char **last_id) | 2883 | parse_qualified_ident_or_type (char **last_id) |
| 2932 | { | 2884 | { |
| 2933 | struct sym *cls = NULL; | 2885 | struct sym *cls = NULL; |
| @@ -2992,14 +2944,16 @@ parse_qualified_ident_or_type (char **last_id) | |||
| 2992 | `X::Y::z'. This IDENT is returned in LAST_ID. Value is the | 2944 | `X::Y::z'. This IDENT is returned in LAST_ID. Value is the |
| 2993 | symbol structure for the ident. */ | 2945 | symbol structure for the ident. */ |
| 2994 | 2946 | ||
| 2995 | void | 2947 | static void |
| 2996 | parse_qualified_param_ident_or_type (char **last_id) | 2948 | parse_qualified_param_ident_or_type (char **last_id) |
| 2997 | { | 2949 | { |
| 2998 | struct sym *cls = NULL; | 2950 | struct sym *cls = NULL; |
| 2999 | static char *id = NULL; | 2951 | static char *id = NULL; |
| 3000 | static int id_size = 0; | 2952 | static int id_size = 0; |
| 3001 | 2953 | ||
| 3002 | while (LOOKING_AT (IDENT)) | 2954 | assert (LOOKING_AT (IDENT)); |
| 2955 | |||
| 2956 | do | ||
| 3003 | { | 2957 | { |
| 3004 | int len = strlen (yytext) + 1; | 2958 | int len = strlen (yytext) + 1; |
| 3005 | if (len > id_size) | 2959 | if (len > id_size) |
| @@ -3022,6 +2976,7 @@ parse_qualified_param_ident_or_type (char **last_id) | |||
| 3022 | else | 2976 | else |
| 3023 | break; | 2977 | break; |
| 3024 | } | 2978 | } |
| 2979 | while (LOOKING_AT (IDENT)); | ||
| 3025 | } | 2980 | } |
| 3026 | 2981 | ||
| 3027 | 2982 | ||
| @@ -3034,7 +2989,7 @@ parse_qualified_param_ident_or_type (char **last_id) | |||
| 3034 | 2989 | ||
| 3035 | Current lookahead is the class name. */ | 2990 | Current lookahead is the class name. */ |
| 3036 | 2991 | ||
| 3037 | void | 2992 | static void |
| 3038 | class_definition (struct sym *containing, int tag, int flags, int nested) | 2993 | class_definition (struct sym *containing, int tag, int flags, int nested) |
| 3039 | { | 2994 | { |
| 3040 | struct sym *current; | 2995 | struct sym *current; |
| @@ -3131,7 +3086,7 @@ class_definition (struct sym *containing, int tag, int flags, int nested) | |||
| 3131 | the storage class of *ID. FLAGS is a bit set giving additional | 3086 | the storage class of *ID. FLAGS is a bit set giving additional |
| 3132 | information about the member (see the F_* defines). */ | 3087 | information about the member (see the F_* defines). */ |
| 3133 | 3088 | ||
| 3134 | void | 3089 | static void |
| 3135 | add_declarator (struct sym **cls, char **id, int flags, int sc) | 3090 | add_declarator (struct sym **cls, char **id, int flags, int sc) |
| 3136 | { | 3091 | { |
| 3137 | if (LOOKING_AT2 (';', ',')) | 3092 | if (LOOKING_AT2 (';', ',')) |
| @@ -3174,7 +3129,7 @@ add_declarator (struct sym **cls, char **id, int flags, int sc) | |||
| 3174 | 3129 | ||
| 3175 | /* Parse a declaration. */ | 3130 | /* Parse a declaration. */ |
| 3176 | 3131 | ||
| 3177 | void | 3132 | static void |
| 3178 | declaration (int flags) | 3133 | declaration (int flags) |
| 3179 | { | 3134 | { |
| 3180 | char *id = NULL; | 3135 | char *id = NULL; |
| @@ -3328,7 +3283,7 @@ declaration (int flags) | |||
| 3328 | parsing in an `extern "C"' block. Value is 1 if EOF is reached, 0 | 3283 | parsing in an `extern "C"' block. Value is 1 if EOF is reached, 0 |
| 3329 | otherwise. */ | 3284 | otherwise. */ |
| 3330 | 3285 | ||
| 3331 | int | 3286 | static int |
| 3332 | globals (int start_flags) | 3287 | globals (int start_flags) |
| 3333 | { | 3288 | { |
| 3334 | int anonymous; | 3289 | int anonymous; |
| @@ -3446,7 +3401,7 @@ globals (int start_flags) | |||
| 3446 | 3401 | ||
| 3447 | /* Parse the current input file. */ | 3402 | /* Parse the current input file. */ |
| 3448 | 3403 | ||
| 3449 | void | 3404 | static void |
| 3450 | yyparse (void) | 3405 | yyparse (void) |
| 3451 | { | 3406 | { |
| 3452 | while (globals (0) == 0) | 3407 | while (globals (0) == 0) |
| @@ -3462,7 +3417,7 @@ yyparse (void) | |||
| 3462 | /* Add the list of paths PATH_LIST to the current search path for | 3417 | /* Add the list of paths PATH_LIST to the current search path for |
| 3463 | input files. */ | 3418 | input files. */ |
| 3464 | 3419 | ||
| 3465 | void | 3420 | static void |
| 3466 | add_search_path (char *path_list) | 3421 | add_search_path (char *path_list) |
| 3467 | { | 3422 | { |
| 3468 | while (*path_list) | 3423 | while (*path_list) |
| @@ -3497,7 +3452,7 @@ add_search_path (char *path_list) | |||
| 3497 | opened. Try to find FILE in search_path first, then try the | 3452 | opened. Try to find FILE in search_path first, then try the |
| 3498 | unchanged file name. */ | 3453 | unchanged file name. */ |
| 3499 | 3454 | ||
| 3500 | FILE * | 3455 | static FILE * |
| 3501 | open_file (char *file) | 3456 | open_file (char *file) |
| 3502 | { | 3457 | { |
| 3503 | FILE *fp = NULL; | 3458 | FILE *fp = NULL; |
| @@ -3556,7 +3511,7 @@ Usage: ebrowse [options] {files}\n\ | |||
| 3556 | --version display version info\n\ | 3511 | --version display version info\n\ |
| 3557 | " | 3512 | " |
| 3558 | 3513 | ||
| 3559 | void | 3514 | static void |
| 3560 | usage (int error) | 3515 | usage (int error) |
| 3561 | { | 3516 | { |
| 3562 | puts (USAGE); | 3517 | puts (USAGE); |
| @@ -3571,7 +3526,7 @@ usage (int error) | |||
| 3571 | # define VERSION "21" | 3526 | # define VERSION "21" |
| 3572 | #endif | 3527 | #endif |
| 3573 | 3528 | ||
| 3574 | void | 3529 | static void |
| 3575 | version (void) | 3530 | version (void) |
| 3576 | { | 3531 | { |
| 3577 | /* Makes it easier to update automatically. */ | 3532 | /* Makes it easier to update automatically. */ |
| @@ -3587,7 +3542,7 @@ version (void) | |||
| 3587 | /* Parse one input file FILE, adding classes and members to the symbol | 3542 | /* Parse one input file FILE, adding classes and members to the symbol |
| 3588 | table. */ | 3543 | table. */ |
| 3589 | 3544 | ||
| 3590 | void | 3545 | static void |
| 3591 | process_file (char *file) | 3546 | process_file (char *file) |
| 3592 | { | 3547 | { |
| 3593 | FILE *fp; | 3548 | FILE *fp; |
| @@ -3595,7 +3550,7 @@ process_file (char *file) | |||
| 3595 | fp = open_file (file); | 3550 | fp = open_file (file); |
| 3596 | if (fp) | 3551 | if (fp) |
| 3597 | { | 3552 | { |
| 3598 | int nread, nbytes; | 3553 | size_t nread, nbytes; |
| 3599 | 3554 | ||
| 3600 | /* Give a progress indication if needed. */ | 3555 | /* Give a progress indication if needed. */ |
| 3601 | if (f_very_verbose) | 3556 | if (f_very_verbose) |
| @@ -3619,12 +3574,10 @@ process_file (char *file) | |||
| 3619 | } | 3574 | } |
| 3620 | 3575 | ||
| 3621 | nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); | 3576 | nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); |
| 3622 | if (nbytes <= 0) | 3577 | if (nbytes == 0) |
| 3623 | break; | 3578 | break; |
| 3624 | nread += nbytes; | 3579 | nread += nbytes; |
| 3625 | } | 3580 | } |
| 3626 | if (nread < 0) | ||
| 3627 | nread = 0; | ||
| 3628 | inbuffer[nread] = '\0'; | 3581 | inbuffer[nread] = '\0'; |
| 3629 | 3582 | ||
| 3630 | /* Reinitialize scanner and parser for the new input file. */ | 3583 | /* Reinitialize scanner and parser for the new input file. */ |
| @@ -3642,7 +3595,7 @@ process_file (char *file) | |||
| 3642 | containing its contents without the terminating newline. Value | 3595 | containing its contents without the terminating newline. Value |
| 3643 | is null when EOF is reached. */ | 3596 | is null when EOF is reached. */ |
| 3644 | 3597 | ||
| 3645 | char * | 3598 | static char * |
| 3646 | read_line (FILE *fp) | 3599 | read_line (FILE *fp) |
| 3647 | { | 3600 | { |
| 3648 | static char *buffer; | 3601 | static char *buffer; |