xref: /titanic_41/usr/src/cmd/sgs/lex/common/reject.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1989 AT&T	*/
23*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate #include <stdio.h>
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifdef EUC
31*7c478bd9Sstevel@tonic-gate #include <euc.h>
32*7c478bd9Sstevel@tonic-gate #include <widec.h>
33*7c478bd9Sstevel@tonic-gate #include <limits.h>
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #ifndef JLSLEX
38*7c478bd9Sstevel@tonic-gate #pragma weak yyinput
39*7c478bd9Sstevel@tonic-gate #pragma weak yyleng
40*7c478bd9Sstevel@tonic-gate #pragma weak yytext
41*7c478bd9Sstevel@tonic-gate #pragma weak yyunput
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #define	CHR    char
44*7c478bd9Sstevel@tonic-gate #define	YYTEXT yytext
45*7c478bd9Sstevel@tonic-gate #define	YYLENG yyleng
46*7c478bd9Sstevel@tonic-gate #define	YYINPUT yyinput
47*7c478bd9Sstevel@tonic-gate #define	YYUNPUT yyunput
48*7c478bd9Sstevel@tonic-gate #define	YYOUTPUT yyoutput
49*7c478bd9Sstevel@tonic-gate #define	YYREJECT yyreject
50*7c478bd9Sstevel@tonic-gate #endif
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate #ifdef WOPTION
53*7c478bd9Sstevel@tonic-gate #pragma weak yyinput
54*7c478bd9Sstevel@tonic-gate #pragma weak yyleng
55*7c478bd9Sstevel@tonic-gate #pragma weak yytext
56*7c478bd9Sstevel@tonic-gate #pragma weak yyunput
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate #define	CHR    wchar_t
59*7c478bd9Sstevel@tonic-gate #define	YYTEXT yytext
60*7c478bd9Sstevel@tonic-gate #define	YYLENG yyleng
61*7c478bd9Sstevel@tonic-gate #define	YYINPUT yyinput
62*7c478bd9Sstevel@tonic-gate #define	YYUNPUT yyunput
63*7c478bd9Sstevel@tonic-gate #define	YYOUTPUT yyoutput
64*7c478bd9Sstevel@tonic-gate #define	YYREJECT yyreject_w
65*7c478bd9Sstevel@tonic-gate #endif
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate #ifdef EOPTION
68*7c478bd9Sstevel@tonic-gate #pragma weak yyleng
69*7c478bd9Sstevel@tonic-gate #pragma weak yytext
70*7c478bd9Sstevel@tonic-gate #pragma weak yywinput
71*7c478bd9Sstevel@tonic-gate #pragma weak yywleng
72*7c478bd9Sstevel@tonic-gate #pragma weak yywtext
73*7c478bd9Sstevel@tonic-gate #pragma weak yywunput
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate #define	CHR    wchar_t
76*7c478bd9Sstevel@tonic-gate #define	YYTEXT yywtext
77*7c478bd9Sstevel@tonic-gate #define	YYLENG yywleng
78*7c478bd9Sstevel@tonic-gate #define	YYINPUT yywinput
79*7c478bd9Sstevel@tonic-gate #define	YYUNPUT yywunput
80*7c478bd9Sstevel@tonic-gate #define	YYOUTPUT yywoutput
81*7c478bd9Sstevel@tonic-gate #define	YYREJECT yyreject_e
82*7c478bd9Sstevel@tonic-gate extern unsigned char yytext[];
83*7c478bd9Sstevel@tonic-gate extern int yyleng;
84*7c478bd9Sstevel@tonic-gate #endif
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #pragma weak yyback
87*7c478bd9Sstevel@tonic-gate #if defined(__cplusplus) || defined(__STDC__)
88*7c478bd9Sstevel@tonic-gate extern int	yyback(int *, int);
89*7c478bd9Sstevel@tonic-gate extern int	YYINPUT(void);
90*7c478bd9Sstevel@tonic-gate extern void	YYUNPUT(int);
91*7c478bd9Sstevel@tonic-gate #ifdef EUC
92*7c478bd9Sstevel@tonic-gate 	static int	yyracc(int);
93*7c478bd9Sstevel@tonic-gate #else
94*7c478bd9Sstevel@tonic-gate 	extern int	yyracc(int);
95*7c478bd9Sstevel@tonic-gate #endif
96*7c478bd9Sstevel@tonic-gate #ifdef EOPTION
97*7c478bd9Sstevel@tonic-gate 	extern size_t	wcstombs(char *, const wchar_t *, size_t);
98*7c478bd9Sstevel@tonic-gate #endif
99*7c478bd9Sstevel@tonic-gate #endif
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate #pragma weak yyout
102*7c478bd9Sstevel@tonic-gate extern FILE *yyout, *yyin;
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate #pragma weak yyfnd
105*7c478bd9Sstevel@tonic-gate #pragma weak yyprevious
106*7c478bd9Sstevel@tonic-gate extern int yyprevious, *yyfnd;
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate #pragma weak yyextra
109*7c478bd9Sstevel@tonic-gate extern char yyextra[];
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate extern int YYLENG;
112*7c478bd9Sstevel@tonic-gate extern CHR YYTEXT[];
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate #pragma weak yylsp
115*7c478bd9Sstevel@tonic-gate #pragma weak yylstate
116*7c478bd9Sstevel@tonic-gate #pragma weak yyolsp
117*7c478bd9Sstevel@tonic-gate extern struct {int *yyaa, *yybb; int *yystops; } *yylstate[], **yylsp, **yyolsp;
118*7c478bd9Sstevel@tonic-gate #if defined(__cplusplus) || defined(__STDC__)
119*7c478bd9Sstevel@tonic-gate int
YYREJECT(void)120*7c478bd9Sstevel@tonic-gate YYREJECT(void)
121*7c478bd9Sstevel@tonic-gate #else
122*7c478bd9Sstevel@tonic-gate YYREJECT()
123*7c478bd9Sstevel@tonic-gate #endif
124*7c478bd9Sstevel@tonic-gate {
125*7c478bd9Sstevel@tonic-gate 	for (; yylsp < yyolsp; yylsp++)
126*7c478bd9Sstevel@tonic-gate 		YYTEXT[YYLENG++] = YYINPUT();
127*7c478bd9Sstevel@tonic-gate 	if (*yyfnd > 0)
128*7c478bd9Sstevel@tonic-gate 		return (yyracc(*yyfnd++));
129*7c478bd9Sstevel@tonic-gate 	while (yylsp-- > yylstate) {
130*7c478bd9Sstevel@tonic-gate 		YYUNPUT(YYTEXT[YYLENG-1]);
131*7c478bd9Sstevel@tonic-gate 		YYTEXT[--YYLENG] = 0;
132*7c478bd9Sstevel@tonic-gate 		if (*yylsp != 0 && (yyfnd = (*yylsp)->yystops) && *yyfnd > 0)
133*7c478bd9Sstevel@tonic-gate 			return (yyracc(*yyfnd++));
134*7c478bd9Sstevel@tonic-gate 	}
135*7c478bd9Sstevel@tonic-gate #ifdef EOPTION
136*7c478bd9Sstevel@tonic-gate 	yyleng = wcstombs((char *)yytext, YYTEXT, YYLENG*MB_LEN_MAX);
137*7c478bd9Sstevel@tonic-gate #endif
138*7c478bd9Sstevel@tonic-gate 	if (YYTEXT[0] == 0)
139*7c478bd9Sstevel@tonic-gate 		return (0);
140*7c478bd9Sstevel@tonic-gate 	YYLENG = 0;
141*7c478bd9Sstevel@tonic-gate #ifdef EOPTION
142*7c478bd9Sstevel@tonic-gate 	yyleng = 0;
143*7c478bd9Sstevel@tonic-gate #endif
144*7c478bd9Sstevel@tonic-gate 	return (-1);
145*7c478bd9Sstevel@tonic-gate }
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate #if defined(__cplusplus) || defined(__STDC__)
148*7c478bd9Sstevel@tonic-gate int
yyracc(int m)149*7c478bd9Sstevel@tonic-gate yyracc(int m)
150*7c478bd9Sstevel@tonic-gate #else
151*7c478bd9Sstevel@tonic-gate yyracc(m)
152*7c478bd9Sstevel@tonic-gate #endif
153*7c478bd9Sstevel@tonic-gate {
154*7c478bd9Sstevel@tonic-gate 	yyolsp = yylsp;
155*7c478bd9Sstevel@tonic-gate 	if (yyextra[m]) {
156*7c478bd9Sstevel@tonic-gate 		while (yyback((*yylsp)->yystops, -m) != 1 && yylsp > yylstate) {
157*7c478bd9Sstevel@tonic-gate 			yylsp--;
158*7c478bd9Sstevel@tonic-gate 			YYUNPUT(YYTEXT[--YYLENG]);
159*7c478bd9Sstevel@tonic-gate 		}
160*7c478bd9Sstevel@tonic-gate 	}
161*7c478bd9Sstevel@tonic-gate 	yyprevious = YYTEXT[YYLENG-1];
162*7c478bd9Sstevel@tonic-gate 	YYTEXT[YYLENG] = 0;
163*7c478bd9Sstevel@tonic-gate #ifdef EOPTION
164*7c478bd9Sstevel@tonic-gate 	yyleng = wcstombs((char *)yytext, YYTEXT, YYLENG*MB_LEN_MAX);
165*7c478bd9Sstevel@tonic-gate #endif
166*7c478bd9Sstevel@tonic-gate 	return (m);
167*7c478bd9Sstevel@tonic-gate }
168