diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 4 | ||||
| -rw-r--r-- | lib-src/ebrowse.c | 137 |
2 files changed, 76 insertions, 65 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 4159da65173..a360389ecb3 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2001-12-19 Pavel Jan,Bm(Bk <Pavel@Janik.cz> | ||
| 2 | |||
| 3 | * ebrowse.c: Include stdlib.h and string.h conditionally. | ||
| 4 | |||
| 1 | 2001-12-18 Eli Zaretskii <eliz@is.elta.co.il> | 5 | 2001-12-18 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 6 | ||
| 3 | * yow.c (main): Use time_t, not long, to avoid a compiler warning. | 7 | * yow.c (main): Use time_t, not long, to avoid a compiler warning. |
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 69bd057a59c..8522a795980 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | Author: Gerd Moellmann <gerd@gnu.org> | 7 | Author: Gerd Moellmann <gerd@gnu.org> |
| 8 | Maintainer: FSF | 8 | Maintainer: FSF |
| 9 | 9 | ||
| 10 | This file is part of GNU Emacs. | 10 | This file is part of GNU Emacs. |
| 11 | 11 | ||
| 12 | GNU Emacs is free software; you can redistribute it and/or modify | 12 | GNU Emacs is free software; you can redistribute it and/or modify |
| @@ -28,8 +28,15 @@ | |||
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | #include <stdio.h> | 30 | #include <stdio.h> |
| 31 | |||
| 32 | #ifdef HAVE_STDLIB_H | ||
| 31 | #include <stdlib.h> | 33 | #include <stdlib.h> |
| 34 | #endif | ||
| 35 | |||
| 36 | #ifdef HAVE_STRING_H | ||
| 32 | #include <string.h> | 37 | #include <string.h> |
| 38 | #endif | ||
| 39 | |||
| 33 | #include <ctype.h> | 40 | #include <ctype.h> |
| 34 | #include <assert.h> | 41 | #include <assert.h> |
| 35 | #include "getopt.h" | 42 | #include "getopt.h" |
| @@ -400,7 +407,7 @@ int inbuffer_size; | |||
| 400 | 407 | ||
| 401 | #define BUFFER_POS() (in - inbuffer) | 408 | #define BUFFER_POS() (in - inbuffer) |
| 402 | 409 | ||
| 403 | /* If current lookahead is CSTRING, the following points to the | 410 | /* If current lookahead is CSTRING, the following points to the |
| 404 | first character in the string constant. Used for recognizing | 411 | first character in the string constant. Used for recognizing |
| 405 | extern "C". */ | 412 | extern "C". */ |
| 406 | 413 | ||
| @@ -686,7 +693,7 @@ add_link (super, sub) | |||
| 686 | { | 693 | { |
| 687 | lnk = (struct link *) xmalloc (sizeof *lnk); | 694 | lnk = (struct link *) xmalloc (sizeof *lnk); |
| 688 | lnk2 = (struct link *) xmalloc (sizeof *lnk2); | 695 | lnk2 = (struct link *) xmalloc (sizeof *lnk2); |
| 689 | 696 | ||
| 690 | lnk->sym = sub; | 697 | lnk->sym = sub; |
| 691 | lnk->next = p; | 698 | lnk->next = p; |
| 692 | 699 | ||
| @@ -728,15 +735,15 @@ find_member (cls, name, var, sc, hash) | |||
| 728 | case SC_FRIEND: | 735 | case SC_FRIEND: |
| 729 | list = &cls->friends; | 736 | list = &cls->friends; |
| 730 | break; | 737 | break; |
| 731 | 738 | ||
| 732 | case SC_TYPE: | 739 | case SC_TYPE: |
| 733 | list = &cls->types; | 740 | list = &cls->types; |
| 734 | break; | 741 | break; |
| 735 | 742 | ||
| 736 | case SC_STATIC: | 743 | case SC_STATIC: |
| 737 | list = var ? &cls->static_vars : &cls->static_fns; | 744 | list = var ? &cls->static_vars : &cls->static_fns; |
| 738 | break; | 745 | break; |
| 739 | 746 | ||
| 740 | default: | 747 | default: |
| 741 | list = var ? &cls->vars : &cls->fns; | 748 | list = var ? &cls->vars : &cls->fns; |
| 742 | break; | 749 | break; |
| @@ -928,7 +935,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags) | |||
| 928 | a bit set giving additional information about the member (see the | 935 | a bit set giving additional information about the member (see the |
| 929 | F_* defines). */ | 936 | F_* defines). */ |
| 930 | 937 | ||
| 931 | void | 938 | void |
| 932 | add_global_decl (name, regexp, pos, hash, var, sc, flags) | 939 | add_global_decl (name, regexp, pos, hash, var, sc, flags) |
| 933 | char *name, *regexp; | 940 | char *name, *regexp; |
| 934 | int pos; | 941 | int pos; |
| @@ -1008,15 +1015,15 @@ add_member (cls, name, var, sc, hash) | |||
| 1008 | case SC_FRIEND: | 1015 | case SC_FRIEND: |
| 1009 | list = &cls->friends; | 1016 | list = &cls->friends; |
| 1010 | break; | 1017 | break; |
| 1011 | 1018 | ||
| 1012 | case SC_TYPE: | 1019 | case SC_TYPE: |
| 1013 | list = &cls->types; | 1020 | list = &cls->types; |
| 1014 | break; | 1021 | break; |
| 1015 | 1022 | ||
| 1016 | case SC_STATIC: | 1023 | case SC_STATIC: |
| 1017 | list = var ? &cls->static_vars : &cls->static_fns; | 1024 | list = var ? &cls->static_vars : &cls->static_fns; |
| 1018 | break; | 1025 | break; |
| 1019 | 1026 | ||
| 1020 | default: | 1027 | default: |
| 1021 | list = var ? &cls->vars : &cls->fns; | 1028 | list = var ? &cls->vars : &cls->fns; |
| 1022 | break; | 1029 | break; |
| @@ -1112,7 +1119,7 @@ check_namespace (name, context) | |||
| 1112 | struct sym *context; | 1119 | struct sym *context; |
| 1113 | { | 1120 | { |
| 1114 | struct sym *p = NULL; | 1121 | struct sym *p = NULL; |
| 1115 | 1122 | ||
| 1116 | for (p = all_namespaces; p; p = p->next) | 1123 | for (p = all_namespaces; p; p = p->next) |
| 1117 | { | 1124 | { |
| 1118 | if (streq (p->name, name) && (p->namesp == context)) | 1125 | if (streq (p->name, name) && (p->namesp == context)) |
| @@ -1137,7 +1144,7 @@ find_namespace (name, context) | |||
| 1137 | 1144 | ||
| 1138 | return p; | 1145 | return p; |
| 1139 | } | 1146 | } |
| 1140 | 1147 | ||
| 1141 | 1148 | ||
| 1142 | /* Find namespace alias with name NAME. If not found return NULL. */ | 1149 | /* Find namespace alias with name NAME. If not found return NULL. */ |
| 1143 | 1150 | ||
| @@ -1210,7 +1217,7 @@ enter_namespace (name) | |||
| 1210 | size * sizeof *namespace_stack); | 1217 | size * sizeof *namespace_stack); |
| 1211 | namespace_stack_size = size; | 1218 | namespace_stack_size = size; |
| 1212 | } | 1219 | } |
| 1213 | 1220 | ||
| 1214 | namespace_stack[namespace_sp++] = current_namespace; | 1221 | namespace_stack[namespace_sp++] = current_namespace; |
| 1215 | current_namespace = p; | 1222 | current_namespace = p; |
| 1216 | } | 1223 | } |
| @@ -1282,7 +1289,7 @@ sym_scope_1 (p) | |||
| 1282 | struct sym *p; | 1289 | struct sym *p; |
| 1283 | { | 1290 | { |
| 1284 | int len; | 1291 | int len; |
| 1285 | 1292 | ||
| 1286 | if (p->namesp) | 1293 | if (p->namesp) |
| 1287 | sym_scope_1 (p->namesp); | 1294 | sym_scope_1 (p->namesp); |
| 1288 | 1295 | ||
| @@ -1297,14 +1304,14 @@ sym_scope_1 (p) | |||
| 1297 | ensure_scope_buffer_room (len + 1); | 1304 | ensure_scope_buffer_room (len + 1); |
| 1298 | strcat (scope_buffer, p->name); | 1305 | strcat (scope_buffer, p->name); |
| 1299 | scope_buffer_len += len; | 1306 | scope_buffer_len += len; |
| 1300 | 1307 | ||
| 1301 | if (HAS_FLAG (p->flags, F_TEMPLATE)) | 1308 | if (HAS_FLAG (p->flags, F_TEMPLATE)) |
| 1302 | { | 1309 | { |
| 1303 | ensure_scope_buffer_room (3); | 1310 | ensure_scope_buffer_room (3); |
| 1304 | strcat (scope_buffer, "<>"); | 1311 | strcat (scope_buffer, "<>"); |
| 1305 | scope_buffer_len += 2; | 1312 | scope_buffer_len += 2; |
| 1306 | } | 1313 | } |
| 1307 | 1314 | ||
| 1308 | return scope_buffer; | 1315 | return scope_buffer; |
| 1309 | } | 1316 | } |
| 1310 | 1317 | ||
| @@ -1321,10 +1328,10 @@ sym_scope (p) | |||
| 1321 | scope_buffer_size = 1024; | 1328 | scope_buffer_size = 1024; |
| 1322 | scope_buffer = (char *) xmalloc (scope_buffer_size); | 1329 | scope_buffer = (char *) xmalloc (scope_buffer_size); |
| 1323 | } | 1330 | } |
| 1324 | 1331 | ||
| 1325 | *scope_buffer = '\0'; | 1332 | *scope_buffer = '\0'; |
| 1326 | scope_buffer_len = 0; | 1333 | scope_buffer_len = 0; |
| 1327 | 1334 | ||
| 1328 | if (p->namesp) | 1335 | if (p->namesp) |
| 1329 | sym_scope_1 (p->namesp); | 1336 | sym_scope_1 (p->namesp); |
| 1330 | 1337 | ||
| @@ -1377,13 +1384,13 @@ dump_sym (fp, root) | |||
| 1377 | { | 1384 | { |
| 1378 | fputs (CLASS_STRUCT, fp); | 1385 | fputs (CLASS_STRUCT, fp); |
| 1379 | PUTSTR (root->name, fp); | 1386 | PUTSTR (root->name, fp); |
| 1380 | 1387 | ||
| 1381 | /* Print scope, if any. */ | 1388 | /* Print scope, if any. */ |
| 1382 | if (root->namesp) | 1389 | if (root->namesp) |
| 1383 | PUTSTR (sym_scope (root), fp); | 1390 | PUTSTR (sym_scope (root), fp); |
| 1384 | else | 1391 | else |
| 1385 | PUTSTR (NULL, fp); | 1392 | PUTSTR (NULL, fp); |
| 1386 | 1393 | ||
| 1387 | /* Print flags. */ | 1394 | /* Print flags. */ |
| 1388 | fprintf (fp, "%u", root->flags); | 1395 | fprintf (fp, "%u", root->flags); |
| 1389 | PUTSTR (root->filename, fp); | 1396 | PUTSTR (root->filename, fp); |
| @@ -1563,7 +1570,7 @@ process_pp_line () | |||
| 1563 | add_define (yytext, regexp, pos); | 1570 | add_define (yytext, regexp, pos); |
| 1564 | } | 1571 | } |
| 1565 | } | 1572 | } |
| 1566 | 1573 | ||
| 1567 | while (c && (c != '\n' || in_comment || in_string)) | 1574 | while (c && (c != '\n' || in_comment || in_string)) |
| 1568 | { | 1575 | { |
| 1569 | if (c == '\\') | 1576 | if (c == '\\') |
| @@ -1580,7 +1587,7 @@ process_pp_line () | |||
| 1580 | } | 1587 | } |
| 1581 | else if (c == '"') | 1588 | else if (c == '"') |
| 1582 | in_string = !in_string; | 1589 | in_string = !in_string; |
| 1583 | 1590 | ||
| 1584 | if (c == '\n') | 1591 | if (c == '\n') |
| 1585 | INCREMENT_LINENO; | 1592 | INCREMENT_LINENO; |
| 1586 | 1593 | ||
| @@ -2184,7 +2191,7 @@ re_init_scanner () | |||
| 2184 | { | 2191 | { |
| 2185 | in = inbuffer; | 2192 | in = inbuffer; |
| 2186 | yyline = 1; | 2193 | yyline = 1; |
| 2187 | 2194 | ||
| 2188 | if (yytext == NULL) | 2195 | if (yytext == NULL) |
| 2189 | { | 2196 | { |
| 2190 | int size = 256; | 2197 | int size = 256; |
| @@ -2386,19 +2393,19 @@ skip_matching () | |||
| 2386 | case '{': | 2393 | case '{': |
| 2387 | close = '}'; | 2394 | close = '}'; |
| 2388 | break; | 2395 | break; |
| 2389 | 2396 | ||
| 2390 | case '(': | 2397 | case '(': |
| 2391 | close = ')'; | 2398 | close = ')'; |
| 2392 | break; | 2399 | break; |
| 2393 | 2400 | ||
| 2394 | case '<': | 2401 | case '<': |
| 2395 | close = '>'; | 2402 | close = '>'; |
| 2396 | break; | 2403 | break; |
| 2397 | 2404 | ||
| 2398 | case '[': | 2405 | case '[': |
| 2399 | close = ']'; | 2406 | close = ']'; |
| 2400 | break; | 2407 | break; |
| 2401 | 2408 | ||
| 2402 | default: | 2409 | default: |
| 2403 | abort (); | 2410 | abort (); |
| 2404 | } | 2411 | } |
| @@ -2505,7 +2512,7 @@ parm_list (flags) | |||
| 2505 | { | 2512 | { |
| 2506 | char *last_id; | 2513 | char *last_id; |
| 2507 | unsigned ident_type_hash = 0; | 2514 | unsigned ident_type_hash = 0; |
| 2508 | 2515 | ||
| 2509 | parse_qualified_param_ident_or_type (&last_id); | 2516 | parse_qualified_param_ident_or_type (&last_id); |
| 2510 | if (last_id) | 2517 | if (last_id) |
| 2511 | { | 2518 | { |
| @@ -2533,7 +2540,7 @@ parm_list (flags) | |||
| 2533 | case DOUBLE: case ENUM: case FLOAT: case INT: | 2540 | case DOUBLE: case ENUM: case FLOAT: case INT: |
| 2534 | case LONG: case SHORT: case SIGNED: case STRUCT: | 2541 | case LONG: case SHORT: case SIGNED: case STRUCT: |
| 2535 | case UNION: case UNSIGNED: case VOLATILE: case WCHAR: | 2542 | case UNION: case UNSIGNED: case VOLATILE: case WCHAR: |
| 2536 | case ELLIPSIS: | 2543 | case ELLIPSIS: |
| 2537 | type_seen = 1; | 2544 | type_seen = 1; |
| 2538 | hash = (hash << 1) ^ LA1; | 2545 | hash = (hash << 1) ^ LA1; |
| 2539 | MATCH (); | 2546 | MATCH (); |
| @@ -2553,7 +2560,7 @@ parm_list (flags) | |||
| 2553 | if (LOOKING_AT (')')) | 2560 | if (LOOKING_AT (')')) |
| 2554 | { | 2561 | { |
| 2555 | MATCH (); | 2562 | MATCH (); |
| 2556 | 2563 | ||
| 2557 | if (LOOKING_AT (CONST)) | 2564 | if (LOOKING_AT (CONST)) |
| 2558 | { | 2565 | { |
| 2559 | /* We can overload the same function on `const' */ | 2566 | /* We can overload the same function on `const' */ |
| @@ -2638,7 +2645,7 @@ member (cls, vis) | |||
| 2638 | case EXPLICIT: | 2645 | case EXPLICIT: |
| 2639 | SET_FLAG (flags, F_EXPLICIT); | 2646 | SET_FLAG (flags, F_EXPLICIT); |
| 2640 | goto typeseen; | 2647 | goto typeseen; |
| 2641 | 2648 | ||
| 2642 | case MUTABLE: | 2649 | case MUTABLE: |
| 2643 | SET_FLAG (flags, F_MUTABLE); | 2650 | SET_FLAG (flags, F_MUTABLE); |
| 2644 | goto typeseen; | 2651 | goto typeseen; |
| @@ -2773,7 +2780,7 @@ member (cls, vis) | |||
| 2773 | { | 2780 | { |
| 2774 | regexp = matching_regexp (); | 2781 | regexp = matching_regexp (); |
| 2775 | pos = BUFFER_POS (); | 2782 | pos = BUFFER_POS (); |
| 2776 | 2783 | ||
| 2777 | if (cls != NULL) | 2784 | if (cls != NULL) |
| 2778 | { | 2785 | { |
| 2779 | if (type_seen || !paren_seen) | 2786 | if (type_seen || !paren_seen) |
| @@ -2782,7 +2789,7 @@ member (cls, vis) | |||
| 2782 | add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, 0); | 2789 | add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, 0); |
| 2783 | } | 2790 | } |
| 2784 | } | 2791 | } |
| 2785 | 2792 | ||
| 2786 | MATCH (); | 2793 | MATCH (); |
| 2787 | print_info (); | 2794 | print_info (); |
| 2788 | } | 2795 | } |
| @@ -2879,7 +2886,7 @@ struct sym * | |||
| 2879 | parse_classname () | 2886 | parse_classname () |
| 2880 | { | 2887 | { |
| 2881 | struct sym *last_class = NULL; | 2888 | struct sym *last_class = NULL; |
| 2882 | 2889 | ||
| 2883 | while (LOOKING_AT (IDENT)) | 2890 | while (LOOKING_AT (IDENT)) |
| 2884 | { | 2891 | { |
| 2885 | last_class = add_sym (yytext, last_class); | 2892 | last_class = add_sym (yytext, last_class); |
| @@ -2890,10 +2897,10 @@ parse_classname () | |||
| 2890 | skip_matching (); | 2897 | skip_matching (); |
| 2891 | SET_FLAG (last_class->flags, F_TEMPLATE); | 2898 | SET_FLAG (last_class->flags, F_TEMPLATE); |
| 2892 | } | 2899 | } |
| 2893 | 2900 | ||
| 2894 | if (!LOOKING_AT (DCOLON)) | 2901 | if (!LOOKING_AT (DCOLON)) |
| 2895 | break; | 2902 | break; |
| 2896 | 2903 | ||
| 2897 | MATCH (); | 2904 | MATCH (); |
| 2898 | } | 2905 | } |
| 2899 | 2906 | ||
| @@ -2913,7 +2920,7 @@ operator_name (sc) | |||
| 2913 | static char *id = NULL; | 2920 | static char *id = NULL; |
| 2914 | char *s; | 2921 | char *s; |
| 2915 | int len; | 2922 | int len; |
| 2916 | 2923 | ||
| 2917 | MATCH (); | 2924 | MATCH (); |
| 2918 | 2925 | ||
| 2919 | if (LOOKING_AT2 (NEW, DELETE)) | 2926 | if (LOOKING_AT2 (NEW, DELETE)) |
| @@ -2924,7 +2931,7 @@ operator_name (sc) | |||
| 2924 | 2931 | ||
| 2925 | s = token_string (LA1); | 2932 | s = token_string (LA1); |
| 2926 | MATCH (); | 2933 | MATCH (); |
| 2927 | 2934 | ||
| 2928 | len = strlen (s) + 10; | 2935 | len = strlen (s) + 10; |
| 2929 | if (len > id_size) | 2936 | if (len > id_size) |
| 2930 | { | 2937 | { |
| @@ -2934,12 +2941,12 @@ operator_name (sc) | |||
| 2934 | } | 2941 | } |
| 2935 | strcpy (id, s); | 2942 | strcpy (id, s); |
| 2936 | 2943 | ||
| 2937 | /* Vector new or delete? */ | 2944 | /* Vector new or delete? */ |
| 2938 | if (LOOKING_AT ('[')) | 2945 | if (LOOKING_AT ('[')) |
| 2939 | { | 2946 | { |
| 2940 | strcat (id, "["); | 2947 | strcat (id, "["); |
| 2941 | MATCH (); | 2948 | MATCH (); |
| 2942 | 2949 | ||
| 2943 | if (LOOKING_AT (']')) | 2950 | if (LOOKING_AT (']')) |
| 2944 | { | 2951 | { |
| 2945 | strcat (id, "]"); | 2952 | strcat (id, "]"); |
| @@ -3004,7 +3011,7 @@ parse_qualified_ident_or_type (last_id) | |||
| 3004 | char *id = NULL; | 3011 | char *id = NULL; |
| 3005 | size_t id_size = 0; | 3012 | size_t id_size = 0; |
| 3006 | int enter = 0; | 3013 | int enter = 0; |
| 3007 | 3014 | ||
| 3008 | while (LOOKING_AT (IDENT)) | 3015 | while (LOOKING_AT (IDENT)) |
| 3009 | { | 3016 | { |
| 3010 | int len = strlen (yytext) + 1; | 3017 | int len = strlen (yytext) + 1; |
| @@ -3233,7 +3240,7 @@ declaration (flags) | |||
| 3233 | sc = SC_TYPE; | 3240 | sc = SC_TYPE; |
| 3234 | MATCH (); | 3241 | MATCH (); |
| 3235 | break; | 3242 | break; |
| 3236 | 3243 | ||
| 3237 | case STATIC: | 3244 | case STATIC: |
| 3238 | sc = SC_STATIC; | 3245 | sc = SC_STATIC; |
| 3239 | MATCH (); | 3246 | MATCH (); |
| @@ -3361,7 +3368,7 @@ declaration (flags) | |||
| 3361 | else | 3368 | else |
| 3362 | add_global_defn (id, regexp, pos, 0, 1, sc, flags); | 3369 | add_global_defn (id, regexp, pos, 0, 1, sc, flags); |
| 3363 | } | 3370 | } |
| 3364 | 3371 | ||
| 3365 | MATCH (); | 3372 | MATCH (); |
| 3366 | print_info (); | 3373 | print_info (); |
| 3367 | } | 3374 | } |
| @@ -3399,7 +3406,7 @@ globals (start_flags) | |||
| 3399 | for (;;) | 3406 | for (;;) |
| 3400 | { | 3407 | { |
| 3401 | char *prev_in = in; | 3408 | char *prev_in = in; |
| 3402 | 3409 | ||
| 3403 | switch (LA1) | 3410 | switch (LA1) |
| 3404 | { | 3411 | { |
| 3405 | case NAMESPACE: | 3412 | case NAMESPACE: |
| @@ -3410,13 +3417,13 @@ globals (start_flags) | |||
| 3410 | { | 3417 | { |
| 3411 | char *namespace_name = xstrdup (yytext); | 3418 | char *namespace_name = xstrdup (yytext); |
| 3412 | MATCH (); | 3419 | MATCH (); |
| 3413 | 3420 | ||
| 3414 | if (LOOKING_AT ('=')) | 3421 | if (LOOKING_AT ('=')) |
| 3415 | { | 3422 | { |
| 3416 | struct link *qna = match_qualified_namespace_alias (); | 3423 | struct link *qna = match_qualified_namespace_alias (); |
| 3417 | if (qna) | 3424 | if (qna) |
| 3418 | register_namespace_alias (namespace_name, qna); | 3425 | register_namespace_alias (namespace_name, qna); |
| 3419 | 3426 | ||
| 3420 | if (skip_to (';') == ';') | 3427 | if (skip_to (';') == ';') |
| 3421 | MATCH (); | 3428 | MATCH (); |
| 3422 | } | 3429 | } |
| @@ -3441,7 +3448,7 @@ globals (start_flags) | |||
| 3441 | { | 3448 | { |
| 3442 | /* This is `extern "C"'. */ | 3449 | /* This is `extern "C"'. */ |
| 3443 | MATCH (); | 3450 | MATCH (); |
| 3444 | 3451 | ||
| 3445 | if (LOOKING_AT ('{')) | 3452 | if (LOOKING_AT ('{')) |
| 3446 | { | 3453 | { |
| 3447 | MATCH (); | 3454 | MATCH (); |
| @@ -3452,7 +3459,7 @@ globals (start_flags) | |||
| 3452 | SET_FLAG (flags, F_EXTERNC); | 3459 | SET_FLAG (flags, F_EXTERNC); |
| 3453 | } | 3460 | } |
| 3454 | break; | 3461 | break; |
| 3455 | 3462 | ||
| 3456 | case TEMPLATE: | 3463 | case TEMPLATE: |
| 3457 | MATCH (); | 3464 | MATCH (); |
| 3458 | SKIP_MATCHING_IF ('<'); | 3465 | SKIP_MATCHING_IF ('<'); |
| @@ -3492,7 +3499,7 @@ globals (start_flags) | |||
| 3492 | 3499 | ||
| 3493 | case '}': | 3500 | case '}': |
| 3494 | return 0; | 3501 | return 0; |
| 3495 | 3502 | ||
| 3496 | default: | 3503 | default: |
| 3497 | declaration (flags); | 3504 | declaration (flags); |
| 3498 | flags = start_flags; | 3505 | flags = start_flags; |
| @@ -3531,10 +3538,10 @@ add_search_path (path_list) | |||
| 3531 | { | 3538 | { |
| 3532 | char *start = path_list; | 3539 | char *start = path_list; |
| 3533 | struct search_path *p; | 3540 | struct search_path *p; |
| 3534 | 3541 | ||
| 3535 | while (*path_list && *path_list != PATH_LIST_SEPARATOR) | 3542 | while (*path_list && *path_list != PATH_LIST_SEPARATOR) |
| 3536 | ++path_list; | 3543 | ++path_list; |
| 3537 | 3544 | ||
| 3538 | p = (struct search_path *) xmalloc (sizeof *p); | 3545 | p = (struct search_path *) xmalloc (sizeof *p); |
| 3539 | p->path = (char *) xmalloc (path_list - start + 1); | 3546 | p->path = (char *) xmalloc (path_list - start + 1); |
| 3540 | memcpy (p->path, start, path_list - start); | 3547 | memcpy (p->path, start, path_list - start); |
| @@ -3568,7 +3575,7 @@ open_file (file) | |||
| 3568 | static int buffer_size; | 3575 | static int buffer_size; |
| 3569 | struct search_path *path; | 3576 | struct search_path *path; |
| 3570 | int flen = strlen (file) + 1; /* +1 for the slash */ | 3577 | int flen = strlen (file) + 1; /* +1 for the slash */ |
| 3571 | 3578 | ||
| 3572 | filename = xstrdup (file); | 3579 | filename = xstrdup (file); |
| 3573 | 3580 | ||
| 3574 | for (path = search_path; path && fp == NULL; path = path->next) | 3581 | for (path = search_path; path && fp == NULL; path = path->next) |
| @@ -3580,20 +3587,20 @@ open_file (file) | |||
| 3580 | buffer_size = max (len + 1, 2 * buffer_size); | 3587 | buffer_size = max (len + 1, 2 * buffer_size); |
| 3581 | buffer = (char *) xrealloc (buffer, buffer_size); | 3588 | buffer = (char *) xrealloc (buffer, buffer_size); |
| 3582 | } | 3589 | } |
| 3583 | 3590 | ||
| 3584 | strcpy (buffer, path->path); | 3591 | strcpy (buffer, path->path); |
| 3585 | strcat (buffer, "/"); | 3592 | strcat (buffer, "/"); |
| 3586 | strcat (buffer, file); | 3593 | strcat (buffer, file); |
| 3587 | fp = fopen (buffer, "r"); | 3594 | fp = fopen (buffer, "r"); |
| 3588 | } | 3595 | } |
| 3589 | 3596 | ||
| 3590 | /* Try the original file name. */ | 3597 | /* Try the original file name. */ |
| 3591 | if (fp == NULL) | 3598 | if (fp == NULL) |
| 3592 | fp = fopen (file, "r"); | 3599 | fp = fopen (file, "r"); |
| 3593 | 3600 | ||
| 3594 | if (fp == NULL) | 3601 | if (fp == NULL) |
| 3595 | yyerror ("cannot open", NULL); | 3602 | yyerror ("cannot open", NULL); |
| 3596 | 3603 | ||
| 3597 | return fp; | 3604 | return fp; |
| 3598 | } | 3605 | } |
| 3599 | 3606 | ||
| @@ -3653,10 +3660,10 @@ process_file (file) | |||
| 3653 | char *file; | 3660 | char *file; |
| 3654 | { | 3661 | { |
| 3655 | FILE *fp; | 3662 | FILE *fp; |
| 3656 | 3663 | ||
| 3657 | fp = open_file (file); | 3664 | fp = open_file (file); |
| 3658 | if (fp) | 3665 | if (fp) |
| 3659 | { | 3666 | { |
| 3660 | int nread, nbytes; | 3667 | int nread, nbytes; |
| 3661 | 3668 | ||
| 3662 | /* Give a progress indication if needed. */ | 3669 | /* Give a progress indication if needed. */ |
| @@ -3679,7 +3686,7 @@ process_file (file) | |||
| 3679 | inbuffer_size = nread + READ_CHUNK_SIZE + 1; | 3686 | inbuffer_size = nread + READ_CHUNK_SIZE + 1; |
| 3680 | inbuffer = (char *) xrealloc (inbuffer, inbuffer_size); | 3687 | inbuffer = (char *) xrealloc (inbuffer, inbuffer_size); |
| 3681 | } | 3688 | } |
| 3682 | 3689 | ||
| 3683 | nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); | 3690 | nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); |
| 3684 | if (nbytes <= 0) | 3691 | if (nbytes <= 0) |
| 3685 | break; | 3692 | break; |
| @@ -3722,10 +3729,10 @@ read_line (fp) | |||
| 3722 | 3729 | ||
| 3723 | buffer[i++] = c; | 3730 | buffer[i++] = c; |
| 3724 | } | 3731 | } |
| 3725 | 3732 | ||
| 3726 | if (c == EOF && i == 0) | 3733 | if (c == EOF && i == 0) |
| 3727 | return NULL; | 3734 | return NULL; |
| 3728 | 3735 | ||
| 3729 | if (i == buffer_size) | 3736 | if (i == buffer_size) |
| 3730 | { | 3737 | { |
| 3731 | buffer_size = max (100, buffer_size * 2); | 3738 | buffer_size = max (100, buffer_size * 2); |
| @@ -3765,7 +3772,7 @@ main (argc, argv) | |||
| 3765 | case 'p': | 3772 | case 'p': |
| 3766 | info_position = atoi (optarg); | 3773 | info_position = atoi (optarg); |
| 3767 | break; | 3774 | break; |
| 3768 | 3775 | ||
| 3769 | case 'n': | 3776 | case 'n': |
| 3770 | f_nested_classes = 0; | 3777 | f_nested_classes = 0; |
| 3771 | break; | 3778 | break; |
| @@ -3773,7 +3780,7 @@ main (argc, argv) | |||
| 3773 | case 'x': | 3780 | case 'x': |
| 3774 | f_regexps = 0; | 3781 | f_regexps = 0; |
| 3775 | break; | 3782 | break; |
| 3776 | 3783 | ||
| 3777 | /* Add the name of a file containing more input files. */ | 3784 | /* Add the name of a file containing more input files. */ |
| 3778 | case 'f': | 3785 | case 'f': |
| 3779 | if (n_input_files == input_filenames_size) | 3786 | if (n_input_files == input_filenames_size) |
| @@ -3870,10 +3877,10 @@ main (argc, argv) | |||
| 3870 | yyerror ("error getting size of file `%s'", out_filename); | 3877 | yyerror ("error getting size of file `%s'", out_filename); |
| 3871 | else if (rc == 0) | 3878 | else if (rc == 0) |
| 3872 | yyerror ("file `%s' is empty", out_filename); | 3879 | yyerror ("file `%s' is empty", out_filename); |
| 3873 | 3880 | ||
| 3874 | fclose (fp); | 3881 | fclose (fp); |
| 3875 | } | 3882 | } |
| 3876 | 3883 | ||
| 3877 | yyout = fopen (out_filename, f_append ? "a" : "w"); | 3884 | yyout = fopen (out_filename, f_append ? "a" : "w"); |
| 3878 | if (yyout == NULL) | 3885 | if (yyout == NULL) |
| 3879 | { | 3886 | { |
| @@ -3903,7 +3910,7 @@ main (argc, argv) | |||
| 3903 | for (i = 0; i < n_input_files; ++i) | 3910 | for (i = 0; i < n_input_files; ++i) |
| 3904 | { | 3911 | { |
| 3905 | FILE *fp = fopen (input_filenames[i], "r"); | 3912 | FILE *fp = fopen (input_filenames[i], "r"); |
| 3906 | 3913 | ||
| 3907 | if (fp == NULL) | 3914 | if (fp == NULL) |
| 3908 | yyerror ("cannot open input file `%s'", input_filenames[i]); | 3915 | yyerror ("cannot open input file `%s'", input_filenames[i]); |
| 3909 | else | 3916 | else |