2 /* A Bison parser, made from error_table.y with Bison version GNU Bison version 1.24
5 #define YYBISON 1 /* Identify Bison output. */
7 #define ERROR_TABLE 258
8 #define ERROR_CODE_ENTRY 259
11 #define QUOTED_STRING 262
13 #line 1 "error_table.y"
15 #include <afsconfig.h>
16 #include <afs/param.h>
22 * If __STDC__ is defined, function prototypes in the SunOS 5.5.1 lex
23 * and yacc templates are visible. We turn this on explicitly on
24 * NT because the prototypes help supress certain warning from the
25 * Microsoft C compiler.
37 char *current_token = (char *)NULL;
38 extern char *table_name;
40 char *ds(const char *string);
41 char *quote(const char *string);
42 void set_table_1num(char *string);
43 int char_to_1num(char c);
44 void add_ec(const char *name, const char *description);
45 void add_ec_val(const char *name, const char *val, const char *description);
47 void set_table_num(char *string);
48 void set_table_fun(char *astring);
51 #line 38 "error_table.y"
55 #line 45 "error_table.y"
69 #define YYLTYPE yyltype
84 #define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 18)
86 static const char yytranslate[] = { 0,
87 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
88 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
89 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
90 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
91 2, 2, 2, 8, 2, 2, 2, 2, 2, 2,
92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 9, 2, 2, 2, 2, 2, 2, 2, 2, 2,
94 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
95 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
96 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
97 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
98 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
103 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
104 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
111 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
112 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
117 static const short yyprhs[] = { 0,
118 0, 5, 8, 10, 12, 14, 17, 19, 24, 31,
122 static const short yyrhs[] = { 3,
123 11, 14, 5, 0, 12, 13, 0, 13, 0, 6,
124 0, 6, 0, 14, 15, 0, 15, 0, 4, 16,
125 8, 17, 0, 4, 16, 9, 6, 8, 17, 0,
132 static const short yyrline[] = { 0,
133 50, 56, 59, 66, 73, 79, 80, 83, 87, 95,
137 static const char *const yytname[] =
138 { "$", "error", "$undefined.", "ERROR_TABLE",
139 "ERROR_CODE_ENTRY", "END", "STRING", "QUOTED_STRING", "','", "'='",
141 "header", "table_fun", "table_id", "error_codes", "ec_entry", "ec_name",
147 static const short yyr1[] = { 0,
148 10, 11, 11, 12, 13, 14, 14, 15, 15, 16,
152 static const short yyr2[] = { 0,
153 4, 2, 1, 1, 1, 2, 1, 4, 6, 1,
157 static const short yydefact[] = { 0,
158 0, 4, 0, 0, 3, 0, 0, 7, 5, 2,
159 10, 0, 1, 6, 0, 0, 11, 8, 0, 0,
163 static const short yydefgoto[] = { 22,
164 3, 4, 5, 7, 8, 12, 18
167 static const short yypact[] = { 1,
168 -1, 2, 3, 4, -32768, 5, -4, -32768, -32768, -32768,
169 -32768, -6, -32768, -32768, 6, 8, -32768, -32768, 0, 6,
170 -32768, 9, 12, -32768
173 static const short yypgoto[] = { -32768,
174 -32768, -32768, 11, -32768, 10, -32768, -2
181 static const short yytable[] = { 6,
182 13, 15, 16, 1, 2, -5, 6, 20, 23, 9,
183 11, 24, 17, 19, 10, 0, 14, 21
186 static const short yycheck[] = { 4,
187 5, 8, 9, 3, 6, 4, 4, 8, 0, 6,
188 6, 0, 7, 6, 4, -1, 7, 20
191 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
192 #line 3 "bison.simple"
194 /* Skeleton output parser for bison,
195 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
197 This program is free software; you can redistribute it and/or modify
198 it under the terms of the GNU General Public License as published by
199 the Free Software Foundation; either version 2, or (at your option)
202 This program is distributed in the hope that it will be useful,
203 but WITHOUT ANY WARRANTY; without even the implied warranty of
204 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
205 GNU General Public License for more details.
207 You should have received a copy of the GNU General Public License
208 along with this program; if not, write to the Free Software
209 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
211 /* As a special exception, when this file is copied by Bison into a
212 Bison output file, you may use that output file without restriction.
213 This special exception was added by the Free Software Foundation
214 in version 1.24 of Bison. */
218 #define alloca __builtin_alloca
219 #else /* not GNU C. */
220 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
222 #else /* not sparc */
223 #if defined (MSDOS) && !defined (__TURBOC__)
225 #else /* not MSDOS, or __TURBOC__ */
229 #else /* not MSDOS, __TURBOC__, or _AIX */
233 void *alloca(unsigned int);
235 #else /* not __cplusplus */
237 #endif /* not __cplusplus */
239 #endif /* not _AIX */
240 #endif /* not MSDOS, or __TURBOC__ */
241 #endif /* not sparc. */
242 #endif /* not GNU C. */
243 #endif /* alloca not defined. */
245 /* This is the parser code that is written into each bison parser
246 when the %semantic_parser declaration is not specified in the grammar.
247 It was written by Richard Stallman by simplifying the hairy parser
248 used when %semantic_parser is specified. */
250 /* Note: there must be only one dollar sign in this file.
251 It is replaced by the list of actions, each action
252 as one case of the switch. */
254 #define yyerrok (yyerrstatus = 0)
255 #define yyclearin (yychar = YYEMPTY)
258 #define YYACCEPT return(0)
259 #define YYABORT return(1)
260 #define YYERROR goto yyerrlab1
261 /* Like YYERROR except do call yyerror.
262 This remains here temporarily to ease the
263 transition to the new meaning of YYERROR, for GCC.
264 Once GCC version 2 has supplanted version 1, this can go. */
265 #define YYFAIL goto yyerrlab
266 #define YYRECOVERING() (!!yyerrstatus)
267 #define YYBACKUP(token, value) \
269 if (yychar == YYEMPTY && yylen == 1) \
270 { yychar = (token), yylval = (value); \
271 yychar1 = YYTRANSLATE (yychar); \
276 { yyerror ("syntax error: cannot back up"); YYERROR; } \
280 #define YYERRCODE 256
283 #define YYLEX yylex()
289 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
291 #define YYLEX yylex(&yylval, &yylloc)
293 #else /* not YYLSP_NEEDED */
295 #define YYLEX yylex(&yylval, YYLEX_PARAM)
297 #define YYLEX yylex(&yylval)
299 #endif /* not YYLSP_NEEDED */
302 /* If nonreentrant, generate the variables here */
306 int yychar; /* the lookahead symbol */
307 YYSTYPE yylval; /* the semantic value of the */
308 /* lookahead symbol */
311 YYLTYPE yylloc; /* location data for the lookahead */
315 int yynerrs; /* number of parse errors so far */
316 #endif /* not YYPURE */
319 int yydebug; /* nonzero means print parse trace */
320 /* Since this is uninitialized, it does not stop multiple parsers
324 /* YYINITDEPTH indicates the initial size of the parser's stacks */
327 #define YYINITDEPTH 200
330 /* YYMAXDEPTH is the maximum size the stacks can grow to
331 (effective only if the built-in stack extension method is used). */
338 #define YYMAXDEPTH 10000
341 /* Prevent warning if -Wstrict-prototypes. */
346 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
347 #define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
348 #else /* not GNU C or C++ */
351 /* This is the most reliable way to avoid incompatibilities
352 in available built-in functions on various systems. */
354 __yy_memcpy(from, to, count)
367 #else /* __cplusplus */
369 /* This is the most reliable way to avoid incompatibilities
370 in available built-in functions on various systems. */
372 __yy_memcpy(char *from, char *to, int count)
385 #line 192 "bison.simple"
387 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
388 into yyparse. The argument should have type void *.
389 It should actually point to an object.
390 Grammar actions can access the variable by casting it
391 to the proper pointer type. */
394 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
396 #define YYPARSE_PARAM
397 #define YYPARSE_PARAM_DECL
401 yyparse(YYPARSE_PARAM)
408 int yyerrstatus; /* number of tokens to shift before error messages enabled */
409 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
411 short yyssa[YYINITDEPTH]; /* the state stack */
412 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
414 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
415 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
418 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
419 YYLTYPE *yyls = yylsa;
422 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
424 #define YYPOPSTACK (yyvsp--, yyssp--)
427 int yystacksize = YYINITDEPTH;
438 YYSTYPE yyval; /* the variable used to return */
439 /* semantic values from the action */
446 fprintf(stderr, "Starting parse\n");
452 yychar = YYEMPTY; /* Cause a token to be read. */
454 /* Initialize stack pointers.
455 * Waste one element of value and location stack
456 * so that they stay on the same level as the state stack.
457 * The wasted elements are never initialized. */
465 /* Push a new state, which is found in yystate . */
466 /* In all cases, when you get here, the value and location stacks
467 have just been pushed. so pushing a state here evens the stacks. */
472 if (yyssp >= yyss + yystacksize - 1) {
473 /* Give user a chance to reallocate the stack */
474 /* Use copies of these so that the &'s don't force the real ones into memory. */
475 YYSTYPE *yyvs1 = yyvs;
478 YYLTYPE *yyls1 = yyls;
481 /* Get the current used size of the three stacks, in elements. */
482 int size = yyssp - yyss + 1;
485 /* Each stack pointer address is followed by the size of
486 * the data in use in that stack, in bytes. */
488 /* This used to be a conditional around just the two extra args,
489 * but that might be undefined if yyoverflow is a macro. */
490 yyoverflow("parser stack overflow", &yyss1, size * sizeof(*yyssp),
491 &yyvs1, size * sizeof(*yyvsp), &yyls1,
492 size * sizeof(*yylsp), &yystacksize);
494 yyoverflow("parser stack overflow", &yyss1, size * sizeof(*yyssp),
495 &yyvs1, size * sizeof(*yyvsp), &yystacksize);
503 #else /* no yyoverflow */
504 /* Extend the stack our own way. */
505 if (yystacksize >= YYMAXDEPTH) {
506 yyerror("parser stack overflow");
510 if (yystacksize > YYMAXDEPTH)
511 yystacksize = YYMAXDEPTH;
512 yyss = (short *)alloca(yystacksize * sizeof(*yyssp));
513 __yy_memcpy((char *)yyss1, (char *)yyss, size * sizeof(*yyssp));
514 yyvs = (YYSTYPE *) alloca(yystacksize * sizeof(*yyvsp));
515 __yy_memcpy((char *)yyvs1, (char *)yyvs, size * sizeof(*yyvsp));
517 yyls = (YYLTYPE *) alloca(yystacksize * sizeof(*yylsp));
518 __yy_memcpy((char *)yyls1, (char *)yyls, size * sizeof(*yylsp));
520 #endif /* no yyoverflow */
522 yyssp = yyss + size - 1;
523 yyvsp = yyvs + size - 1;
525 yylsp = yyls + size - 1;
530 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
533 if (yyssp >= yyss + yystacksize - 1)
538 fprintf(stderr, "Entering state %d\n", yystate);
544 /* Do appropriate processing given the current state. */
545 /* Read a lookahead token if we need one and don't already have one. */
548 /* First try to decide what to do without reference to lookahead token. */
550 yyn = yypact[yystate];
554 /* Not known => get a lookahead token if don't already have one. */
556 /* yychar is either YYEMPTY or YYEOF
557 * or a valid token in external form. */
559 if (yychar == YYEMPTY) {
562 fprintf(stderr, "Reading a token: ");
567 /* Convert token to internal form (in yychar1) for indexing tables with */
569 if (yychar <= 0) { /* This means end of input. */
571 yychar = YYEOF; /* Don't call YYLEX any more */
575 fprintf(stderr, "Now at end of input.\n");
578 yychar1 = YYTRANSLATE(yychar);
582 fprintf(stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
583 /* Give the individual parser a way to print the precise meaning
584 * of a token, for further debugging info. */
586 YYPRINT(stderr, yychar, yylval);
588 fprintf(stderr, ")\n");
594 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
599 /* yyn is what to do for this token type in this state.
600 * Negative => reduce, -yyn is rule number.
601 * Positive => shift, yyn is new state.
602 * New state is final state => don't bother to shift,
603 * just return success.
604 * 0, or most negative number => error. */
617 /* Shift the lookahead token. */
621 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
624 /* Discard the token being shifted unless it is eof. */
633 /* count tokens shifted since error; after three, turn off error status. */
640 /* Do the default action for the current state. */
643 yyn = yydefact[yystate];
647 /* Do a reduction. yyn is the number of a rule to reduce with. */
651 yyval = yyvsp[1 - yylen]; /* implement default value of the action */
657 fprintf(stderr, "Reducing via rule %d (line %d), ", yyn,
660 /* Print the symbols being reduced, and their result. */
661 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
662 fprintf(stderr, "%s ", yytname[yyrhs[i]]);
663 fprintf(stderr, " -> %s\n", yytname[yyr1[yyn]]);
671 #line 51 "error_table.y"
673 table_name = ds(yyvsp[-2].dynstr);
674 current_token = table_name;
679 #line 57 "error_table.y"
681 current_token = yyvsp[-1].dynstr;
682 yyval.dynstr = yyvsp[0].dynstr;;
686 #line 60 "error_table.y"
688 current_token = yyvsp[0].dynstr;
689 set_table_fun(ds("1"));
690 yyval.dynstr = yyvsp[0].dynstr;
695 #line 67 "error_table.y"
697 current_token = yyvsp[0].dynstr;
698 set_table_fun(yyvsp[0].dynstr);
699 yyval.dynstr = yyvsp[0].dynstr;;
703 #line 74 "error_table.y"
705 current_token = yyvsp[0].dynstr;
706 set_table_num(yyvsp[0].dynstr);
707 yyval.dynstr = yyvsp[0].dynstr;;
711 #line 84 "error_table.y"
713 add_ec(yyvsp[-2].dynstr, yyvsp[0].dynstr);
714 free(yyvsp[-2].dynstr);
715 free(yyvsp[0].dynstr);;
719 #line 88 "error_table.y"
721 add_ec_val(yyvsp[-4].dynstr, yyvsp[-2].dynstr, yyvsp[0].dynstr);
722 free(yyvsp[-4].dynstr);
723 free(yyvsp[-2].dynstr);
724 free(yyvsp[0].dynstr);
729 #line 96 "error_table.y"
731 yyval.dynstr = ds(yyvsp[0].dynstr);
732 current_token = yyval.dynstr;;
736 #line 101 "error_table.y"
738 yyval.dynstr = ds(yyvsp[0].dynstr);
739 current_token = yyval.dynstr;;
743 /* the action file gets copied in in place of this dollarsign */
744 #line 487 "bison.simple"
754 short *ssp1 = yyss - 1;
755 fprintf(stderr, "state stack now");
756 while (ssp1 != yyssp)
757 fprintf(stderr, " %d", *++ssp1);
758 fprintf(stderr, "\n");
767 yylsp->first_line = yylloc.first_line;
768 yylsp->first_column = yylloc.first_column;
769 yylsp->last_line = (yylsp - 1)->last_line;
770 yylsp->last_column = (yylsp - 1)->last_column;
773 yylsp->last_line = (yylsp + yylen - 1)->last_line;
774 yylsp->last_column = (yylsp + yylen - 1)->last_column;
778 /* Now "shift" the result of the reduction.
779 * Determine what state that goes to,
780 * based on the state we popped back to
781 * and the rule number reduced by. */
785 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
786 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
787 yystate = yytable[yystate];
789 yystate = yydefgoto[yyn - YYNTBASE];
793 yyerrlab: /* here on detecting error */
796 /* If not already recovering from an error, report this error. */
800 #ifdef YYERROR_VERBOSE
801 yyn = yypact[yystate];
803 if (yyn > YYFLAG && yyn < YYLAST) {
809 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
810 for (x = (yyn < 0 ? -yyn : 0);
811 x < (sizeof(yytname) / sizeof(char *)); x++)
812 if (yycheck[x + yyn] == x)
813 size += strlen(yytname[x]) + 15, count++;
814 msg = (char *)malloc(size + 15);
816 strcpy(msg, "parse error");
820 for (x = (yyn < 0 ? -yyn : 0);
821 x < (sizeof(yytname) / sizeof(char *)); x++)
822 if (yycheck[x + yyn] == x) {
824 count == 0 ? ", expecting `" : " or `");
825 strcat(msg, yytname[x]);
833 yyerror("parse error; also virtual memory exceeded");
835 #endif /* YYERROR_VERBOSE */
836 yyerror("parse error");
840 yyerrlab1: /* here on error raised explicitly by an action */
842 if (yyerrstatus == 3) {
843 /* if just tried and failed to reuse lookahead token after an error, discard it. */
845 /* return failure if at end of input */
851 fprintf(stderr, "Discarding token %d (%s).\n", yychar,
858 /* Else will try to reuse lookahead token
859 * after shifting the error token. */
861 yyerrstatus = 3; /* Each real token shifted decrements this */
865 yyerrdefault: /* current state does not do anything special for the error token. */
868 /* This is wrong; only states that explicitly want error tokens
869 * should shift them. */
870 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it. */
875 yyerrpop: /* pop the current state because it cannot handle the error token */
887 short *ssp1 = yyss - 1;
888 fprintf(stderr, "Error: state stack now");
889 while (ssp1 != yyssp)
890 fprintf(stderr, " %d", *++ssp1);
891 fprintf(stderr, "\n");
897 yyn = yypact[yystate];
902 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
919 fprintf(stderr, "Shifting error token, ");
931 #line 105 "error_table.y"
935 * Copyright 1986, 1987 by the MIT Student Information Processing Board
937 * For copyright info, see mit-sipb-cr.h.
939 #include <afs/param.h>
943 #include <afs/afsutil.h>
945 #include <sys/timeb.h>
946 #include "error_table.h"
947 #include "mit-sipb-cr.h"
950 * Copyright 2000, International Business Machines Corporation and others.
951 * All Rights Reserved.
953 * This software has been released under the terms of the IBM Public
954 * License. For details, see the LICENSE file in the top-level source
955 * directory or online at http://www.openafs.org/dl/license10.html
958 extern FILE *hfile, *cfile, *msfile;
961 static afs_int32 gensym_n = 0;
964 gensym(const char *x)
969 gettimeofday(&tv, NULL);
970 gensym_n = (tv.tv_sec % 10000) * 100 + tv.tv_usec / 10000;
972 symbol = (char *)malloc(32 * sizeof(char));
974 sprintf(symbol, "et%ld", gensym_n);
979 ds(const char *string)
982 rv = (char *)malloc(strlen(string) + 1);
988 quote(const char *string)
991 rv = (char *)malloc(strlen(string) + 3);
998 afs_int32 table_number = 0;
1000 char **error_codes = (char **)NULL;
1003 add_ec(const char *name, const char *description)
1008 fprintf(msfile, "%d\t%s\n", current, description);
1010 fprintf(msfile, "%d %s\n", current, description);
1013 fprintf(cfile, "\t\"%s\",\n", description);
1015 if (error_codes == (char **)NULL) {
1016 error_codes = (char **)malloc(sizeof(char *));
1017 *error_codes = (char *)NULL;
1020 (char **)realloc((char *)error_codes, (current + 2) * sizeof(char *));
1021 error_codes[current++] = ds(name);
1022 error_codes[current] = (char *)NULL;
1026 add_ec_val(const char *name, const char *val, const char *description)
1028 const int ncurrent = atoi(val);
1029 if (ncurrent < current) {
1030 printf("Error code %s (%d) out of order", name, current);
1034 while (ncurrent > current) {
1036 fputs("\t(char *)NULL,\n", cfile);
1042 fprintf(msfile, "%d\t%s\n", current, description);
1044 fprintf(msfile, "%d %s\n", current, description);
1047 fprintf(cfile, "\t\"%s\",\n", description);
1049 if (error_codes == (char **)NULL) {
1050 error_codes = (char **)malloc(sizeof(char *));
1051 *error_codes = (char *)NULL;
1054 (char **)realloc((char *)error_codes, (current + 2) * sizeof(char *));
1055 error_codes[current++] = ds(name);
1056 error_codes[current] = (char *)NULL;
1063 for (i = 0; i < current; i++) {
1064 if (error_codes[i] != (char *)NULL)
1065 fprintf(hfile, "#define %-40s (%ldL)\n", error_codes[i],
1071 * char_to_num -- maps letters and numbers into a small numbering space
1073 * lowercase -> 27-52
1078 static const char char_set[] =
1079 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
1087 where = strchr(char_set, c);
1089 diff = where - char_set + 1;
1090 assert(diff < (1 << ERRCODE_RANGE));
1092 } else if (isprint(c))
1093 fprintf(stderr, "Illegal character `%c' in error table name\n", c);
1095 fprintf(stderr, "Illegal character %03o in error table name\n", c);
1100 set_table_num(char *string)
1103 set_table_1num(string);
1106 if (strlen(string) > 4) {
1107 fprintf(stderr, "Table name %s too long, truncated ", string);
1109 fprintf(stderr, "to %s\n", string);
1111 if (char_to_num(string[0]) > char_to_num('z')) {
1112 fprintf(stderr, "%s%s%s%s",
1113 "First character of error table name must be ",
1114 "a letter; name ``", string, "'' rejected\n");
1117 while (*string != '\0') {
1118 table_number = (table_number << BITS_PER_CHAR)
1119 + char_to_num(*string);
1122 table_number = table_number << ERRCODE_RANGE;
1126 set_table_fun(char *astring)
1131 for (tp = astring; (tc = *tp) != 0; tp++) {
1134 "Table function '%s' must be a decimal integer.\n",
1140 table_number += (atoi(astring)) << 28;
1143 /* for compatibility with old comerr's, we truncate package name to 4
1144 * characters, but only store first 3 in the error code. Note that this
1145 * function, as a side effect, truncates the table name down to 4 chars.
1148 set_table_1num(char *string)
1153 if ((temp = strlen(string)) > 4) {
1154 fprintf(stderr, "Table name %s too long, truncated ", string);
1156 fprintf(stderr, "to %s\n", string);
1160 "Table name %s too long, only 3 characters fit in error code.\n",
1163 if (char_to_1num(string[0]) > char_to_1num('z')) {
1164 fprintf(stderr, "%s%s%s%s",
1165 "First character of error table name must be ",
1166 "a letter; name ``", string, "'' rejected\n");
1170 for (ctr = 0; ctr < 3; ctr++) { /* copy at most 3 chars to integer */
1171 if (*string == '\0')
1172 break; /* and watch for early end */
1173 temp = (temp * 050) /* "radix fifty" is base 050 = 40 */
1174 +char_to_1num(*string);
1177 table_number += temp << 12;
1181 * char_to_num -- maps letters and numbers into very small space
1183 * mixed case -> 10-35
1185 * others are reserved
1188 static const char char_1set[] = "abcdefghijklmnopqrstuvwxyz_0123456789";
1191 char_to_1num(char c)
1199 where = strchr(char_1set, c);
1201 /* start at 1 so we can decode */
1202 diff = where - char_1set;
1203 assert(diff < 050); /* it is radix 50, after all */
1205 } else if (isprint(c))
1206 fprintf(stderr, "Illegal character `%c' in error table name\n", c);
1208 fprintf(stderr, "Illegal character %03o in error table name\n", c);
1213 #include "et_lex.lex_nt.c"
1215 #include "et_lex.lex.c"