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>
21 * If __STDC__ is defined, function prototypes in the SunOS 5.5.1 lex
22 * and yacc templates are visible. We turn this on explicitly on
23 * NT because the prototypes help supress certain warning from the
24 * Microsoft C compiler.
40 char *current_token = (char *)NULL;
41 extern char *table_name;
43 char *ds(const char *string);
44 char *quote(const char *string);
45 void set_table_1num(char *string);
46 int char_to_1num(char c);
47 void add_ec(const char *name, const char *description);
48 void add_ec_val(const char *name, const char *val, const char *description);
50 void set_table_num(char *string);
51 void set_table_fun(char *astring);
54 #line 38 "error_table.y"
58 #line 45 "error_table.y"
72 #define YYLTYPE yyltype
89 #define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 18)
91 static const char yytranslate[] = { 0,
92 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
93 2, 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, 8, 2, 2, 2, 2, 2, 2,
97 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
98 9, 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, 2, 2, 2, 2, 2,
113 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
114 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
115 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
117 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
122 static const short yyprhs[] = { 0,
123 0, 5, 8, 10, 12, 14, 17, 19, 24, 31,
127 static const short yyrhs[] = { 3,
128 11, 14, 5, 0, 12, 13, 0, 13, 0, 6,
129 0, 6, 0, 14, 15, 0, 15, 0, 4, 16,
130 8, 17, 0, 4, 16, 9, 6, 8, 17, 0,
137 static const short yyrline[] = { 0,
138 50, 56, 59, 66, 73, 79, 80, 83, 87, 95,
142 static const char *const yytname[] =
143 { "$", "error", "$undefined.", "ERROR_TABLE",
144 "ERROR_CODE_ENTRY", "END", "STRING", "QUOTED_STRING", "','", "'='",
146 "header", "table_fun", "table_id", "error_codes", "ec_entry", "ec_name",
152 static const short yyr1[] = { 0,
153 10, 11, 11, 12, 13, 14, 14, 15, 15, 16,
157 static const short yyr2[] = { 0,
158 4, 2, 1, 1, 1, 2, 1, 4, 6, 1,
162 static const short yydefact[] = { 0,
163 0, 4, 0, 0, 3, 0, 0, 7, 5, 2,
164 10, 0, 1, 6, 0, 0, 11, 8, 0, 0,
168 static const short yydefgoto[] = { 22,
169 3, 4, 5, 7, 8, 12, 18
172 static const short yypact[] = { 1,
173 -1, 2, 3, 4, -32768, 5, -4, -32768, -32768, -32768,
174 -32768, -6, -32768, -32768, 6, 8, -32768, -32768, 0, 6,
175 -32768, 9, 12, -32768
178 static const short yypgoto[] = { -32768,
179 -32768, -32768, 11, -32768, 10, -32768, -2
186 static const short yytable[] = { 6,
187 13, 15, 16, 1, 2, -5, 6, 20, 23, 9,
188 11, 24, 17, 19, 10, 0, 14, 21
191 static const short yycheck[] = { 4,
192 5, 8, 9, 3, 6, 4, 4, 8, 0, 6,
193 6, 0, 7, 6, 4, -1, 7, 20
196 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
197 #line 3 "bison.simple"
199 /* Skeleton output parser for bison,
200 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
202 This program is free software; you can redistribute it and/or modify
203 it under the terms of the GNU General Public License as published by
204 the Free Software Foundation; either version 2, or (at your option)
207 This program is distributed in the hope that it will be useful,
208 but WITHOUT ANY WARRANTY; without even the implied warranty of
209 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
210 GNU General Public License for more details.
212 You should have received a copy of the GNU General Public License
213 along with this program; if not, write to the Free Software
214 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
216 /* As a special exception, when this file is copied by Bison into a
217 Bison output file, you may use that output file without restriction.
218 This special exception was added by the Free Software Foundation
219 in version 1.24 of Bison. */
223 #define alloca __builtin_alloca
224 #else /* not GNU C. */
225 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
227 #else /* not sparc */
228 #if defined (MSDOS) && !defined (__TURBOC__)
230 #else /* not MSDOS, or __TURBOC__ */
234 #else /* not MSDOS, __TURBOC__, or _AIX */
238 void *alloca(unsigned int);
240 #else /* not __cplusplus */
242 #endif /* not __cplusplus */
244 #endif /* not _AIX */
245 #endif /* not MSDOS, or __TURBOC__ */
246 #endif /* not sparc. */
247 #endif /* not GNU C. */
248 #endif /* alloca not defined. */
250 /* This is the parser code that is written into each bison parser
251 when the %semantic_parser declaration is not specified in the grammar.
252 It was written by Richard Stallman by simplifying the hairy parser
253 used when %semantic_parser is specified. */
255 /* Note: there must be only one dollar sign in this file.
256 It is replaced by the list of actions, each action
257 as one case of the switch. */
259 #define yyerrok (yyerrstatus = 0)
260 #define yyclearin (yychar = YYEMPTY)
263 #define YYACCEPT return(0)
264 #define YYABORT return(1)
265 #define YYERROR goto yyerrlab1
266 /* Like YYERROR except do call yyerror.
267 This remains here temporarily to ease the
268 transition to the new meaning of YYERROR, for GCC.
269 Once GCC version 2 has supplanted version 1, this can go. */
270 #define YYFAIL goto yyerrlab
271 #define YYRECOVERING() (!!yyerrstatus)
272 #define YYBACKUP(token, value) \
274 if (yychar == YYEMPTY && yylen == 1) \
275 { yychar = (token), yylval = (value); \
276 yychar1 = YYTRANSLATE (yychar); \
281 { yyerror ("syntax error: cannot back up"); YYERROR; } \
285 #define YYERRCODE 256
288 #define YYLEX yylex()
294 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
296 #define YYLEX yylex(&yylval, &yylloc)
298 #else /* not YYLSP_NEEDED */
300 #define YYLEX yylex(&yylval, YYLEX_PARAM)
302 #define YYLEX yylex(&yylval)
304 #endif /* not YYLSP_NEEDED */
307 /* If nonreentrant, generate the variables here */
311 int yychar; /* the lookahead symbol */
312 YYSTYPE yylval; /* the semantic value of the */
313 /* lookahead symbol */
316 YYLTYPE yylloc; /* location data for the lookahead */
320 int yynerrs; /* number of parse errors so far */
321 #endif /* not YYPURE */
324 int yydebug; /* nonzero means print parse trace */
325 /* Since this is uninitialized, it does not stop multiple parsers
329 /* YYINITDEPTH indicates the initial size of the parser's stacks */
332 #define YYINITDEPTH 200
335 /* YYMAXDEPTH is the maximum size the stacks can grow to
336 (effective only if the built-in stack extension method is used). */
343 #define YYMAXDEPTH 10000
346 /* Prevent warning if -Wstrict-prototypes. */
351 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
352 #define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
353 #else /* not GNU C or C++ */
356 /* This is the most reliable way to avoid incompatibilities
357 in available built-in functions on various systems. */
359 __yy_memcpy(from, to, count)
372 #else /* __cplusplus */
374 /* This is the most reliable way to avoid incompatibilities
375 in available built-in functions on various systems. */
377 __yy_memcpy(char *from, char *to, int count)
390 #line 192 "bison.simple"
392 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
393 into yyparse. The argument should have type void *.
394 It should actually point to an object.
395 Grammar actions can access the variable by casting it
396 to the proper pointer type. */
399 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
401 #define YYPARSE_PARAM
402 #define YYPARSE_PARAM_DECL
406 yyparse(YYPARSE_PARAM)
413 int yyerrstatus; /* number of tokens to shift before error messages enabled */
414 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
416 short yyssa[YYINITDEPTH]; /* the state stack */
417 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
419 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
420 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
423 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
424 YYLTYPE *yyls = yylsa;
427 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
429 #define YYPOPSTACK (yyvsp--, yyssp--)
432 int yystacksize = YYINITDEPTH;
443 YYSTYPE yyval; /* the variable used to return */
444 /* semantic values from the action */
451 fprintf(stderr, "Starting parse\n");
457 yychar = YYEMPTY; /* Cause a token to be read. */
459 /* Initialize stack pointers.
460 * Waste one element of value and location stack
461 * so that they stay on the same level as the state stack.
462 * The wasted elements are never initialized. */
470 /* Push a new state, which is found in yystate . */
471 /* In all cases, when you get here, the value and location stacks
472 have just been pushed. so pushing a state here evens the stacks. */
477 if (yyssp >= yyss + yystacksize - 1) {
478 /* Give user a chance to reallocate the stack */
479 /* Use copies of these so that the &'s don't force the real ones into memory. */
480 YYSTYPE *yyvs1 = yyvs;
483 YYLTYPE *yyls1 = yyls;
486 /* Get the current used size of the three stacks, in elements. */
487 int size = yyssp - yyss + 1;
490 /* Each stack pointer address is followed by the size of
491 * the data in use in that stack, in bytes. */
493 /* This used to be a conditional around just the two extra args,
494 * but that might be undefined if yyoverflow is a macro. */
495 yyoverflow("parser stack overflow", &yyss1, size * sizeof(*yyssp),
496 &yyvs1, size * sizeof(*yyvsp), &yyls1,
497 size * sizeof(*yylsp), &yystacksize);
499 yyoverflow("parser stack overflow", &yyss1, size * sizeof(*yyssp),
500 &yyvs1, size * sizeof(*yyvsp), &yystacksize);
508 #else /* no yyoverflow */
509 /* Extend the stack our own way. */
510 if (yystacksize >= YYMAXDEPTH) {
511 yyerror("parser stack overflow");
515 if (yystacksize > YYMAXDEPTH)
516 yystacksize = YYMAXDEPTH;
517 yyss = (short *)alloca(yystacksize * sizeof(*yyssp));
518 __yy_memcpy((char *)yyss1, (char *)yyss, size * sizeof(*yyssp));
519 yyvs = (YYSTYPE *) alloca(yystacksize * sizeof(*yyvsp));
520 __yy_memcpy((char *)yyvs1, (char *)yyvs, size * sizeof(*yyvsp));
522 yyls = (YYLTYPE *) alloca(yystacksize * sizeof(*yylsp));
523 __yy_memcpy((char *)yyls1, (char *)yyls, size * sizeof(*yylsp));
525 #endif /* no yyoverflow */
527 yyssp = yyss + size - 1;
528 yyvsp = yyvs + size - 1;
530 yylsp = yyls + size - 1;
535 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
538 if (yyssp >= yyss + yystacksize - 1)
543 fprintf(stderr, "Entering state %d\n", yystate);
549 /* Do appropriate processing given the current state. */
550 /* Read a lookahead token if we need one and don't already have one. */
553 /* First try to decide what to do without reference to lookahead token. */
555 yyn = yypact[yystate];
559 /* Not known => get a lookahead token if don't already have one. */
561 /* yychar is either YYEMPTY or YYEOF
562 * or a valid token in external form. */
564 if (yychar == YYEMPTY) {
567 fprintf(stderr, "Reading a token: ");
572 /* Convert token to internal form (in yychar1) for indexing tables with */
574 if (yychar <= 0) { /* This means end of input. */
576 yychar = YYEOF; /* Don't call YYLEX any more */
580 fprintf(stderr, "Now at end of input.\n");
583 yychar1 = YYTRANSLATE(yychar);
587 fprintf(stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
588 /* Give the individual parser a way to print the precise meaning
589 * of a token, for further debugging info. */
591 YYPRINT(stderr, yychar, yylval);
593 fprintf(stderr, ")\n");
599 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
604 /* yyn is what to do for this token type in this state.
605 * Negative => reduce, -yyn is rule number.
606 * Positive => shift, yyn is new state.
607 * New state is final state => don't bother to shift,
608 * just return success.
609 * 0, or most negative number => error. */
622 /* Shift the lookahead token. */
626 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
629 /* Discard the token being shifted unless it is eof. */
638 /* count tokens shifted since error; after three, turn off error status. */
645 /* Do the default action for the current state. */
648 yyn = yydefact[yystate];
652 /* Do a reduction. yyn is the number of a rule to reduce with. */
656 yyval = yyvsp[1 - yylen]; /* implement default value of the action */
662 fprintf(stderr, "Reducing via rule %d (line %d), ", yyn,
665 /* Print the symbols being reduced, and their result. */
666 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
667 fprintf(stderr, "%s ", yytname[yyrhs[i]]);
668 fprintf(stderr, " -> %s\n", yytname[yyr1[yyn]]);
676 #line 51 "error_table.y"
678 table_name = ds(yyvsp[-2].dynstr);
679 current_token = table_name;
684 #line 57 "error_table.y"
686 current_token = yyvsp[-1].dynstr;
687 yyval.dynstr = yyvsp[0].dynstr;;
691 #line 60 "error_table.y"
693 current_token = yyvsp[0].dynstr;
694 set_table_fun(ds("1"));
695 yyval.dynstr = yyvsp[0].dynstr;
700 #line 67 "error_table.y"
702 current_token = yyvsp[0].dynstr;
703 set_table_fun(yyvsp[0].dynstr);
704 yyval.dynstr = yyvsp[0].dynstr;;
708 #line 74 "error_table.y"
710 current_token = yyvsp[0].dynstr;
711 set_table_num(yyvsp[0].dynstr);
712 yyval.dynstr = yyvsp[0].dynstr;;
716 #line 84 "error_table.y"
718 add_ec(yyvsp[-2].dynstr, yyvsp[0].dynstr);
719 free(yyvsp[-2].dynstr);
720 free(yyvsp[0].dynstr);;
724 #line 88 "error_table.y"
726 add_ec_val(yyvsp[-4].dynstr, yyvsp[-2].dynstr, yyvsp[0].dynstr);
727 free(yyvsp[-4].dynstr);
728 free(yyvsp[-2].dynstr);
729 free(yyvsp[0].dynstr);
734 #line 96 "error_table.y"
736 yyval.dynstr = ds(yyvsp[0].dynstr);
737 current_token = yyval.dynstr;;
741 #line 101 "error_table.y"
743 yyval.dynstr = ds(yyvsp[0].dynstr);
744 current_token = yyval.dynstr;;
748 /* the action file gets copied in in place of this dollarsign */
749 #line 487 "bison.simple"
759 short *ssp1 = yyss - 1;
760 fprintf(stderr, "state stack now");
761 while (ssp1 != yyssp)
762 fprintf(stderr, " %d", *++ssp1);
763 fprintf(stderr, "\n");
772 yylsp->first_line = yylloc.first_line;
773 yylsp->first_column = yylloc.first_column;
774 yylsp->last_line = (yylsp - 1)->last_line;
775 yylsp->last_column = (yylsp - 1)->last_column;
778 yylsp->last_line = (yylsp + yylen - 1)->last_line;
779 yylsp->last_column = (yylsp + yylen - 1)->last_column;
783 /* Now "shift" the result of the reduction.
784 * Determine what state that goes to,
785 * based on the state we popped back to
786 * and the rule number reduced by. */
790 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
791 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
792 yystate = yytable[yystate];
794 yystate = yydefgoto[yyn - YYNTBASE];
798 yyerrlab: /* here on detecting error */
801 /* If not already recovering from an error, report this error. */
805 #ifdef YYERROR_VERBOSE
806 yyn = yypact[yystate];
808 if (yyn > YYFLAG && yyn < YYLAST) {
814 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
815 for (x = (yyn < 0 ? -yyn : 0);
816 x < (sizeof(yytname) / sizeof(char *)); x++)
817 if (yycheck[x + yyn] == x)
818 size += strlen(yytname[x]) + 15, count++;
819 msg = (char *)malloc(size + 15);
821 strcpy(msg, "parse error");
825 for (x = (yyn < 0 ? -yyn : 0);
826 x < (sizeof(yytname) / sizeof(char *)); x++)
827 if (yycheck[x + yyn] == x) {
829 count == 0 ? ", expecting `" : " or `");
830 strcat(msg, yytname[x]);
838 yyerror("parse error; also virtual memory exceeded");
840 #endif /* YYERROR_VERBOSE */
841 yyerror("parse error");
845 yyerrlab1: /* here on error raised explicitly by an action */
847 if (yyerrstatus == 3) {
848 /* if just tried and failed to reuse lookahead token after an error, discard it. */
850 /* return failure if at end of input */
856 fprintf(stderr, "Discarding token %d (%s).\n", yychar,
863 /* Else will try to reuse lookahead token
864 * after shifting the error token. */
866 yyerrstatus = 3; /* Each real token shifted decrements this */
870 yyerrdefault: /* current state does not do anything special for the error token. */
873 /* This is wrong; only states that explicitly want error tokens
874 * should shift them. */
875 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it. */
880 yyerrpop: /* pop the current state because it cannot handle the error token */
892 short *ssp1 = yyss - 1;
893 fprintf(stderr, "Error: state stack now");
894 while (ssp1 != yyssp)
895 fprintf(stderr, " %d", *++ssp1);
896 fprintf(stderr, "\n");
902 yyn = yypact[yystate];
907 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
924 fprintf(stderr, "Shifting error token, ");
936 #line 105 "error_table.y"
940 * Copyright 1986, 1987 by the MIT Student Information Processing Board
942 * For copyright info, see mit-sipb-cr.h.
947 #include <afs/param.h>
952 #include <sys/types.h>
953 #include <afs/afsutil.h>
955 #include <sys/time.h>
957 #include <sys/timeb.h>
958 #include "error_table.h"
959 #include "mit-sipb-cr.h"
963 * Copyright 2000, International Business Machines Corporation and others.
964 * All Rights Reserved.
966 * This software has been released under the terms of the IBM Public
967 * License. For details, see the LICENSE file in the top-level source
968 * directory or online at http://www.openafs.org/dl/license10.html
971 extern FILE *hfile, *cfile, *msfile;
974 static afs_int32 gensym_n = 0;
977 gensym(const char *x)
982 gettimeofday(&tv, (void *)0);
983 gensym_n = (tv.tv_sec % 10000) * 100 + tv.tv_usec / 10000;
985 symbol = (char *)malloc(32 * sizeof(char));
987 sprintf(symbol, "et%ld", gensym_n);
992 ds(const char *string)
995 rv = (char *)malloc(strlen(string) + 1);
1001 quote(const char *string)
1004 rv = (char *)malloc(strlen(string) + 3);
1011 afs_int32 table_number = 0;
1013 char **error_codes = (char **)NULL;
1016 add_ec(const char *name, const char *description)
1021 fprintf(msfile, "%d\t%s\n", current, description);
1023 fprintf(msfile, "%d %s\n", current, description);
1026 fprintf(cfile, "\t\"%s\",\n", description);
1028 if (error_codes == (char **)NULL) {
1029 error_codes = (char **)malloc(sizeof(char *));
1030 *error_codes = (char *)NULL;
1033 (char **)realloc((char *)error_codes, (current + 2) * sizeof(char *));
1034 error_codes[current++] = ds(name);
1035 error_codes[current] = (char *)NULL;
1039 add_ec_val(const char *name, const char *val, const char *description)
1041 const int ncurrent = atoi(val);
1042 if (ncurrent < current) {
1043 printf("Error code %s (%d) out of order", name, current);
1047 while (ncurrent > current) {
1049 fputs("\t(char *)NULL,\n", cfile);
1055 fprintf(msfile, "%d\t%s\n", current, description);
1057 fprintf(msfile, "%d %s\n", current, description);
1060 fprintf(cfile, "\t\"%s\",\n", description);
1062 if (error_codes == (char **)NULL) {
1063 error_codes = (char **)malloc(sizeof(char *));
1064 *error_codes = (char *)NULL;
1067 (char **)realloc((char *)error_codes, (current + 2) * sizeof(char *));
1068 error_codes[current++] = ds(name);
1069 error_codes[current] = (char *)NULL;
1076 for (i = 0; i < current; i++) {
1077 if (error_codes[i] != (char *)NULL)
1078 fprintf(hfile, "#define %-40s (%ldL)\n", error_codes[i],
1084 * char_to_num -- maps letters and numbers into a small numbering space
1086 * lowercase -> 27-52
1091 static const char char_set[] =
1092 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
1100 where = strchr(char_set, c);
1102 diff = where - char_set + 1;
1103 assert(diff < (1 << ERRCODE_RANGE));
1105 } else if (isprint(c))
1106 fprintf(stderr, "Illegal character `%c' in error table name\n", c);
1108 fprintf(stderr, "Illegal character %03o in error table name\n", c);
1113 set_table_num(char *string)
1116 set_table_1num(string);
1119 if (strlen(string) > 4) {
1120 fprintf(stderr, "Table name %s too long, truncated ", string);
1122 fprintf(stderr, "to %s\n", string);
1124 if (char_to_num(string[0]) > char_to_num('z')) {
1125 fprintf(stderr, "%s%s%s%s",
1126 "First character of error table name must be ",
1127 "a letter; name ``", string, "'' rejected\n");
1130 while (*string != '\0') {
1131 table_number = (table_number << BITS_PER_CHAR)
1132 + char_to_num(*string);
1135 table_number = table_number << ERRCODE_RANGE;
1139 set_table_fun(char *astring)
1144 for (tp = astring; (tc = *tp) != 0; tp++) {
1147 "Table function '%s' must be a decimal integer.\n",
1153 table_number += (atoi(astring)) << 28;
1156 /* for compatibility with old comerr's, we truncate package name to 4
1157 * characters, but only store first 3 in the error code. Note that this
1158 * function, as a side effect, truncates the table name down to 4 chars.
1161 set_table_1num(char *string)
1166 if ((temp = strlen(string)) > 4) {
1167 fprintf(stderr, "Table name %s too long, truncated ", string);
1169 fprintf(stderr, "to %s\n", string);
1173 "Table name %s too long, only 3 characters fit in error code.\n",
1176 if (char_to_1num(string[0]) > char_to_1num('z')) {
1177 fprintf(stderr, "%s%s%s%s",
1178 "First character of error table name must be ",
1179 "a letter; name ``", string, "'' rejected\n");
1183 for (ctr = 0; ctr < 3; ctr++) { /* copy at most 3 chars to integer */
1184 if (*string == '\0')
1185 break; /* and watch for early end */
1186 temp = (temp * 050) /* "radix fifty" is base 050 = 40 */
1187 +char_to_1num(*string);
1190 table_number += temp << 12;
1194 * char_to_num -- maps letters and numbers into very small space
1196 * mixed case -> 10-35
1198 * others are reserved
1201 static const char char_1set[] = "abcdefghijklmnopqrstuvwxyz_0123456789";
1204 char_to_1num(char c)
1212 where = strchr(char_1set, c);
1214 /* start at 1 so we can decode */
1215 diff = where - char_1set;
1216 assert(diff < 050); /* it is radix 50, after all */
1218 } else if (isprint(c))
1219 fprintf(stderr, "Illegal character `%c' in error table name\n", c);
1221 fprintf(stderr, "Illegal character %03o in error table name\n", c);
1226 #include "et_lex.lex_nt.c"
1228 #include "et_lex.lex.c"