Changeset 1440
- Timestamp:
- 2000-08-23T14:02:41+12:00 (24 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/zparse.tab.c
r1372 r1440 71 71 /* defined in z3950proto.cpp */ 72 72 struct z3950cfg *zserver_list=NULL; 73 74 /* this is set in z3950proto.cpp */ 73 75 FILE *errfile; 74 76 … … 80 82 81 83 82 #line 6 2"zparse.y"84 #line 64 "zparse.y" 83 85 typedef union { 84 86 char *string; … … 138 140 #if YYDEBUG != 0 139 141 static const short yyprhs[] = { 0, 140 0, 3, 5, 6, 9, 11, 20, 22, 24, 25,141 2 8, 29, 32, 35, 36, 39, 42, 43, 45, 46,142 48, 5 1, 55, 58, 62, 64, 66, 69, 70, 73142 0, 3, 5, 7, 8, 11, 13, 22, 24, 26, 143 27, 30, 31, 34, 37, 38, 41, 44, 45, 47, 144 48, 50, 53, 57, 60, 64, 66 143 145 }; 144 146 145 147 static const short yyrhs[] = { 45, 146 46, 0, 3, 0, 0, 46, 47, 0, 47, 0, 147 41, 41, 49, 41, 48, 50, 51, 52, 0, 1, 148 0, 19, 0, 0, 42, 41, 0, 0, 20, 19, 149 0, 20, 41, 0, 0, 21, 19, 0, 21, 41, 150 0, 0, 53, 0, 0, 54, 0, 53, 54, 0, 151 22, 55, 19, 0, 22, 19, 0, 41, 43, 41, 152 0, 41, 0, 1, 0, 37, 19, 0, 0, 38, 153 19, 0, 0 148 46, 0, 45, 0, 3, 0, 0, 46, 47, 0, 149 47, 0, 41, 41, 49, 41, 48, 50, 51, 52, 150 0, 1, 0, 19, 0, 0, 42, 41, 0, 0, 151 20, 19, 0, 20, 41, 0, 0, 21, 19, 0, 152 21, 41, 0, 0, 53, 0, 0, 54, 0, 53, 153 54, 0, 22, 55, 19, 0, 22, 19, 0, 41, 154 43, 41, 0, 41, 0, 1, 0 154 155 }; 155 156 … … 158 159 #if YYDEBUG != 0 159 160 static const short yyrline[] = { 0, 160 10 7, 110, 111, 113, 114, 116, 136, 140, 141, 146,161 14 7, 150, 151, 154, 155, 156, 161, 163, 164, 166,162 16 8, 171, 182, 204, 212, 220, 222, 223, 225, 226161 109, 110, 113, 114, 116, 117, 119, 139, 143, 144, 162 149, 150, 153, 154, 157, 158, 159, 164, 166, 167, 163 169, 171, 174, 185, 207, 215, 223 163 164 }; 164 165 #endif … … 179 180 180 181 static const short yyr1[] = { 0, 181 44, 4 5, 45, 46, 46, 47, 47, 48, 48, 49,182 49, 50, 50, 50, 51, 51, 51, 52, 52, 53,183 53, 5 4, 54, 55, 55, 55, -1, -1, -1, -1182 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 183 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 184 53, 53, 54, 54, 55, 55, 55 184 185 }; 185 186 186 187 static const short yyr2[] = { 0, 187 2, 1, 0, 2, 1, 8, 1, 1, 0, 2,188 0, 2, 2, 0, 2, 2, 0, 1, 0, 1,189 2, 3, 2, 3, 1, 1, 2, 0, 2, 0190 }; 191 192 static const short yydefact[] = { 3,193 2, 0, 7, 0, 0, 5, 11, 4, 0, 0,194 1 0, 9, 8, 14, 0, 17, 12, 13, 0, 19,195 1 5, 16, 0, 6, 18, 20, 26, 23, 25, 0,196 2 1, 0, 22, 24, 0, 0, 0188 2, 1, 1, 0, 2, 1, 8, 1, 1, 0, 189 2, 0, 2, 2, 0, 2, 2, 0, 1, 0, 190 1, 2, 3, 2, 3, 1, 1 191 }; 192 193 static const short yydefact[] = { 4, 194 3, 0, 8, 0, 0, 6, 12, 5, 0, 0, 195 11, 10, 9, 15, 0, 18, 13, 14, 0, 20, 196 16, 17, 0, 7, 19, 21, 27, 24, 26, 0, 197 22, 0, 23, 25, 0, 0, 0 197 198 }; 198 199 … … 202 203 }; 203 204 204 static const short yypact[] = { 3,205 -32768, 2,-32768, -34, 0,-32768, -33,-32768, -31, -30,206 -32768, -1 1,-32768, -8, -15, -7,-32768,-32768, -14, -9,207 -32768,-32768, 1,-32768, -9,-32768,-32768,-32768, -28, -3,208 -32768, -2 4,-32768,-32768, 18, 19,-32768205 static const short yypact[] = { 4, 206 -32768, 0,-32768, -33, 2,-32768, -32,-32768, -30, -29, 207 -32768, -10,-32768, -7, -14, -6,-32768,-32768, -13, -8, 208 -32768,-32768, 3,-32768, -8,-32768,-32768,-32768, -27, -2, 209 -32768, -23,-32768,-32768, 19, 20,-32768 209 210 }; 210 211 211 212 static const short yypgoto[] = {-32768, 212 -32768,-32768, 16,-32768,-32768,-32768,-32768,-32768,-32768, - 2,213 -32768,-32768, 16,-32768,-32768,-32768,-32768,-32768,-32768, -1, 213 214 -32768 214 215 }; 215 216 216 217 217 #define YYLAST 4 3218 219 220 static const short yytable[] = { - 1,221 3, 27, 3, 17, 21, 1, 7, 13, 9, 11,222 1 2, 15, 23, 19, 32, 33, 34, 36, 37, 28,223 8, 0, 31, 0, 0, 18, 22, 0, 0, 0,218 #define YYLAST 44 219 220 221 static const short yytable[] = { -2, 222 3, -1, 3, 27, 17, 21, 1, 7, 13, 9, 223 11, 12, 15, 23, 19, 32, 33, 34, 36, 37, 224 8, 28, 0, 31, 0, 0, 18, 22, 0, 0, 224 225 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225 4, 29, 4226 4, 0, 4, 29 226 227 }; 227 228 228 229 static const short yycheck[] = { 0, 229 1, 1, 1, 19, 19, 3, 41, 19, 42, 41,230 41, 20, 22, 21, 43, 19, 41, 0, 0, 19,231 5, -1, 25, -1, -1, 41, 41, -1, -1, -1,230 1, 0, 1, 1, 19, 19, 3, 41, 19, 42, 231 41, 41, 20, 22, 21, 43, 19, 41, 0, 0, 232 5, 19, -1, 25, -1, -1, 41, 41, -1, -1, 232 233 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 233 41, 41, 41234 41, -1, 41, 41 234 235 }; 235 236 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ … … 779 780 780 781 case 1: 781 #line 10 7"zparse.y"782 #line 109 "zparse.y" 782 783 {zserver_list=yyvsp[0].cfg;; 783 784 break;} 784 785 case 2: 785 786 #line 110 "zparse.y" 787 {zserver_list=NULL;; 788 break;} 789 case 3: 790 #line 113 "zparse.y" 786 791 {;; 787 792 break;} 788 case 3:789 #line 111 "zparse.y"790 {fprintf(stderr,"No version - not GSDL config file?\n");return(1);;791 break;}792 793 case 4: 793 #line 113 "zparse.y" 794 #line 114 "zparse.y" 795 {fprintf(errfile,"No version - not GSDL config file?\n");return(1);; 796 break;} 797 case 5: 798 #line 116 "zparse.y" 794 799 {if (yyvsp[0].cfg!=NULL) {yyvsp[0].cfg->next=yyvsp[-1].cfg;yyval.cfg=yyvsp[0].cfg;}; 795 800 break;} 796 case 6:797 #line 1 17"zparse.y"801 case 7: 802 #line 120 "zparse.y" 798 803 { 799 804 if (YYRECOVERING) … … 802 807 if((yyval.cfg=malloc(sizeof(struct z3950cfg)))==NULL) 803 808 { 804 fprintf( stderr,"malloc failed\n");809 fprintf(errfile,"malloc failed\n"); 805 810 return(1); 806 811 } … … 816 821 ; 817 822 break;} 818 case 7:819 #line 13 6"zparse.y"823 case 8: 824 #line 139 "zparse.y" 820 825 {yyval.cfg=NULL; 821 fprintf( stderr,"discarding zserver (line %d)\n",lineno);;822 break;} 823 case 8:824 #line 14 0"zparse.y"826 fprintf(errfile,"discarding zserver (line %d)\n",lineno);; 827 break;} 828 case 9: 829 #line 143 "zparse.y" 825 830 {;; 826 831 break;} 827 case 9:828 #line 14 1"zparse.y"832 case 10: 833 #line 144 "zparse.y" 829 834 {errormsg("Database name needs to be followed by a short " 830 835 "descriptive name (enclosed in \" marks)"); … … 832 837 YYRECOVERING=1;; 833 838 break;} 834 case 1 0:835 #line 14 6"zparse.y"839 case 11: 840 #line 149 "zparse.y" 836 841 {yyval.number=atoi(yyvsp[0].string);; 837 break;}838 case 11:839 #line 147 "zparse.y"840 {yyval.number=210;;841 842 break;} 842 843 case 12: 843 844 #line 150 "zparse.y" 845 {yyval.number=210;; 846 break;} 847 case 13: 848 #line 153 "zparse.y" 844 849 {yyval.string=yyvsp[0].string;; 845 850 break;} 846 case 1 3:847 #line 15 1"zparse.y"851 case 14: 852 #line 154 "zparse.y" 848 853 {yyval.string=yyvsp[0].string; 849 854 errormsg("Icon must be enclosed in quotes"); 850 855 yylex();yylex();; 851 856 break;} 852 case 1 4:853 #line 15 4"zparse.y"857 case 15: 858 #line 157 "zparse.y" 854 859 {yyval.string=NULL;; 855 860 break;} 856 case 1 5:857 #line 15 5"zparse.y"861 case 16: 862 #line 158 "zparse.y" 858 863 {yyval.string=yyvsp[0].string;; 859 864 break;} 860 case 1 6:861 #line 15 6"zparse.y"865 case 17: 866 #line 159 "zparse.y" 862 867 {yyval.string=yyvsp[0].string; 863 868 /* this is because of the ':' */ … … 866 871 ; 867 872 break;} 868 case 1 7:869 #line 16 1"zparse.y"873 case 18: 874 #line 164 "zparse.y" 870 875 {yyval.string=NULL;; 871 876 break;} 872 case 1 8:873 #line 16 3"zparse.y"877 case 19: 878 #line 166 "zparse.y" 874 879 {defLanguage=0;; 875 880 break;} 876 case 19:877 #line 16 4"zparse.y"881 case 20: 882 #line 167 "zparse.y" 878 883 {yyval.about=NULL;; 879 884 break;} 880 case 2 0:881 #line 16 6"zparse.y"885 case 21: 886 #line 169 "zparse.y" 882 887 {;; 883 888 break;} 884 case 2 1:885 #line 1 68"zparse.y"889 case 22: 890 #line 171 "zparse.y" 886 891 {yyval.about=yyvsp[0].about;yyvsp[0].about->next=yyvsp[-1].about;; 887 892 break;} 888 case 2 2:889 #line 17 2"zparse.y"893 case 23: 894 #line 175 "zparse.y" 890 895 { 891 896 if((yyval.about=malloc(sizeof(struct z3950aboutlist))) 892 897 ==NULL) { 893 fprintf( stderr,"Malloc failed\n");898 fprintf(errfile,"Malloc failed\n"); 894 899 return(1); 895 900 } … … 899 904 ; 900 905 break;} 901 case 2 3:902 #line 18 3"zparse.y"906 case 24: 907 #line 186 "zparse.y" 903 908 { 904 909 if (defLanguage) 905 910 { 906 fprintf( stderr,"warning: (line %d): already have a default language in config file\n",lineno);911 fprintf(errfile,"warning: (line %d): already have a default language in config file\n",lineno); 907 912 } 908 913 else defLanguage=1; … … 910 915 if((yyval.about=malloc(sizeof(struct z3950aboutlist))) 911 916 ==NULL) { 912 fprintf( stderr,"Malloc failed\n");917 fprintf(errfile,"Malloc failed\n"); 913 918 return(1); 914 919 } … … 918 923 ; 919 924 break;} 920 case 2 4:921 #line 20 5"zparse.y"925 case 25: 926 #line 208 "zparse.y" 922 927 { 923 928 yyval.string=malloc(strlen(yyvsp[-2].string)+strlen(yyvsp[0].string)+1); … … 928 933 ; 929 934 break;} 930 case 2 5:931 #line 21 2"zparse.y"935 case 26: 936 #line 215 "zparse.y" 932 937 {;; 933 938 break;} 934 case 2 6:935 #line 22 0"zparse.y"939 case 27: 940 #line 223 "zparse.y" 936 941 {errormsg("missing language");; 937 break;}938 case 27:939 #line 222 "zparse.y"940 {;;941 break;}942 case 28:943 #line 223 "zparse.y"944 {;;945 break;}946 case 29:947 #line 225 "zparse.y"948 {;;949 break;}950 case 30:951 #line 226 "zparse.y"952 {;;953 942 break;} 954 943 } … … 1175 1164 return 1; 1176 1165 } 1177 #line 2 29"zparse.y"1166 #line 232 "zparse.y" 1178 1167 1179 1168 /*int strncasecmp (const char *, const char *,size_t);*/ 1180 1169 int yyerror(char *string) { 1181 fprintf( stderr,"Parse error (line %d) near \n\"%s\"<---:%s\n",lineno,1170 fprintf(errfile,"Parse error (line %d) near \n\"%s\"<---:%s\n",lineno, 1182 1171 yylval.string,string); 1183 1172 return(1); … … 1185 1174 1186 1175 void errormsg(char *str) { 1187 fprintf( stderr,"Err (line %d, near \"%s\"): %s.\n",lineno,1176 fprintf(errfile,"Err (line %d, near \"%s\"): %s.\n",lineno, 1188 1177 yylval.string,str); 1189 1178 } -
trunk/gsdl/src/recpt/zparse.y
r1372 r1440 49 49 /* defined in z3950proto.cpp */ 50 50 struct z3950cfg *zserver_list=NULL; 51 52 /* this is set in z3950proto.cpp */ 51 53 FILE *errfile; 52 54 … … 106 108 /* grammar */ 107 109 z3950 : version zserverlist {zserver_list=$2;} 110 | version {zserver_list=NULL;} /* if all commented out or none... */ 108 111 109 112 110 113 version : GSDLVERSION {;} 111 | {fprintf( stderr,"No version - not GSDL config file?\n");return(1);}114 | {fprintf(errfile,"No version - not GSDL config file?\n");return(1);} 112 115 113 116 zserverlist : zserverlist zserver {if ($2!=NULL) {$2->next=$1;$$=$2;}} … … 121 124 if(($$=malloc(sizeof(struct z3950cfg)))==NULL) 122 125 { 123 fprintf( stderr,"malloc failed\n");126 fprintf(errfile,"malloc failed\n"); 124 127 return(1); 125 128 } … … 135 138 } 136 139 | error {$$=NULL; 137 fprintf( stderr,"discarding zserver (line %d)\n",lineno);}140 fprintf(errfile,"discarding zserver (line %d)\n",lineno);} 138 141 ; 139 142 … … 173 176 if(($$=malloc(sizeof(struct z3950aboutlist))) 174 177 ==NULL) { 175 fprintf( stderr,"Malloc failed\n");178 fprintf(errfile,"Malloc failed\n"); 176 179 return(1); 177 180 } … … 184 187 if (defLanguage) 185 188 { 186 fprintf( stderr,"warning: (line %d): already have a default language in config file\n",lineno);189 fprintf(errfile,"warning: (line %d): already have a default language in config file\n",lineno); 187 190 } 188 191 else defLanguage=1; … … 190 193 if(($$=malloc(sizeof(struct z3950aboutlist))) 191 194 ==NULL) { 192 fprintf( stderr,"Malloc failed\n");195 fprintf(errfile,"Malloc failed\n"); 193 196 return(1); 194 197 } … … 220 223 | error {errormsg("missing language");} 221 224 222 documentHeader : DOCUMENTHEADER STRING {;}225 /*documentHeader : DOCUMENTHEADER STRING {;} 223 226 | {;} 224 227 225 228 documentText : DOCUMENTTEXT STRING {;} 226 229 | {;} 227 230 */ 228 231 229 232 %% 230 233 /*int strncasecmp (const char *, const char *,size_t);*/ 231 234 int yyerror(char *string) { 232 fprintf( stderr,"Parse error (line %d) near \n\"%s\"<---:%s\n",lineno,235 fprintf(errfile,"Parse error (line %d) near \n\"%s\"<---:%s\n",lineno, 233 236 yylval.string,string); 234 237 return(1); … … 236 239 237 240 void errormsg(char *str) { 238 fprintf( stderr,"Err (line %d, near \"%s\"): %s.\n",lineno,241 fprintf(errfile,"Err (line %d, near \"%s\"): %s.\n",lineno, 239 242 yylval.string,str); 240 243 }
Note:
See TracChangeset
for help on using the changeset viewer.