File: | src/usr.bin/keynote/obj/lex.kv.c |
Warning: | line 810, column 19 Array subscript is undefined |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | ||||
2 | #line 3 "lex.kv.c" | |||
3 | ||||
4 | #define YY_INT_ALIGNEDshort int short int | |||
5 | ||||
6 | /* $OpenBSD: flex.skl,v 1.18 2021/11/30 15:50:06 millert Exp $ */ | |||
7 | ||||
8 | /* A lexical scanner generated by flex */ | |||
9 | ||||
10 | #define yy_create_bufferkv_create_buffer kv_create_buffer | |||
11 | #define yy_delete_bufferkv_delete_buffer kv_delete_buffer | |||
12 | #define yy_flex_debugkv_flex_debug kv_flex_debug | |||
13 | #define yy_init_bufferkv_init_buffer kv_init_buffer | |||
14 | #define yy_flush_bufferkv_flush_buffer kv_flush_buffer | |||
15 | #define yy_load_buffer_statekv_load_buffer_state kv_load_buffer_state | |||
16 | #define yy_switch_to_bufferkv_switch_to_buffer kv_switch_to_buffer | |||
17 | #define yyinkvin kvin | |||
18 | #define yylengkvleng kvleng | |||
19 | #define yylexkvlex kvlex | |||
20 | #define yylinenokvlineno kvlineno | |||
21 | #define yyoutkvout kvout | |||
22 | #define yyrestartkvrestart kvrestart | |||
23 | #define yytextkvtext kvtext | |||
24 | #define yywrapkvwrap kvwrap | |||
25 | #define yyallockvalloc kvalloc | |||
26 | #define yyreallockvrealloc kvrealloc | |||
27 | #define yyfreekvfree kvfree | |||
28 | ||||
29 | #define FLEX_SCANNER | |||
30 | #define YY_FLEX_MAJOR_VERSION2 2 | |||
31 | #define YY_FLEX_MINOR_VERSION5 5 | |||
32 | #define YY_FLEX_SUBMINOR_VERSION39 39 | |||
33 | #if YY_FLEX_SUBMINOR_VERSION39 > 0 | |||
34 | #define FLEX_BETA | |||
35 | #endif | |||
36 | ||||
37 | /* First, we deal with platform-specific or compiler-specific issues. */ | |||
38 | ||||
39 | /* begin standard C headers. */ | |||
40 | #include <stdio.h> | |||
41 | #include <string.h> | |||
42 | #include <errno(*__errno()).h> | |||
43 | #include <stdlib.h> | |||
44 | ||||
45 | /* end standard C headers. */ | |||
46 | ||||
47 | /* $OpenBSD: flexint.h,v 1.1 2015/11/19 19:43:40 tedu Exp $ */ | |||
48 | ||||
49 | /* flex integer type definitions */ | |||
50 | ||||
51 | #ifndef FLEXINT_H | |||
52 | #define FLEXINT_H | |||
53 | ||||
54 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | |||
55 | ||||
56 | #if defined (__STDC_VERSION__201710L) && __STDC_VERSION__201710L >= 199901L | |||
57 | ||||
58 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | |||
59 | * if you want the limit (max/min) macros for int types. | |||
60 | */ | |||
61 | #ifndef __STDC_LIMIT_MACROS1 | |||
62 | #define __STDC_LIMIT_MACROS1 1 | |||
63 | #endif | |||
64 | ||||
65 | #include <inttypes.h> | |||
66 | typedef int8_t flex_int8_t; | |||
67 | typedef uint8_t flex_uint8_t; | |||
68 | typedef int16_t flex_int16_t; | |||
69 | typedef uint16_t flex_uint16_t; | |||
70 | typedef int32_t flex_int32_t; | |||
71 | typedef uint32_t flex_uint32_t; | |||
72 | #else | |||
73 | typedef signed char flex_int8_t; | |||
74 | typedef short int flex_int16_t; | |||
75 | typedef int flex_int32_t; | |||
76 | typedef unsigned char flex_uint8_t; | |||
77 | typedef unsigned short int flex_uint16_t; | |||
78 | typedef unsigned int flex_uint32_t; | |||
79 | ||||
80 | /* Limits of integral types. */ | |||
81 | #ifndef INT8_MIN(-0x7f - 1) | |||
82 | #define INT8_MIN(-0x7f - 1) (-128) | |||
83 | #endif | |||
84 | #ifndef INT16_MIN(-0x7fff - 1) | |||
85 | #define INT16_MIN(-0x7fff - 1) (-32767-1) | |||
86 | #endif | |||
87 | #ifndef INT32_MIN(-0x7fffffff - 1) | |||
88 | #define INT32_MIN(-0x7fffffff - 1) (-2147483647-1) | |||
89 | #endif | |||
90 | #ifndef INT8_MAX0x7f | |||
91 | #define INT8_MAX0x7f (127) | |||
92 | #endif | |||
93 | #ifndef INT16_MAX0x7fff | |||
94 | #define INT16_MAX0x7fff (32767) | |||
95 | #endif | |||
96 | #ifndef INT32_MAX0x7fffffff | |||
97 | #define INT32_MAX0x7fffffff (2147483647) | |||
98 | #endif | |||
99 | #ifndef UINT8_MAX0xff | |||
100 | #define UINT8_MAX0xff (255U) | |||
101 | #endif | |||
102 | #ifndef UINT16_MAX0xffff | |||
103 | #define UINT16_MAX0xffff (65535U) | |||
104 | #endif | |||
105 | #ifndef UINT32_MAX0xffffffffU | |||
106 | #define UINT32_MAX0xffffffffU (4294967295U) | |||
107 | #endif | |||
108 | ||||
109 | #endif /* ! C99 */ | |||
110 | ||||
111 | #endif /* ! FLEXINT_H */ | |||
112 | ||||
113 | #ifdef __cplusplus | |||
114 | ||||
115 | /* The "const" storage-class-modifier is valid. */ | |||
116 | #define YY_USE_CONST | |||
117 | ||||
118 | #else /* ! __cplusplus */ | |||
119 | ||||
120 | /* C99 requires __STDC__ to be defined as 1. */ | |||
121 | #if defined (__STDC__1) | |||
122 | ||||
123 | #define YY_USE_CONST | |||
124 | ||||
125 | #endif /* defined (__STDC__) */ | |||
126 | #endif /* ! __cplusplus */ | |||
127 | ||||
128 | #ifdef YY_USE_CONST | |||
129 | #define yyconstconst const | |||
130 | #else | |||
131 | #define yyconstconst | |||
132 | #endif | |||
133 | ||||
134 | /* Returned upon end-of-file. */ | |||
135 | #define YY_NULL0 0 | |||
136 | ||||
137 | /* Promotes a possibly negative, possibly signed char to an unsigned | |||
138 | * integer for use as an array index. If the signed char is negative, | |||
139 | * we want to instead treat it as an 8-bit unsigned char, hence the | |||
140 | * double cast. | |||
141 | */ | |||
142 | #define YY_SC_TO_UI(c)((unsigned int) (unsigned char) c) ((unsigned int) (unsigned char) c) | |||
143 | ||||
144 | /* Enter a start condition. This macro really ought to take a parameter, | |||
145 | * but we do it the disgusting crufty way forced on us by the ()-less | |||
146 | * definition of BEGIN. | |||
147 | */ | |||
148 | #define BEGIN(yy_start) = 1 + 2 * (yy_start) = 1 + 2 * | |||
149 | ||||
150 | /* Translate the current start state into a value that can be later handed | |||
151 | * to BEGIN to return to the state. The YYSTATE alias is for lex | |||
152 | * compatibility. | |||
153 | */ | |||
154 | #define YY_START(((yy_start) - 1) / 2) (((yy_start) - 1) / 2) | |||
155 | #define YYSTATE(((yy_start) - 1) / 2) YY_START(((yy_start) - 1) / 2) | |||
156 | ||||
157 | /* Action number for EOF rule of a given start state. */ | |||
158 | #define YY_STATE_EOF(state)(8 + state + 1) (YY_END_OF_BUFFER8 + state + 1) | |||
159 | ||||
160 | /* Special action meaning "start processing a new file". */ | |||
161 | #define YY_NEW_FILEkvrestart(kvin ) kvrestart(kvin ) | |||
162 | ||||
163 | #define YY_END_OF_BUFFER_CHAR0 0 | |||
164 | ||||
165 | /* Size of default input buffer. */ | |||
166 | #ifndef YY_BUF_SIZE16384 | |||
167 | #define YY_BUF_SIZE16384 16384 | |||
168 | #endif | |||
169 | ||||
170 | /* The state buf must be large enough to hold one state per character in the main buffer. | |||
171 | */ | |||
172 | #define YY_STATE_BUF_SIZE((16384 + 2) * sizeof(yy_state_type)) ((YY_BUF_SIZE16384 + 2) * sizeof(yy_state_type)) | |||
173 | ||||
174 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | |||
175 | #define YY_TYPEDEF_YY_BUFFER_STATE | |||
176 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | |||
177 | #endif | |||
178 | ||||
179 | #ifndef YY_TYPEDEF_YY_SIZE_T | |||
180 | #define YY_TYPEDEF_YY_SIZE_T | |||
181 | typedef size_t yy_size_t; | |||
182 | #endif | |||
183 | ||||
184 | extern yy_size_t kvleng; | |||
185 | ||||
186 | extern FILE *kvin, *kvout; | |||
187 | ||||
188 | #define EOB_ACT_CONTINUE_SCAN0 0 | |||
189 | #define EOB_ACT_END_OF_FILE1 1 | |||
190 | #define EOB_ACT_LAST_MATCH2 2 | |||
191 | ||||
192 | /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires | |||
193 | * access to the local variable yy_act. Since yyless() is a macro, it would break | |||
194 | * existing scanners that call yyless() from OUTSIDE kvlex. | |||
195 | * One obvious solution it to make yy_act a global. I tried that, and saw | |||
196 | * a 5% performance hit in a non-kvlineno scanner, because yy_act is | |||
197 | * normally declared as a register variable-- so it is not worth it. | |||
198 | */ | |||
199 | #define YY_LESS_LINENO(n)do { int yyl; for ( yyl = n; yyl < kvleng; ++yyl ) if ( kvtext [yyl] == '\n' ) --kvlineno; }while(0) \ | |||
200 | do { \ | |||
201 | int yyl;\ | |||
202 | for ( yyl = n; yyl < kvleng; ++yyl )\ | |||
203 | if ( kvtext[yyl] == '\n' )\ | |||
204 | --kvlineno;\ | |||
205 | }while(0) | |||
206 | #define YY_LINENO_REWIND_TO(dst)do { const char *p; for ( p = yy_cp-1; p >= (dst); --p) if ( *p == '\n' ) --kvlineno; }while(0) \ | |||
207 | do {\ | |||
208 | const char *p;\ | |||
209 | for ( p = yy_cp-1; p >= (dst); --p)\ | |||
210 | if ( *p == '\n' )\ | |||
211 | --kvlineno;\ | |||
212 | }while(0) | |||
213 | ||||
214 | /* Return all but the first "n" matched characters back to the input stream. */ | |||
215 | #define yyless(n)do { int yyless_macro_arg = (n); do { int yyl; for ( yyl = yyless_macro_arg ; yyl < kvleng; ++yyl ) if ( kvtext[yyl] == '\n' ) --kvlineno ; }while(0); kvtext[kvleng] = (yy_hold_char); (yy_c_buf_p) = kvtext + yyless_macro_arg; (yy_hold_char) = *(yy_c_buf_p); *(yy_c_buf_p ) = '\0'; kvleng = yyless_macro_arg; } while ( 0 ) \ | |||
216 | do \ | |||
217 | { \ | |||
218 | /* Undo effects of setting up kvtext. */ \ | |||
219 | int yyless_macro_arg = (n); \ | |||
220 | YY_LESS_LINENO(yyless_macro_arg)do { int yyl; for ( yyl = yyless_macro_arg; yyl < kvleng; ++ yyl ) if ( kvtext[yyl] == '\n' ) --kvlineno; }while(0);\ | |||
221 | *yy_cp = (yy_hold_char); \ | |||
222 | YY_RESTORE_YY_MORE_OFFSET \ | |||
223 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ0; \ | |||
224 | YY_DO_BEFORE_ACTION(kvtext) = yy_bp; kvleng = (size_t) (yy_cp - yy_bp); (yy_hold_char ) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp;; /* set up kvtext again */ \ | |||
225 | } \ | |||
226 | while ( 0 ) | |||
227 | ||||
228 | #define unput(c)yyunput( c, (kvtext) ) yyunput( c, (yytext_ptrkvtext) ) | |||
229 | ||||
230 | #ifndef YY_STRUCT_YY_BUFFER_STATE | |||
231 | #define YY_STRUCT_YY_BUFFER_STATE | |||
232 | struct yy_buffer_state | |||
233 | { | |||
234 | FILE *yy_input_file; | |||
235 | ||||
236 | char *yy_ch_buf; /* input buffer */ | |||
237 | char *yy_buf_pos; /* current position in input buffer */ | |||
238 | ||||
239 | /* Size of input buffer in bytes, not including room for EOB | |||
240 | * characters. | |||
241 | */ | |||
242 | yy_size_t yy_buf_size; | |||
243 | ||||
244 | /* Number of characters read into yy_ch_buf, not including EOB | |||
245 | * characters. | |||
246 | */ | |||
247 | yy_size_t yy_n_chars; | |||
248 | ||||
249 | /* Whether we "own" the buffer - i.e., we know we created it, | |||
250 | * and can realloc() it to grow it, and should free() it to | |||
251 | * delete it. | |||
252 | */ | |||
253 | int yy_is_our_buffer; | |||
254 | ||||
255 | /* Whether this is an "interactive" input source; if so, and | |||
256 | * if we're using stdio for input, then we want to use getc() | |||
257 | * instead of fread(), to make sure we stop fetching input after | |||
258 | * each newline. | |||
259 | */ | |||
260 | int yy_is_interactive; | |||
261 | ||||
262 | /* Whether we're considered to be at the beginning of a line. | |||
263 | * If so, '^' rules will be active on the next match, otherwise | |||
264 | * not. | |||
265 | */ | |||
266 | int yy_at_bol; | |||
267 | ||||
268 | int yy_bs_lineno; /**< The line count. */ | |||
269 | int yy_bs_column; /**< The column count. */ | |||
270 | ||||
271 | /* Whether to try to fill the input buffer when we reach the | |||
272 | * end of it. | |||
273 | */ | |||
274 | int yy_fill_buffer; | |||
275 | ||||
276 | int yy_buffer_status; | |||
277 | ||||
278 | #define YY_BUFFER_NEW0 0 | |||
279 | #define YY_BUFFER_NORMAL1 1 | |||
280 | /* When an EOF's been seen but there's still some text to process | |||
281 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | |||
282 | * shouldn't try reading from the input source any more. We might | |||
283 | * still have a bunch of tokens to match, though, because of | |||
284 | * possible backing-up. | |||
285 | * | |||
286 | * When we actually see the EOF, we change the status to "new" | |||
287 | * (via kvrestart()), so that the user can continue scanning by | |||
288 | * just pointing kvin at a new input file. | |||
289 | */ | |||
290 | #define YY_BUFFER_EOF_PENDING2 2 | |||
291 | ||||
292 | }; | |||
293 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | |||
294 | ||||
295 | /* Stack of input buffers. */ | |||
296 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | |||
297 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | |||
298 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | |||
299 | ||||
300 | /* We provide macros for accessing buffer states in case in the | |||
301 | * future we want to put the buffer states in a more general | |||
302 | * "scanner state". | |||
303 | * | |||
304 | * Returns the top of the stack, or NULL. | |||
305 | */ | |||
306 | #define YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ( (yy_buffer_stack) \ | |||
307 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ | |||
308 | : NULL((void *)0)) | |||
309 | ||||
310 | /* Same as previous macro, but useful when we know that the buffer stack is not | |||
311 | * NULL or when we need an lvalue. For internal use only. | |||
312 | */ | |||
313 | #define YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] (yy_buffer_stack)[(yy_buffer_stack_top)] | |||
314 | ||||
315 | /* yy_hold_char holds the character lost when kvtext is formed. */ | |||
316 | static char yy_hold_char; | |||
317 | static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ | |||
318 | yy_size_t kvleng; | |||
319 | ||||
320 | /* Points to current character in buffer. */ | |||
321 | static char *yy_c_buf_p = (char *) 0; | |||
322 | static int yy_init = 0; /* whether we need to initialize */ | |||
323 | static int yy_start = 0; /* start state number */ | |||
324 | ||||
325 | /* Flag which is used to allow kvwrap()'s to do buffer switches | |||
326 | * instead of setting up a fresh kvin. A bit of a hack ... | |||
327 | */ | |||
328 | static int yy_did_buffer_switch_on_eof; | |||
329 | ||||
330 | void kvrestart (FILE *input_file ); | |||
331 | void kv_switch_to_buffer (YY_BUFFER_STATE new_buffer ); | |||
332 | YY_BUFFER_STATE kv_create_buffer (FILE *file,int size ); | |||
333 | void kv_delete_buffer (YY_BUFFER_STATE b ); | |||
334 | void kv_flush_buffer (YY_BUFFER_STATE b ); | |||
335 | void kvpush_buffer_state (YY_BUFFER_STATE new_buffer ); | |||
336 | void kvpop_buffer_state (void ); | |||
337 | ||||
338 | static void kvensure_buffer_stack (void ); | |||
339 | static void kv_load_buffer_state (void ); | |||
340 | static void kv_init_buffer (YY_BUFFER_STATE b,FILE *file ); | |||
341 | ||||
342 | #define YY_FLUSH_BUFFERkv_flush_buffer(( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top )] : ((void *)0)) ) kv_flush_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) | |||
343 | ||||
344 | YY_BUFFER_STATE kv_scan_buffer (char *base,yy_size_t size ); | |||
345 | YY_BUFFER_STATE kv_scan_string (yyconstconst char *yy_str ); | |||
346 | YY_BUFFER_STATE kv_scan_bytes (yyconstconst char *bytes,yy_size_t len ); | |||
347 | ||||
348 | void *kvalloc (yy_size_t ); | |||
349 | void *kvrealloc (void *,yy_size_t ); | |||
350 | void kvfree (void * ); | |||
351 | ||||
352 | #define yy_new_bufferkv_create_buffer kv_create_buffer | |||
353 | ||||
354 | #define yy_set_interactive(is_interactive){ if ( ! ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top )] : ((void *)0)) ){ kvensure_buffer_stack (); (yy_buffer_stack )[(yy_buffer_stack_top)] = kv_create_buffer(kvin,16384 ); } ( yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive = is_interactive; } \ | |||
355 | { \ | |||
356 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ){ \ | |||
357 | kvensure_buffer_stack (); \ | |||
358 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = \ | |||
359 | kv_create_buffer(kvin,YY_BUF_SIZE16384 ); \ | |||
360 | } \ | |||
361 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive = is_interactive; \ | |||
362 | } | |||
363 | ||||
364 | #define yy_set_bol(at_bol){ if ( ! ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top )] : ((void *)0)) ){ kvensure_buffer_stack (); (yy_buffer_stack )[(yy_buffer_stack_top)] = kv_create_buffer(kvin,16384 ); } ( yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol = at_bol ; } \ | |||
365 | { \ | |||
366 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ){\ | |||
367 | kvensure_buffer_stack (); \ | |||
368 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = \ | |||
369 | kv_create_buffer(kvin,YY_BUF_SIZE16384 ); \ | |||
370 | } \ | |||
371 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol = at_bol; \ | |||
372 | } | |||
373 | ||||
374 | #define YY_AT_BOL()((yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol) (YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_at_bol) | |||
375 | ||||
376 | /* Begin user sect3 */ | |||
377 | ||||
378 | #define kvwrap()1 1 | |||
379 | #define YY_SKIP_YYWRAP | |||
380 | ||||
381 | typedef unsigned char YY_CHAR; | |||
382 | ||||
383 | FILE *kvin = (FILE *) 0, *kvout = (FILE *) 0; | |||
384 | ||||
385 | typedef int yy_state_type; | |||
386 | ||||
387 | extern int kvlineno; | |||
388 | ||||
389 | int kvlineno = 1; | |||
390 | ||||
391 | extern char *kvtext; | |||
392 | #define yytext_ptrkvtext kvtext | |||
393 | ||||
394 | static yy_state_type yy_get_previous_state (void ); | |||
395 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | |||
396 | static int yy_get_next_buffer (void ); | |||
397 | static void yy_fatal_error (yyconstconst char msg[] ); | |||
398 | ||||
399 | /* Done after the current pattern has been matched and before the | |||
400 | * corresponding action - sets up kvtext. | |||
401 | */ | |||
402 | #define YY_DO_BEFORE_ACTION(kvtext) = yy_bp; kvleng = (size_t) (yy_cp - yy_bp); (yy_hold_char ) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp; \ | |||
403 | (yytext_ptrkvtext) = yy_bp; \ | |||
404 | kvleng = (size_t) (yy_cp - yy_bp); \ | |||
405 | (yy_hold_char) = *yy_cp; \ | |||
406 | *yy_cp = '\0'; \ | |||
407 | (yy_c_buf_p) = yy_cp; | |||
408 | ||||
409 | #define YY_NUM_RULES7 7 | |||
410 | #define YY_END_OF_BUFFER8 8 | |||
411 | /* This struct is not used in this scanner, | |||
412 | but its presence is necessary. */ | |||
413 | struct yy_trans_info | |||
414 | { | |||
415 | flex_int32_t yy_verify; | |||
416 | flex_int32_t yy_nxt; | |||
417 | }; | |||
418 | static yyconstconst flex_int16_t yy_acclist[23] = | |||
419 | { 0, | |||
420 | 8, 6, 7, 5, 6, 7, 5, 7, 4, 6, | |||
421 | 7, 2, 6, 7, 1, 6, 7, 6, 7, 4, | |||
422 | 2, 3 | |||
423 | } ; | |||
424 | ||||
425 | static yyconstconst flex_int16_t yy_accept[27] = | |||
426 | { 0, | |||
427 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
428 | 1, 2, 4, 7, 9, 12, 15, 18, 20, 21, | |||
429 | 22, 22, 23, 23, 23, 23 | |||
430 | } ; | |||
431 | ||||
432 | static yyconstconst flex_int32_t yy_ec[256] = | |||
433 | { 0, | |||
434 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | |||
435 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
436 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
437 | 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, | |||
438 | 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, | |||
439 | 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, | |||
440 | 7, 1, 1, 1, 6, 6, 6, 6, 6, 6, | |||
441 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |||
442 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |||
443 | 1, 8, 1, 1, 9, 1, 6, 6, 6, 6, | |||
444 | ||||
445 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |||
446 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |||
447 | 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, | |||
448 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
449 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
450 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
451 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
452 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
453 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
454 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
455 | ||||
456 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
457 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
458 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
459 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
460 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
461 | 1, 1, 1, 1, 1 | |||
462 | } ; | |||
463 | ||||
464 | static yyconstconst flex_int32_t yy_meta[10] = | |||
465 | { 0, | |||
466 | 1, 1, 2, 1, 1, 3, 1, 1, 3 | |||
467 | } ; | |||
468 | ||||
469 | static yyconstconst flex_int16_t yy_base[30] = | |||
470 | { 0, | |||
471 | 0, 2, 1, 0, 11, 10, 12, 9, 4, 0, | |||
472 | 12, 35, 35, 35, 0, 0, 35, 6, 0, 0, | |||
473 | 11, 35, 17, 0, 35, 25, 28, 8, 31 | |||
474 | } ; | |||
475 | ||||
476 | static yyconstconst flex_int16_t yy_def[30] = | |||
477 | { 0, | |||
478 | 26, 26, 2, 3, 2, 2, 2, 2, 2, 9, | |||
479 | 25, 25, 25, 25, 27, 28, 25, 29, 27, 28, | |||
480 | 29, 25, 29, 21, 0, 25, 25, 25, 25 | |||
481 | } ; | |||
482 | ||||
483 | static yyconstconst flex_int16_t yy_nxt[45] = | |||
484 | { 0, | |||
485 | 25, 13, 14, 13, 14, 15, 16, 18, 15, 22, | |||
486 | 20, 25, 18, 23, 22, 18, 17, 17, 23, 21, | |||
487 | 25, 25, 25, 25, 24, 12, 12, 12, 19, 25, | |||
488 | 19, 21, 25, 21, 11, 25, 25, 25, 25, 25, | |||
489 | 25, 25, 25, 25 | |||
490 | } ; | |||
491 | ||||
492 | static yyconstconst flex_int16_t yy_chk[45] = | |||
493 | { 0, | |||
494 | 0, 1, 1, 2, 2, 3, 3, 9, 9, 18, | |||
495 | 28, 11, 8, 18, 21, 7, 6, 5, 21, 23, | |||
496 | 0, 0, 0, 0, 23, 26, 26, 26, 27, 0, | |||
497 | 27, 29, 0, 29, 25, 25, 25, 25, 25, 25, | |||
498 | 25, 25, 25, 25 | |||
499 | } ; | |||
500 | ||||
501 | /* Table of booleans, true if rule could match eol. */ | |||
502 | static yyconstconst flex_int32_t yy_rule_can_match_eol[8] = | |||
503 | { 0, | |||
504 | 0, 0, 1, 0, 1, 0, 0, }; | |||
505 | ||||
506 | extern int kv_flex_debug; | |||
507 | int kv_flex_debug = 0; | |||
508 | ||||
509 | static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; | |||
510 | static char *yy_full_match; | |||
511 | static int yy_lp; | |||
512 | #define REJECT{ *yy_cp = (yy_hold_char); yy_cp = (yy_full_match); ++(yy_lp) ; goto find_rule; } \ | |||
513 | { \ | |||
514 | *yy_cp = (yy_hold_char); /* undo effects of setting up kvtext */ \ | |||
515 | yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ | |||
516 | ++(yy_lp); \ | |||
517 | goto find_rule; \ | |||
518 | } | |||
519 | ||||
520 | #define yymore()yymore_used_but_not_detected yymore_used_but_not_detected | |||
521 | #define YY_MORE_ADJ0 0 | |||
522 | #define YY_RESTORE_YY_MORE_OFFSET | |||
523 | char *kvtext; | |||
524 | #line 1 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
525 | #line 2 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
526 | /* $OpenBSD: keynote-ver.l,v 1.20 2017/08/28 17:07:19 millert Exp $ */ | |||
527 | /* | |||
528 | * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) | |||
529 | * | |||
530 | * This code was written by Angelos D. Keromytis in Philadelphia, PA, USA, | |||
531 | * in April-May 1998 | |||
532 | * | |||
533 | * Copyright (C) 1998, 1999 by Angelos D. Keromytis. | |||
534 | * | |||
535 | * Permission to use, copy, and modify this software with or without fee | |||
536 | * is hereby granted, provided that this entire notice is included in | |||
537 | * all copies of any software which is or includes a copy or | |||
538 | * modification of this software. | |||
539 | * | |||
540 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR | |||
541 | * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO | |||
542 | * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE | |||
543 | * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR | |||
544 | * PURPOSE. | |||
545 | */ | |||
546 | ||||
547 | #include <sys/time.h> | |||
548 | #include <sys/types.h> | |||
549 | ||||
550 | #include <ctype.h> | |||
551 | #include <regex.h> | |||
552 | #include <string.h> | |||
553 | #include <time.h> | |||
554 | #include <unistd.h> | |||
555 | ||||
556 | #include "z.tab.h" | |||
557 | #include "header.h" | |||
558 | #include "keynote.h" | |||
559 | ||||
560 | static void mystrncpy(char *, char *, int); | |||
561 | ||||
562 | #define YY_NO_INPUT1 1 | |||
563 | #line 564 "lex.kv.c" | |||
564 | ||||
565 | #define INITIAL0 0 | |||
566 | #define FIRSTPART1 1 | |||
567 | #define MIDDLEPART2 2 | |||
568 | #define SECONDPART3 3 | |||
569 | #define KEYSTATE4 4 | |||
570 | ||||
571 | #ifndef YY_NO_UNISTD_H | |||
572 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | |||
573 | * down here because we want the user's section 1 to have been scanned first. | |||
574 | * The user has a chance to override it with an option. | |||
575 | */ | |||
576 | #include <unistd.h> | |||
577 | #endif | |||
578 | ||||
579 | #ifndef YY_EXTRA_TYPEvoid * | |||
580 | #define YY_EXTRA_TYPEvoid * void * | |||
581 | #endif | |||
582 | ||||
583 | static int yy_init_globals (void ); | |||
584 | ||||
585 | /* Accessor methods to globals. | |||
586 | These are made visible to non-reentrant scanners for convenience. */ | |||
587 | ||||
588 | int kvlex_destroy (void ); | |||
589 | ||||
590 | int kvget_debug (void ); | |||
591 | ||||
592 | void kvset_debug (int debug_flag ); | |||
593 | ||||
594 | YY_EXTRA_TYPEvoid * kvget_extra (void ); | |||
595 | ||||
596 | void kvset_extra (YY_EXTRA_TYPEvoid * user_defined ); | |||
597 | ||||
598 | FILE *kvget_in (void ); | |||
599 | ||||
600 | void kvset_in (FILE * in_str ); | |||
601 | ||||
602 | FILE *kvget_out (void ); | |||
603 | ||||
604 | void kvset_out (FILE * out_str ); | |||
605 | ||||
606 | yy_size_t kvget_leng (void ); | |||
607 | ||||
608 | char *kvget_text (void ); | |||
609 | ||||
610 | int kvget_lineno (void ); | |||
611 | ||||
612 | void kvset_lineno (int line_number ); | |||
613 | ||||
614 | /* Macros after this point can all be overridden by user definitions in | |||
615 | * section 1. | |||
616 | */ | |||
617 | ||||
618 | #ifndef YY_SKIP_YYWRAP | |||
619 | #ifdef __cplusplus | |||
620 | extern "C" int kvwrap (void ); | |||
621 | #else | |||
622 | extern int kvwrap (void ); | |||
623 | #endif | |||
624 | #endif | |||
625 | ||||
626 | static void yyunput (int c,char *buf_ptr ); | |||
627 | ||||
628 | #ifndef yytext_ptrkvtext | |||
629 | static void yy_flex_strncpy (char *,yyconstconst char *,int ); | |||
630 | #endif | |||
631 | ||||
632 | #ifdef YY_NEED_STRLEN | |||
633 | static int yy_flex_strlen (yyconstconst char * ); | |||
634 | #endif | |||
635 | ||||
636 | #ifndef YY_NO_INPUT1 | |||
637 | ||||
638 | #ifdef __cplusplus | |||
639 | static int yyinput (void ); | |||
640 | #else | |||
641 | static int input (void ); | |||
642 | #endif | |||
643 | ||||
644 | #endif | |||
645 | ||||
646 | /* Amount of stuff to slurp up with each read. */ | |||
647 | #ifndef YY_READ_BUF_SIZE8192 | |||
648 | #define YY_READ_BUF_SIZE8192 8192 | |||
649 | #endif | |||
650 | ||||
651 | /* Copy whatever the last rule matched to the standard output. */ | |||
652 | #ifndef ECHOdo { if (fwrite( kvtext, kvleng, 1, kvout )) {} } while (0) | |||
653 | /* This used to be an fputs(), but since the string might contain NUL's, | |||
654 | * we now use fwrite(). | |||
655 | */ | |||
656 | #define ECHOdo { if (fwrite( kvtext, kvleng, 1, kvout )) {} } while (0) do { if (fwrite( kvtext, kvleng, 1, kvout )) {} } while (0) | |||
657 | #endif | |||
658 | ||||
659 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | |||
660 | * is returned in "result". | |||
661 | */ | |||
662 | #ifndef YY_INPUT | |||
663 | #define YY_INPUT(buf,result,max_size)if ( (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) { int c = '*'; size_t n; for ( n = 0; n < max_size && (c = (!__isthreaded ? (--(kvin)->_r < 0 ? __srget(kvin ) : (int)(*(kvin)->_p++)) : (getc)(kvin))) != (-1) && c != '\n'; ++n ) buf[n] = (char) c; if ( c == '\n' ) buf[n++ ] = (char) c; if ( c == (-1) && (!__isthreaded ? (((kvin )->_flags & 0x0040) != 0) : (ferror)(kvin)) ) yy_fatal_error ( "input in flex scanner failed" ); result = n; } else { (*__errno ())=0; while ( (result = fread(buf, 1, max_size, kvin))==0 && (!__isthreaded ? (((kvin)->_flags & 0x0040) != 0) : ( ferror)(kvin))) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed" ); break; } (*__errno())=0; (!__isthreaded ? ((void)((kvin)-> _flags &= ~(0x0040|0x0020))) : (clearerr)(kvin)); } } \ | |||
664 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) \ | |||
665 | { \ | |||
666 | int c = '*'; \ | |||
667 | size_t n; \ | |||
668 | for ( n = 0; n < max_size && \ | |||
669 | (c = getc( kvin )(!__isthreaded ? (--(kvin)->_r < 0 ? __srget(kvin) : (int )(*(kvin)->_p++)) : (getc)(kvin))) != EOF(-1) && c != '\n'; ++n ) \ | |||
670 | buf[n] = (char) c; \ | |||
671 | if ( c == '\n' ) \ | |||
672 | buf[n++] = (char) c; \ | |||
673 | if ( c == EOF(-1) && ferror( kvin )(!__isthreaded ? (((kvin)->_flags & 0x0040) != 0) : (ferror )(kvin)) ) \ | |||
674 | YY_FATAL_ERROR( "input in flex scanner failed" )yy_fatal_error( "input in flex scanner failed" ); \ | |||
675 | result = n; \ | |||
676 | } \ | |||
677 | else \ | |||
678 | { \ | |||
679 | errno(*__errno())=0; \ | |||
680 | while ( (result = fread(buf, 1, max_size, kvin))==0 && ferror(kvin)(!__isthreaded ? (((kvin)->_flags & 0x0040) != 0) : (ferror )(kvin))) \ | |||
681 | { \ | |||
682 | if( errno(*__errno()) != EINTR4) \ | |||
683 | { \ | |||
684 | YY_FATAL_ERROR( "input in flex scanner failed" )yy_fatal_error( "input in flex scanner failed" ); \ | |||
685 | break; \ | |||
686 | } \ | |||
687 | errno(*__errno())=0; \ | |||
688 | clearerr(kvin)(!__isthreaded ? ((void)((kvin)->_flags &= ~(0x0040|0x0020 ))) : (clearerr)(kvin)); \ | |||
689 | } \ | |||
690 | }\ | |||
691 | \ | |||
692 | ||||
693 | #endif | |||
694 | ||||
695 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | |||
696 | * we don't want an extra ';' after the "return" because that will cause | |||
697 | * some compilers to complain about unreachable statements. | |||
698 | */ | |||
699 | #ifndef yyterminate | |||
700 | #define yyterminate()return 0 return YY_NULL0 | |||
701 | #endif | |||
702 | ||||
703 | /* Number of entries by which start-condition stack grows. */ | |||
704 | #ifndef YY_START_STACK_INCR25 | |||
705 | #define YY_START_STACK_INCR25 25 | |||
706 | #endif | |||
707 | ||||
708 | /* Report a fatal error. */ | |||
709 | #ifndef YY_FATAL_ERROR | |||
710 | #define YY_FATAL_ERROR(msg)yy_fatal_error( msg ) yy_fatal_error( msg ) | |||
711 | #endif | |||
712 | ||||
713 | /* end tables serialization structures and prototypes */ | |||
714 | ||||
715 | /* Default declaration of generated scanner - a define so the user can | |||
716 | * easily add parameters. | |||
717 | */ | |||
718 | #ifndef YY_DECLint kvlex (void) | |||
719 | #define YY_DECL_IS_OURS1 1 | |||
720 | ||||
721 | extern int kvlex (void); | |||
722 | ||||
723 | #define YY_DECLint kvlex (void) int kvlex (void) | |||
724 | #endif /* !YY_DECL */ | |||
725 | ||||
726 | /* Code executed at the beginning of each rule, after kvtext and kvleng | |||
727 | * have been set up. | |||
728 | */ | |||
729 | #ifndef YY_USER_ACTION | |||
730 | #define YY_USER_ACTION | |||
731 | #endif | |||
732 | ||||
733 | /* Code executed at the end of each rule. */ | |||
734 | #ifndef YY_BREAKbreak; | |||
735 | #define YY_BREAKbreak; break; | |||
736 | #endif | |||
737 | ||||
738 | #define YY_RULE_SETUP \ | |||
739 | YY_USER_ACTION | |||
740 | ||||
741 | /** The main scanner function which does all the work. | |||
742 | */ | |||
743 | YY_DECLint kvlex (void) | |||
744 | { | |||
745 | yy_state_type yy_current_state; | |||
746 | char *yy_cp, *yy_bp; | |||
747 | int yy_act; | |||
748 | ||||
749 | if ( !(yy_init) ) | |||
| ||||
750 | { | |||
751 | (yy_init) = 1; | |||
752 | ||||
753 | #ifdef YY_USER_INIT | |||
754 | YY_USER_INIT; | |||
755 | #endif | |||
756 | ||||
757 | /* Create the reject buffer large enough to save one state per allowed character. */ | |||
758 | if ( ! (yy_state_buf) ) | |||
759 | (yy_state_buf) = (yy_state_type *) | |||
760 | kvalloc(YY_STATE_BUF_SIZE((16384 + 2) * sizeof(yy_state_type)) ); | |||
761 | if ( ! (yy_state_buf
| |||
762 | YY_FATAL_ERROR( "out of dynamic memory in kvlex()" )yy_fatal_error( "out of dynamic memory in kvlex()" ); | |||
763 | ||||
764 | if ( ! (yy_start) ) | |||
765 | (yy_start) = 1; /* first start state */ | |||
766 | ||||
767 | if ( ! kvin ) { | |||
768 | kvin = stdin(&__sF[0]); | |||
769 | } | |||
770 | ||||
771 | if ( ! kvout ) { | |||
772 | kvout = stdout(&__sF[1]); | |||
773 | } | |||
774 | ||||
775 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) { | |||
776 | kvensure_buffer_stack (); | |||
777 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = | |||
778 | kv_create_buffer(kvin,YY_BUF_SIZE16384 ); | |||
779 | } | |||
780 | ||||
781 | kv_load_buffer_state( ); | |||
782 | } | |||
783 | ||||
784 | { | |||
785 | #line 44 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
786 | ||||
787 | ||||
788 | #line 789 "lex.kv.c" | |||
789 | ||||
790 | while ( 1 ) /* loops until end-of-file is reached */ | |||
791 | { | |||
792 | yy_cp = (yy_c_buf_p); | |||
793 | ||||
794 | /* Support of kvtext. */ | |||
795 | *yy_cp = (yy_hold_char); | |||
796 | ||||
797 | /* yy_bp points to the position in yy_ch_buf of the start of | |||
798 | * the current run. | |||
799 | */ | |||
800 | yy_bp = yy_cp; | |||
801 | ||||
802 | yy_current_state = (yy_start); | |||
803 | ||||
804 | (yy_state_ptr) = (yy_state_buf); | |||
805 | *(yy_state_ptr)++ = yy_current_state; | |||
806 | ||||
807 | yy_match: | |||
808 | do | |||
809 | { | |||
810 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)((unsigned int) (unsigned char) *yy_cp)] ; | |||
| ||||
811 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |||
812 | { | |||
813 | yy_current_state = (int) yy_def[yy_current_state]; | |||
814 | if ( yy_current_state >= 26 ) | |||
815 | yy_c = yy_meta[(unsigned int) yy_c]; | |||
816 | } | |||
817 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |||
818 | *(yy_state_ptr)++ = yy_current_state; | |||
819 | ++yy_cp; | |||
820 | } | |||
821 | while ( yy_current_state != 25 ); | |||
822 | ||||
823 | yy_find_action: | |||
824 | yy_current_state = *--(yy_state_ptr); | |||
825 | (yy_lp) = yy_accept[yy_current_state]; | |||
826 | find_rule: /* we branch to this label when backing up */ | |||
827 | for ( ; ; ) /* until we find what rule we matched */ | |||
828 | { | |||
829 | if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) | |||
830 | { | |||
831 | yy_act = yy_acclist[(yy_lp)]; | |||
832 | { | |||
833 | (yy_full_match) = yy_cp; | |||
834 | break; | |||
835 | } | |||
836 | } | |||
837 | --yy_cp; | |||
838 | yy_current_state = *--(yy_state_ptr); | |||
839 | (yy_lp) = yy_accept[yy_current_state]; | |||
840 | } | |||
841 | ||||
842 | YY_DO_BEFORE_ACTION(kvtext) = yy_bp; kvleng = (size_t) (yy_cp - yy_bp); (yy_hold_char ) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp;; | |||
843 | ||||
844 | if ( yy_act != YY_END_OF_BUFFER8 && yy_rule_can_match_eol[yy_act] ) | |||
845 | { | |||
846 | yy_size_t yyl; | |||
847 | for ( yyl = 0; yyl < kvleng; ++yyl ) | |||
848 | if ( kvtext[yyl] == '\n' ) | |||
849 | ||||
850 | kvlineno++; | |||
851 | ; | |||
852 | } | |||
853 | ||||
854 | do_action: /* This label is used only to access EOF actions. */ | |||
855 | ||||
856 | switch ( yy_act ) | |||
857 | { /* beginning of action switch */ | |||
858 | case 1: | |||
859 | YY_RULE_SETUP | |||
860 | #line 46 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
861 | { | |||
862 | BEGIN(yy_start) = 1 + 2 *(SECONDPART3); | |||
863 | return EQ259; | |||
864 | } | |||
865 | YY_BREAKbreak; | |||
866 | case 2: | |||
867 | YY_RULE_SETUP | |||
868 | #line 50 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
869 | { | |||
870 | int len = strlen(kvtext) + 1; | |||
871 | kvlval.s.string = calloc(len, sizeof(char)); | |||
872 | if (kvlval.s.string == NULL((void *)0)) { | |||
873 | keynote_errno = ERROR_MEMORY-1; | |||
874 | return -1; | |||
875 | } | |||
876 | strlcpy(kvlval.s.string, kvtext, len); | |||
877 | BEGIN(yy_start) = 1 + 2 *(MIDDLEPART2); | |||
878 | return VSTRING258; | |||
879 | } | |||
880 | YY_BREAKbreak; | |||
881 | case 3: | |||
882 | /* rule 3 can match eol */ | |||
883 | YY_RULE_SETUP | |||
884 | #line 61 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
885 | { kvlval.s.string = calloc(strlen(kvtext) - 1, | |||
886 | sizeof(char)); | |||
887 | if (kvlval.s.string == NULL((void *)0)) { | |||
888 | keynote_errno = ERROR_MEMORY-1; | |||
889 | return -1; | |||
890 | } | |||
891 | mystrncpy(kvlval.s.string, kvtext + 1, | |||
892 | strlen(kvtext) - 2); | |||
893 | BEGIN(yy_start) = 1 + 2 *(FIRSTPART1); | |||
894 | return STRING257; | |||
895 | } | |||
896 | YY_BREAKbreak; | |||
897 | case 4: | |||
898 | YY_RULE_SETUP | |||
899 | #line 72 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
900 | ; | |||
901 | YY_BREAKbreak; | |||
902 | case 5: | |||
903 | /* rule 5 can match eol */ | |||
904 | YY_RULE_SETUP | |||
905 | #line 73 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
906 | ; | |||
907 | YY_BREAKbreak; | |||
908 | case 6: | |||
909 | YY_RULE_SETUP | |||
910 | #line 74 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
911 | { keynote_errno = ERROR_SYNTAX-2; return -1; REJECT{ *yy_cp = (yy_hold_char); yy_cp = (yy_full_match); ++(yy_lp) ; goto find_rule; }; } | |||
912 | YY_BREAKbreak; | |||
913 | case 7: | |||
914 | YY_RULE_SETUP | |||
915 | #line 76 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
916 | YY_FATAL_ERROR( "flex scanner jammed" )yy_fatal_error( "flex scanner jammed" ); | |||
917 | YY_BREAKbreak; | |||
918 | #line 919 "lex.kv.c" | |||
919 | case YY_STATE_EOF(INITIAL)(8 + 0 + 1): | |||
920 | case YY_STATE_EOF(FIRSTPART)(8 + 1 + 1): | |||
921 | case YY_STATE_EOF(MIDDLEPART)(8 + 2 + 1): | |||
922 | case YY_STATE_EOF(SECONDPART)(8 + 3 + 1): | |||
923 | case YY_STATE_EOF(KEYSTATE)(8 + 4 + 1): | |||
924 | yyterminate()return 0; | |||
925 | ||||
926 | case YY_END_OF_BUFFER8: | |||
927 | { | |||
928 | /* Amount of text matched not including the EOB char. */ | |||
929 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptrkvtext)) - 1; | |||
930 | ||||
931 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | |||
932 | *yy_cp = (yy_hold_char); | |||
933 | YY_RESTORE_YY_MORE_OFFSET | |||
934 | ||||
935 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status == YY_BUFFER_NEW0 ) | |||
936 | { | |||
937 | /* We're scanning a new file or input source. It's | |||
938 | * possible that this happened because the user | |||
939 | * just pointed kvin at a new source and called | |||
940 | * kvlex(). If so, then we have to assure | |||
941 | * consistency between YY_CURRENT_BUFFER and our | |||
942 | * globals. Here is the right place to do so, because | |||
943 | * this is the first action (other than possibly a | |||
944 | * back-up) that will match for the new input source. | |||
945 | */ | |||
946 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars; | |||
947 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_input_file = kvin; | |||
948 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status = YY_BUFFER_NORMAL1; | |||
949 | } | |||
950 | ||||
951 | /* Note that here we test for yy_c_buf_p "<=" to the position | |||
952 | * of the first EOB in the buffer, since yy_c_buf_p will | |||
953 | * already have been incremented past the NUL character | |||
954 | * (since all states make transitions on EOB to the | |||
955 | * end-of-buffer state). Contrast this with the test | |||
956 | * in input(). | |||
957 | */ | |||
958 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] ) | |||
959 | { /* This was really a NUL. */ | |||
960 | yy_state_type yy_next_state; | |||
961 | ||||
962 | (yy_c_buf_p) = (yytext_ptrkvtext) + yy_amount_of_matched_text; | |||
963 | ||||
964 | yy_current_state = yy_get_previous_state( ); | |||
965 | ||||
966 | /* Okay, we're now positioned to make the NUL | |||
967 | * transition. We couldn't have | |||
968 | * yy_get_previous_state() go ahead and do it | |||
969 | * for us because it doesn't know how to deal | |||
970 | * with the possibility of jamming (and we don't | |||
971 | * want to build jamming into it because then it | |||
972 | * will run more slowly). | |||
973 | */ | |||
974 | ||||
975 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | |||
976 | ||||
977 | yy_bp = (yytext_ptrkvtext) + YY_MORE_ADJ0; | |||
978 | ||||
979 | if ( yy_next_state ) | |||
980 | { | |||
981 | /* Consume the NUL. */ | |||
982 | yy_cp = ++(yy_c_buf_p); | |||
983 | yy_current_state = yy_next_state; | |||
984 | goto yy_match; | |||
985 | } | |||
986 | ||||
987 | else | |||
988 | { | |||
989 | yy_cp = (yy_c_buf_p); | |||
990 | goto yy_find_action; | |||
991 | } | |||
992 | } | |||
993 | ||||
994 | else switch ( yy_get_next_buffer( ) ) | |||
995 | { | |||
996 | case EOB_ACT_END_OF_FILE1: | |||
997 | { | |||
998 | (yy_did_buffer_switch_on_eof) = 0; | |||
999 | ||||
1000 | if ( kvwrap( )1 ) | |||
1001 | { | |||
1002 | /* Note: because we've taken care in | |||
1003 | * yy_get_next_buffer() to have set up | |||
1004 | * kvtext, we can now set up | |||
1005 | * yy_c_buf_p so that if some total | |||
1006 | * hoser (like flex itself) wants to | |||
1007 | * call the scanner after we return the | |||
1008 | * YY_NULL, it'll still work - another | |||
1009 | * YY_NULL will get returned. | |||
1010 | */ | |||
1011 | (yy_c_buf_p) = (yytext_ptrkvtext) + YY_MORE_ADJ0; | |||
1012 | ||||
1013 | yy_act = YY_STATE_EOF(YY_START)(8 + (((yy_start) - 1) / 2) + 1); | |||
1014 | goto do_action; | |||
1015 | } | |||
1016 | ||||
1017 | else | |||
1018 | { | |||
1019 | if ( ! (yy_did_buffer_switch_on_eof) ) | |||
1020 | YY_NEW_FILEkvrestart(kvin ); | |||
1021 | } | |||
1022 | break; | |||
1023 | } | |||
1024 | ||||
1025 | case EOB_ACT_CONTINUE_SCAN0: | |||
1026 | (yy_c_buf_p) = | |||
1027 | (yytext_ptrkvtext) + yy_amount_of_matched_text; | |||
1028 | ||||
1029 | yy_current_state = yy_get_previous_state( ); | |||
1030 | ||||
1031 | yy_cp = (yy_c_buf_p); | |||
1032 | yy_bp = (yytext_ptrkvtext) + YY_MORE_ADJ0; | |||
1033 | goto yy_match; | |||
1034 | ||||
1035 | case EOB_ACT_LAST_MATCH2: | |||
1036 | (yy_c_buf_p) = | |||
1037 | &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)]; | |||
1038 | ||||
1039 | yy_current_state = yy_get_previous_state( ); | |||
1040 | ||||
1041 | yy_cp = (yy_c_buf_p); | |||
1042 | yy_bp = (yytext_ptrkvtext) + YY_MORE_ADJ0; | |||
1043 | goto yy_find_action; | |||
1044 | } | |||
1045 | break; | |||
1046 | } | |||
1047 | ||||
1048 | default: | |||
1049 | YY_FATAL_ERROR(yy_fatal_error( "fatal flex scanner internal error--no action found" ) | |||
1050 | "fatal flex scanner internal error--no action found" )yy_fatal_error( "fatal flex scanner internal error--no action found" ); | |||
1051 | } /* end of action switch */ | |||
1052 | } /* end of scanning one token */ | |||
1053 | } /* end of user's declarations */ | |||
1054 | } /* end of kvlex */ | |||
1055 | ||||
1056 | /* yy_get_next_buffer - try to read in a new buffer | |||
1057 | * | |||
1058 | * Returns a code representing an action: | |||
1059 | * EOB_ACT_LAST_MATCH - | |||
1060 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | |||
1061 | * EOB_ACT_END_OF_FILE - end of file | |||
1062 | */ | |||
1063 | static int yy_get_next_buffer (void) | |||
1064 | { | |||
1065 | char *dest = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf; | |||
1066 | char *source = (yytext_ptrkvtext); | |||
1067 | int number_to_move, i; | |||
1068 | int ret_val; | |||
1069 | ||||
1070 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1] ) | |||
1071 | YY_FATAL_ERROR(yy_fatal_error( "fatal flex scanner internal error--end of buffer missed" ) | |||
1072 | "fatal flex scanner internal error--end of buffer missed" )yy_fatal_error( "fatal flex scanner internal error--end of buffer missed" ); | |||
1073 | ||||
1074 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_fill_buffer == 0 ) | |||
1075 | { /* Don't try to fill the buffer, so this is an EOF. */ | |||
1076 | if ( (yy_c_buf_p) - (yytext_ptrkvtext) - YY_MORE_ADJ0 == 1 ) | |||
1077 | { | |||
1078 | /* We matched a single character, the EOB, so | |||
1079 | * treat this as a final EOF. | |||
1080 | */ | |||
1081 | return EOB_ACT_END_OF_FILE1; | |||
1082 | } | |||
1083 | ||||
1084 | else | |||
1085 | { | |||
1086 | /* We matched some text prior to the EOB, first | |||
1087 | * process it. | |||
1088 | */ | |||
1089 | return EOB_ACT_LAST_MATCH2; | |||
1090 | } | |||
1091 | } | |||
1092 | ||||
1093 | /* Try to read more data. */ | |||
1094 | ||||
1095 | /* First move last chars to start of buffer. */ | |||
1096 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptrkvtext)) - 1; | |||
1097 | ||||
1098 | for ( i = 0; i < number_to_move; ++i ) | |||
1099 | *(dest++) = *(source++); | |||
1100 | ||||
1101 | if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status == YY_BUFFER_EOF_PENDING2 ) | |||
1102 | /* don't do the read, it's not guaranteed to return an EOF, | |||
1103 | * just force an EOF | |||
1104 | */ | |||
1105 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars) = 0; | |||
1106 | ||||
1107 | else | |||
1108 | { | |||
1109 | yy_size_t num_to_read = | |||
1110 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size - number_to_move - 1; | |||
1111 | ||||
1112 | while ( num_to_read <= 0 ) | |||
1113 | { /* Not enough room in the buffer - grow it. */ | |||
1114 | ||||
1115 | YY_FATAL_ERROR(yy_fatal_error( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ) | |||
1116 | "input buffer overflow, can't enlarge buffer because scanner uses REJECT" )yy_fatal_error( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); | |||
1117 | ||||
1118 | } | |||
1119 | ||||
1120 | if ( num_to_read > YY_READ_BUF_SIZE8192 ) | |||
1121 | num_to_read = YY_READ_BUF_SIZE8192; | |||
1122 | ||||
1123 | /* Read in more data. */ | |||
1124 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),if ( (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) { int c = '*'; size_t n; for ( n = 0; n < num_to_read && (c = (!__isthreaded ? (--(kvin)->_r < 0 ? __srget(kvin ) : (int)(*(kvin)->_p++)) : (getc)(kvin))) != (-1) && c != '\n'; ++n ) (&(yy_buffer_stack)[(yy_buffer_stack_top )]->yy_ch_buf[number_to_move])[n] = (char) c; if ( c == '\n' ) (&(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf [number_to_move])[n++] = (char) c; if ( c == (-1) && ( !__isthreaded ? (((kvin)->_flags & 0x0040) != 0) : (ferror )(kvin)) ) yy_fatal_error( "input in flex scanner failed" ); ( yy_n_chars) = n; } else { (*__errno())=0; while ( ((yy_n_chars ) = fread((&(yy_buffer_stack)[(yy_buffer_stack_top)]-> yy_ch_buf[number_to_move]), 1, num_to_read, kvin))==0 && (!__isthreaded ? (((kvin)->_flags & 0x0040) != 0) : ( ferror)(kvin))) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed" ); break; } (*__errno())=0; (!__isthreaded ? ((void)((kvin)-> _flags &= ~(0x0040|0x0020))) : (clearerr)(kvin)); } } | |||
1125 | (yy_n_chars), num_to_read )if ( (yy_buffer_stack)[(yy_buffer_stack_top)]->yy_is_interactive ) { int c = '*'; size_t n; for ( n = 0; n < num_to_read && (c = (!__isthreaded ? (--(kvin)->_r < 0 ? __srget(kvin ) : (int)(*(kvin)->_p++)) : (getc)(kvin))) != (-1) && c != '\n'; ++n ) (&(yy_buffer_stack)[(yy_buffer_stack_top )]->yy_ch_buf[number_to_move])[n] = (char) c; if ( c == '\n' ) (&(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf [number_to_move])[n++] = (char) c; if ( c == (-1) && ( !__isthreaded ? (((kvin)->_flags & 0x0040) != 0) : (ferror )(kvin)) ) yy_fatal_error( "input in flex scanner failed" ); ( yy_n_chars) = n; } else { (*__errno())=0; while ( ((yy_n_chars ) = fread((&(yy_buffer_stack)[(yy_buffer_stack_top)]-> yy_ch_buf[number_to_move]), 1, num_to_read, kvin))==0 && (!__isthreaded ? (((kvin)->_flags & 0x0040) != 0) : ( ferror)(kvin))) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed" ); break; } (*__errno())=0; (!__isthreaded ? ((void)((kvin)-> _flags &= ~(0x0040|0x0020))) : (clearerr)(kvin)); } }; | |||
1126 | ||||
1127 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars); | |||
1128 | } | |||
1129 | ||||
1130 | if ( (yy_n_chars) == 0 ) | |||
1131 | { | |||
1132 | if ( number_to_move == YY_MORE_ADJ0 ) | |||
1133 | { | |||
1134 | ret_val = EOB_ACT_END_OF_FILE1; | |||
1135 | kvrestart(kvin ); | |||
1136 | } | |||
1137 | ||||
1138 | else | |||
1139 | { | |||
1140 | ret_val = EOB_ACT_LAST_MATCH2; | |||
1141 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status = | |||
1142 | YY_BUFFER_EOF_PENDING2; | |||
1143 | } | |||
1144 | } | |||
1145 | ||||
1146 | else | |||
1147 | ret_val = EOB_ACT_CONTINUE_SCAN0; | |||
1148 | ||||
1149 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size) { | |||
1150 | /* Extend the array by 50%, plus the number we really need. */ | |||
1151 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); | |||
1152 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf = (char *) kvrealloc((void *) YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf,new_size ); | |||
1153 | if ( ! YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf ) | |||
1154 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" )yy_fatal_error( "out of dynamic memory in yy_get_next_buffer()" ); | |||
1155 | /* "- 2" to take care of EOB's */ | |||
1156 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size = (int) (new_size - 2); | |||
1157 | } | |||
1158 | ||||
1159 | (yy_n_chars) += number_to_move; | |||
1160 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR0; | |||
1161 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR0; | |||
1162 | ||||
1163 | (yytext_ptrkvtext) = &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[0]; | |||
1164 | ||||
1165 | return ret_val; | |||
1166 | } | |||
1167 | ||||
1168 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | |||
1169 | ||||
1170 | static yy_state_type yy_get_previous_state (void) | |||
1171 | { | |||
1172 | yy_state_type yy_current_state; | |||
1173 | char *yy_cp; | |||
1174 | ||||
1175 | yy_current_state = (yy_start); | |||
1176 | ||||
1177 | (yy_state_ptr) = (yy_state_buf); | |||
1178 | *(yy_state_ptr)++ = yy_current_state; | |||
1179 | ||||
1180 | for ( yy_cp = (yytext_ptrkvtext) + YY_MORE_ADJ0; yy_cp < (yy_c_buf_p); ++yy_cp ) | |||
1181 | { | |||
1182 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)((unsigned int) (unsigned char) *yy_cp)] : 1); | |||
1183 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |||
1184 | { | |||
1185 | yy_current_state = (int) yy_def[yy_current_state]; | |||
1186 | if ( yy_current_state >= 26 ) | |||
1187 | yy_c = yy_meta[(unsigned int) yy_c]; | |||
1188 | } | |||
1189 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |||
1190 | *(yy_state_ptr)++ = yy_current_state; | |||
1191 | } | |||
1192 | ||||
1193 | return yy_current_state; | |||
1194 | } | |||
1195 | ||||
1196 | /* yy_try_NUL_trans - try to make a transition on the NUL character | |||
1197 | * | |||
1198 | * synopsis | |||
1199 | * next_state = yy_try_NUL_trans( current_state ); | |||
1200 | */ | |||
1201 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | |||
1202 | { | |||
1203 | int yy_is_jam; | |||
1204 | ||||
1205 | YY_CHAR yy_c = 1; | |||
1206 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |||
1207 | { | |||
1208 | yy_current_state = (int) yy_def[yy_current_state]; | |||
1209 | if ( yy_current_state >= 26 ) | |||
1210 | yy_c = yy_meta[(unsigned int) yy_c]; | |||
1211 | } | |||
1212 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |||
1213 | yy_is_jam = (yy_current_state == 25); | |||
1214 | if ( ! yy_is_jam ) | |||
1215 | *(yy_state_ptr)++ = yy_current_state; | |||
1216 | ||||
1217 | return yy_is_jam ? 0 : yy_current_state; | |||
1218 | } | |||
1219 | ||||
1220 | static void yyunput (int c, char * yy_bp ) | |||
1221 | { | |||
1222 | char *yy_cp; | |||
1223 | ||||
1224 | yy_cp = (yy_c_buf_p); | |||
1225 | ||||
1226 | /* undo effects of setting up kvtext */ | |||
1227 | *yy_cp = (yy_hold_char); | |||
1228 | ||||
1229 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf + 2 ) | |||
1230 | { /* need to shift things up to make room */ | |||
1231 | /* +2 for EOB chars. */ | |||
1232 | yy_size_t number_to_move = (yy_n_chars) + 2; | |||
1233 | char *dest = &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[ | |||
1234 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size + 2]; | |||
1235 | char *source = | |||
1236 | &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[number_to_move]; | |||
1237 | ||||
1238 | while ( source > YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf ) | |||
1239 | *--dest = *--source; | |||
1240 | ||||
1241 | yy_cp += (int) (dest - source); | |||
1242 | yy_bp += (int) (dest - source); | |||
1243 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = | |||
1244 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size; | |||
1245 | ||||
1246 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf + 2 ) | |||
1247 | YY_FATAL_ERROR( "flex scanner push-back overflow" )yy_fatal_error( "flex scanner push-back overflow" ); | |||
1248 | } | |||
1249 | ||||
1250 | *--yy_cp = (char) c; | |||
1251 | ||||
1252 | if ( c == '\n' ){ | |||
1253 | --kvlineno; | |||
1254 | } | |||
1255 | ||||
1256 | (yytext_ptrkvtext) = yy_bp; | |||
1257 | (yy_hold_char) = *yy_cp; | |||
1258 | (yy_c_buf_p) = yy_cp; | |||
1259 | } | |||
1260 | ||||
1261 | #ifndef YY_NO_INPUT1 | |||
1262 | #ifdef __cplusplus | |||
1263 | static int yyinput (void) | |||
1264 | #else | |||
1265 | static int input (void) | |||
1266 | #endif | |||
1267 | ||||
1268 | { | |||
1269 | int c; | |||
1270 | ||||
1271 | *(yy_c_buf_p) = (yy_hold_char); | |||
1272 | ||||
1273 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR0 ) | |||
1274 | { | |||
1275 | /* yy_c_buf_p now points to the character we want to return. | |||
1276 | * If this occurs *before* the EOB characters, then it's a | |||
1277 | * valid NUL; if not, then we've hit the end of the buffer. | |||
1278 | */ | |||
1279 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] ) | |||
1280 | /* This was really a NUL. */ | |||
1281 | *(yy_c_buf_p) = '\0'; | |||
1282 | ||||
1283 | else | |||
1284 | { /* need more input */ | |||
1285 | yy_size_t offset = (yy_c_buf_p) - (yytext_ptrkvtext); | |||
1286 | ++(yy_c_buf_p); | |||
1287 | ||||
1288 | switch ( yy_get_next_buffer( ) ) | |||
1289 | { | |||
1290 | case EOB_ACT_LAST_MATCH2: | |||
1291 | /* This happens because yy_g_n_b() | |||
1292 | * sees that we've accumulated a | |||
1293 | * token and flags that we need to | |||
1294 | * try matching the token before | |||
1295 | * proceeding. But for input(), | |||
1296 | * there's no matching to consider. | |||
1297 | * So convert the EOB_ACT_LAST_MATCH | |||
1298 | * to EOB_ACT_END_OF_FILE. | |||
1299 | */ | |||
1300 | ||||
1301 | /* Reset buffer status. */ | |||
1302 | kvrestart(kvin ); | |||
1303 | ||||
1304 | /*FALLTHROUGH*/ | |||
1305 | ||||
1306 | case EOB_ACT_END_OF_FILE1: | |||
1307 | { | |||
1308 | if ( kvwrap( )1 ) | |||
1309 | return EOF(-1); | |||
1310 | ||||
1311 | if ( ! (yy_did_buffer_switch_on_eof) ) | |||
1312 | YY_NEW_FILEkvrestart(kvin ); | |||
1313 | #ifdef __cplusplus | |||
1314 | return yyinput(); | |||
1315 | #else | |||
1316 | return input(); | |||
1317 | #endif | |||
1318 | } | |||
1319 | ||||
1320 | case EOB_ACT_CONTINUE_SCAN0: | |||
1321 | (yy_c_buf_p) = (yytext_ptrkvtext) + offset; | |||
1322 | break; | |||
1323 | } | |||
1324 | } | |||
1325 | } | |||
1326 | ||||
1327 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ | |||
1328 | *(yy_c_buf_p) = '\0'; /* preserve kvtext */ | |||
1329 | (yy_hold_char) = *++(yy_c_buf_p); | |||
1330 | ||||
1331 | if ( c == '\n' ) | |||
1332 | ||||
1333 | kvlineno++; | |||
1334 | ; | |||
1335 | ||||
1336 | return c; | |||
1337 | } | |||
1338 | #endif /* ifndef YY_NO_INPUT */ | |||
1339 | ||||
1340 | /** Immediately switch to a different input stream. | |||
1341 | * @param input_file A readable stream. | |||
1342 | * | |||
1343 | * @note This function does not reset the start condition to @c INITIAL . | |||
1344 | */ | |||
1345 | void kvrestart (FILE * input_file ) | |||
1346 | { | |||
1347 | ||||
1348 | if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ){ | |||
1349 | kvensure_buffer_stack (); | |||
1350 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = | |||
1351 | kv_create_buffer(kvin,YY_BUF_SIZE16384 ); | |||
1352 | } | |||
1353 | ||||
1354 | kv_init_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)),input_file ); | |||
1355 | kv_load_buffer_state( ); | |||
1356 | } | |||
1357 | ||||
1358 | /** Switch to a different input buffer. | |||
1359 | * @param new_buffer The new input buffer. | |||
1360 | * | |||
1361 | */ | |||
1362 | void kv_switch_to_buffer (YY_BUFFER_STATE new_buffer ) | |||
1363 | { | |||
1364 | ||||
1365 | /* TODO. We should be able to replace this entire function body | |||
1366 | * with | |||
1367 | * kvpop_buffer_state(); | |||
1368 | * kvpush_buffer_state(new_buffer); | |||
1369 | */ | |||
1370 | kvensure_buffer_stack (); | |||
1371 | if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) == new_buffer ) | |||
1372 | return; | |||
1373 | ||||
1374 | if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) | |||
1375 | { | |||
1376 | /* Flush out information for old buffer. */ | |||
1377 | *(yy_c_buf_p) = (yy_hold_char); | |||
1378 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p); | |||
1379 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars); | |||
1380 | } | |||
1381 | ||||
1382 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer; | |||
1383 | kv_load_buffer_state( ); | |||
1384 | ||||
1385 | /* We don't actually know whether we did this switch during | |||
1386 | * EOF (kvwrap()) processing, but the only time this flag | |||
1387 | * is looked at is after kvwrap() is called, so it's safe | |||
1388 | * to go ahead and always set it. | |||
1389 | */ | |||
1390 | (yy_did_buffer_switch_on_eof) = 1; | |||
1391 | } | |||
1392 | ||||
1393 | static void kv_load_buffer_state (void) | |||
1394 | { | |||
1395 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars; | |||
1396 | (yytext_ptrkvtext) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos; | |||
1397 | kvin = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_input_file; | |||
1398 | (yy_hold_char) = *(yy_c_buf_p); | |||
1399 | } | |||
1400 | ||||
1401 | /** Allocate and initialize an input buffer state. | |||
1402 | * @param file A readable stream. | |||
1403 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | |||
1404 | * | |||
1405 | * @return the allocated buffer state. | |||
1406 | */ | |||
1407 | YY_BUFFER_STATE kv_create_buffer (FILE * file, int size ) | |||
1408 | { | |||
1409 | YY_BUFFER_STATE b; | |||
1410 | ||||
1411 | b = (YY_BUFFER_STATE) kvalloc(sizeof( struct yy_buffer_state ) ); | |||
1412 | if ( ! b ) | |||
1413 | YY_FATAL_ERROR( "out of dynamic memory in kv_create_buffer()" )yy_fatal_error( "out of dynamic memory in kv_create_buffer()" ); | |||
1414 | ||||
1415 | b->yy_buf_size = size; | |||
1416 | ||||
1417 | /* yy_ch_buf has to be 2 characters longer than the size given because | |||
1418 | * we need to put in 2 end-of-buffer characters. | |||
1419 | */ | |||
1420 | b->yy_ch_buf = (char *) kvalloc(b->yy_buf_size + 2 ); | |||
1421 | if ( ! b->yy_ch_buf ) | |||
1422 | YY_FATAL_ERROR( "out of dynamic memory in kv_create_buffer()" )yy_fatal_error( "out of dynamic memory in kv_create_buffer()" ); | |||
1423 | ||||
1424 | b->yy_is_our_buffer = 1; | |||
1425 | ||||
1426 | kv_init_buffer(b,file ); | |||
1427 | ||||
1428 | return b; | |||
1429 | } | |||
1430 | ||||
1431 | /** Destroy the buffer. | |||
1432 | * @param b a buffer created with kv_create_buffer() | |||
1433 | * | |||
1434 | */ | |||
1435 | void kv_delete_buffer (YY_BUFFER_STATE b ) | |||
1436 | { | |||
1437 | ||||
1438 | if ( ! b ) | |||
1439 | return; | |||
1440 | ||||
1441 | if ( b == YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) /* Not sure if we should pop here. */ | |||
1442 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = (YY_BUFFER_STATE) 0; | |||
1443 | ||||
1444 | if ( b->yy_is_our_buffer ) | |||
1445 | kvfree((void *) b->yy_ch_buf ); | |||
1446 | ||||
1447 | kvfree((void *) b ); | |||
1448 | } | |||
1449 | ||||
1450 | /* Initializes or reinitializes a buffer. | |||
1451 | * This function is sometimes called more than once on the same buffer, | |||
1452 | * such as during a kvrestart() or at EOF. | |||
1453 | */ | |||
1454 | static void kv_init_buffer (YY_BUFFER_STATE b, FILE * file ) | |||
1455 | ||||
1456 | { | |||
1457 | int oerrno = errno(*__errno()); | |||
1458 | ||||
1459 | kv_flush_buffer(b ); | |||
1460 | ||||
1461 | b->yy_input_file = file; | |||
1462 | b->yy_fill_buffer = 1; | |||
1463 | ||||
1464 | /* If b is the current buffer, then kv_init_buffer was _probably_ | |||
1465 | * called from kvrestart() or through yy_get_next_buffer. | |||
1466 | * In that case, we don't want to reset the lineno or column. | |||
1467 | */ | |||
1468 | if (b != YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))){ | |||
1469 | b->yy_bs_lineno = 1; | |||
1470 | b->yy_bs_column = 0; | |||
1471 | } | |||
1472 | ||||
1473 | b->yy_is_interactive = 0; | |||
1474 | ||||
1475 | errno(*__errno()) = oerrno; | |||
1476 | } | |||
1477 | ||||
1478 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | |||
1479 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | |||
1480 | * | |||
1481 | */ | |||
1482 | void kv_flush_buffer (YY_BUFFER_STATE b ) | |||
1483 | { | |||
1484 | if ( ! b ) | |||
1485 | return; | |||
1486 | ||||
1487 | b->yy_n_chars = 0; | |||
1488 | ||||
1489 | /* We always need two end-of-buffer characters. The first causes | |||
1490 | * a transition to the end-of-buffer state. The second causes | |||
1491 | * a jam in that state. | |||
1492 | */ | |||
1493 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR0; | |||
1494 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR0; | |||
1495 | ||||
1496 | b->yy_buf_pos = &b->yy_ch_buf[0]; | |||
1497 | ||||
1498 | b->yy_at_bol = 1; | |||
1499 | b->yy_buffer_status = YY_BUFFER_NEW0; | |||
1500 | ||||
1501 | if ( b == YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) | |||
1502 | kv_load_buffer_state( ); | |||
1503 | } | |||
1504 | ||||
1505 | /** Pushes the new state onto the stack. The new state becomes | |||
1506 | * the current state. This function will allocate the stack | |||
1507 | * if necessary. | |||
1508 | * @param new_buffer The new state. | |||
1509 | * | |||
1510 | */ | |||
1511 | void kvpush_buffer_state (YY_BUFFER_STATE new_buffer ) | |||
1512 | { | |||
1513 | if (new_buffer == NULL((void *)0)) | |||
1514 | return; | |||
1515 | ||||
1516 | kvensure_buffer_stack(); | |||
1517 | ||||
1518 | /* This block is copied from kv_switch_to_buffer. */ | |||
1519 | if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ) | |||
1520 | { | |||
1521 | /* Flush out information for old buffer. */ | |||
1522 | *(yy_c_buf_p) = (yy_hold_char); | |||
1523 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p); | |||
1524 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars); | |||
1525 | } | |||
1526 | ||||
1527 | /* Only push if top exists. Otherwise, replace top. */ | |||
1528 | if (YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))) | |||
1529 | (yy_buffer_stack_top)++; | |||
1530 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer; | |||
1531 | ||||
1532 | /* copied from kv_switch_to_buffer. */ | |||
1533 | kv_load_buffer_state( ); | |||
1534 | (yy_did_buffer_switch_on_eof) = 1; | |||
1535 | } | |||
1536 | ||||
1537 | /** Removes and deletes the top of the stack, if present. | |||
1538 | * The next element becomes the new top. | |||
1539 | * | |||
1540 | */ | |||
1541 | void kvpop_buffer_state (void) | |||
1542 | { | |||
1543 | if (!YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))) | |||
1544 | return; | |||
1545 | ||||
1546 | kv_delete_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ); | |||
1547 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = NULL((void *)0); | |||
1548 | if ((yy_buffer_stack_top) > 0) | |||
1549 | --(yy_buffer_stack_top); | |||
1550 | ||||
1551 | if (YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))) { | |||
1552 | kv_load_buffer_state( ); | |||
1553 | (yy_did_buffer_switch_on_eof) = 1; | |||
1554 | } | |||
1555 | } | |||
1556 | ||||
1557 | /* Allocates the stack if it does not exist. | |||
1558 | * Guarantees space for at least one push. | |||
1559 | */ | |||
1560 | static void kvensure_buffer_stack (void) | |||
1561 | { | |||
1562 | yy_size_t num_to_alloc; | |||
1563 | ||||
1564 | if (!(yy_buffer_stack)) { | |||
1565 | ||||
1566 | /* First allocation is just for 2 elements, since we don't know if this | |||
1567 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | |||
1568 | * immediate realloc on the next call. | |||
1569 | */ | |||
1570 | num_to_alloc = 1; | |||
1571 | (yy_buffer_stack) = (struct yy_buffer_state**)kvalloc | |||
1572 | (num_to_alloc * sizeof(struct yy_buffer_state*) | |||
1573 | ); | |||
1574 | if ( ! (yy_buffer_stack) ) | |||
1575 | YY_FATAL_ERROR( "out of dynamic memory in kvensure_buffer_stack()" )yy_fatal_error( "out of dynamic memory in kvensure_buffer_stack()" ); | |||
1576 | ||||
1577 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | |||
1578 | ||||
1579 | (yy_buffer_stack_max) = num_to_alloc; | |||
1580 | (yy_buffer_stack_top) = 0; | |||
1581 | return; | |||
1582 | } | |||
1583 | ||||
1584 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ | |||
1585 | ||||
1586 | /* Increase the buffer to prepare for a possible push. */ | |||
1587 | int grow_size = 8 /* arbitrary grow size */; | |||
1588 | ||||
1589 | num_to_alloc = (yy_buffer_stack_max) + grow_size; | |||
1590 | (yy_buffer_stack) = (struct yy_buffer_state**)kvrealloc | |||
1591 | ((yy_buffer_stack), | |||
1592 | num_to_alloc * sizeof(struct yy_buffer_state*) | |||
1593 | ); | |||
1594 | if ( ! (yy_buffer_stack) ) | |||
1595 | YY_FATAL_ERROR( "out of dynamic memory in kvensure_buffer_stack()" )yy_fatal_error( "out of dynamic memory in kvensure_buffer_stack()" ); | |||
1596 | ||||
1597 | /* zero only the new slots.*/ | |||
1598 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | |||
1599 | (yy_buffer_stack_max) = num_to_alloc; | |||
1600 | } | |||
1601 | } | |||
1602 | ||||
1603 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | |||
1604 | * @param base the character buffer | |||
1605 | * @param size the size in bytes of the character buffer | |||
1606 | * | |||
1607 | * @return the newly allocated buffer state object. | |||
1608 | */ | |||
1609 | YY_BUFFER_STATE kv_scan_buffer (char * base, yy_size_t size ) | |||
1610 | { | |||
1611 | YY_BUFFER_STATE b; | |||
1612 | ||||
1613 | if ( size < 2 || | |||
1614 | base[size-2] != YY_END_OF_BUFFER_CHAR0 || | |||
1615 | base[size-1] != YY_END_OF_BUFFER_CHAR0 ) | |||
1616 | /* They forgot to leave room for the EOB's. */ | |||
1617 | return 0; | |||
1618 | ||||
1619 | b = (YY_BUFFER_STATE) kvalloc(sizeof( struct yy_buffer_state ) ); | |||
1620 | if ( ! b ) | |||
1621 | YY_FATAL_ERROR( "out of dynamic memory in kv_scan_buffer()" )yy_fatal_error( "out of dynamic memory in kv_scan_buffer()" ); | |||
1622 | ||||
1623 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | |||
1624 | b->yy_buf_pos = b->yy_ch_buf = base; | |||
1625 | b->yy_is_our_buffer = 0; | |||
1626 | b->yy_input_file = 0; | |||
1627 | b->yy_n_chars = b->yy_buf_size; | |||
1628 | b->yy_is_interactive = 0; | |||
1629 | b->yy_at_bol = 1; | |||
1630 | b->yy_fill_buffer = 0; | |||
1631 | b->yy_buffer_status = YY_BUFFER_NEW0; | |||
1632 | ||||
1633 | kv_switch_to_buffer(b ); | |||
1634 | ||||
1635 | return b; | |||
1636 | } | |||
1637 | ||||
1638 | /** Setup the input buffer state to scan a string. The next call to kvlex() will | |||
1639 | * scan from a @e copy of @a str. | |||
1640 | * @param yystr a NUL-terminated string to scan | |||
1641 | * | |||
1642 | * @return the newly allocated buffer state object. | |||
1643 | * @note If you want to scan bytes that may contain NUL values, then use | |||
1644 | * kv_scan_bytes() instead. | |||
1645 | */ | |||
1646 | YY_BUFFER_STATE kv_scan_string (yyconstconst char * yystr ) | |||
1647 | { | |||
1648 | ||||
1649 | return kv_scan_bytes(yystr,strlen(yystr) ); | |||
1650 | } | |||
1651 | ||||
1652 | /** Setup the input buffer state to scan the given bytes. The next call to kvlex() will | |||
1653 | * scan from a @e copy of @a bytes. | |||
1654 | * @param yybytes the byte buffer to scan | |||
1655 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. | |||
1656 | * | |||
1657 | * @return the newly allocated buffer state object. | |||
1658 | */ | |||
1659 | YY_BUFFER_STATE kv_scan_bytes (yyconstconst char * yybytes, yy_size_t _yybytes_len ) | |||
1660 | { | |||
1661 | YY_BUFFER_STATE b; | |||
1662 | char *buf; | |||
1663 | yy_size_t n; | |||
1664 | yy_size_t i; | |||
1665 | ||||
1666 | /* Get memory for full buffer, including space for trailing EOB's. */ | |||
1667 | n = _yybytes_len + 2; | |||
1668 | buf = (char *) kvalloc(n ); | |||
1669 | if ( ! buf ) | |||
1670 | YY_FATAL_ERROR( "out of dynamic memory in kv_scan_bytes()" )yy_fatal_error( "out of dynamic memory in kv_scan_bytes()" ); | |||
1671 | ||||
1672 | for ( i = 0; i < _yybytes_len; ++i ) | |||
1673 | buf[i] = yybytes[i]; | |||
1674 | ||||
1675 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR0; | |||
1676 | ||||
1677 | b = kv_scan_buffer(buf,n ); | |||
1678 | if ( ! b ) | |||
1679 | YY_FATAL_ERROR( "bad buffer in kv_scan_bytes()" )yy_fatal_error( "bad buffer in kv_scan_bytes()" ); | |||
1680 | ||||
1681 | /* It's okay to grow etc. this buffer, and we should throw it | |||
1682 | * away when we're done. | |||
1683 | */ | |||
1684 | b->yy_is_our_buffer = 1; | |||
1685 | ||||
1686 | return b; | |||
1687 | } | |||
1688 | ||||
1689 | #ifndef YY_EXIT_FAILURE2 | |||
1690 | #define YY_EXIT_FAILURE2 2 | |||
1691 | #endif | |||
1692 | ||||
1693 | static void yy_fatal_error (yyconstconst char* msg ) | |||
1694 | { | |||
1695 | (void) fprintf( stderr(&__sF[2]), "%s\n", msg ); | |||
1696 | exit( YY_EXIT_FAILURE2 ); | |||
1697 | } | |||
1698 | ||||
1699 | /* Redefine yyless() so it works in section 3 code. */ | |||
1700 | ||||
1701 | #undef yyless | |||
1702 | #define yyless(n)do { int yyless_macro_arg = (n); do { int yyl; for ( yyl = yyless_macro_arg ; yyl < kvleng; ++yyl ) if ( kvtext[yyl] == '\n' ) --kvlineno ; }while(0); kvtext[kvleng] = (yy_hold_char); (yy_c_buf_p) = kvtext + yyless_macro_arg; (yy_hold_char) = *(yy_c_buf_p); *(yy_c_buf_p ) = '\0'; kvleng = yyless_macro_arg; } while ( 0 ) \ | |||
1703 | do \ | |||
1704 | { \ | |||
1705 | /* Undo effects of setting up kvtext. */ \ | |||
1706 | int yyless_macro_arg = (n); \ | |||
1707 | YY_LESS_LINENO(yyless_macro_arg)do { int yyl; for ( yyl = yyless_macro_arg; yyl < kvleng; ++ yyl ) if ( kvtext[yyl] == '\n' ) --kvlineno; }while(0);\ | |||
1708 | kvtext[kvleng] = (yy_hold_char); \ | |||
1709 | (yy_c_buf_p) = kvtext + yyless_macro_arg; \ | |||
1710 | (yy_hold_char) = *(yy_c_buf_p); \ | |||
1711 | *(yy_c_buf_p) = '\0'; \ | |||
1712 | kvleng = yyless_macro_arg; \ | |||
1713 | } \ | |||
1714 | while ( 0 ) | |||
1715 | ||||
1716 | /* Accessor methods (get/set functions) to struct members. */ | |||
1717 | ||||
1718 | /** Get the current line number. | |||
1719 | * | |||
1720 | */ | |||
1721 | int kvget_lineno (void) | |||
1722 | { | |||
1723 | ||||
1724 | return kvlineno; | |||
1725 | } | |||
1726 | ||||
1727 | /** Get the input stream. | |||
1728 | * | |||
1729 | */ | |||
1730 | FILE *kvget_in (void) | |||
1731 | { | |||
1732 | return kvin; | |||
1733 | } | |||
1734 | ||||
1735 | /** Get the output stream. | |||
1736 | * | |||
1737 | */ | |||
1738 | FILE *kvget_out (void) | |||
1739 | { | |||
1740 | return kvout; | |||
1741 | } | |||
1742 | ||||
1743 | /** Get the length of the current token. | |||
1744 | * | |||
1745 | */ | |||
1746 | yy_size_t kvget_leng (void) | |||
1747 | { | |||
1748 | return kvleng; | |||
1749 | } | |||
1750 | ||||
1751 | /** Get the current token. | |||
1752 | * | |||
1753 | */ | |||
1754 | ||||
1755 | char *kvget_text (void) | |||
1756 | { | |||
1757 | return kvtext; | |||
1758 | } | |||
1759 | ||||
1760 | /** Set the current line number. | |||
1761 | * @param line_number | |||
1762 | * | |||
1763 | */ | |||
1764 | void kvset_lineno (int line_number ) | |||
1765 | { | |||
1766 | ||||
1767 | kvlineno = line_number; | |||
1768 | } | |||
1769 | ||||
1770 | /** Set the input stream. This does not discard the current | |||
1771 | * input buffer. | |||
1772 | * @param in_str A readable stream. | |||
1773 | * | |||
1774 | * @see kv_switch_to_buffer | |||
1775 | */ | |||
1776 | void kvset_in (FILE * in_str ) | |||
1777 | { | |||
1778 | kvin = in_str ; | |||
1779 | } | |||
1780 | ||||
1781 | void kvset_out (FILE * out_str ) | |||
1782 | { | |||
1783 | kvout = out_str ; | |||
1784 | } | |||
1785 | ||||
1786 | int kvget_debug (void) | |||
1787 | { | |||
1788 | return kv_flex_debug; | |||
1789 | } | |||
1790 | ||||
1791 | void kvset_debug (int bdebug ) | |||
1792 | { | |||
1793 | kv_flex_debug = bdebug ; | |||
1794 | } | |||
1795 | ||||
1796 | static int yy_init_globals (void) | |||
1797 | { | |||
1798 | /* Initialization is the same as for the non-reentrant scanner. | |||
1799 | * This function is called from kvlex_destroy(), so don't allocate here. | |||
1800 | */ | |||
1801 | ||||
1802 | /* We do not touch kvlineno unless the option is enabled. */ | |||
1803 | kvlineno = 1; | |||
1804 | ||||
1805 | (yy_buffer_stack) = 0; | |||
1806 | (yy_buffer_stack_top) = 0; | |||
1807 | (yy_buffer_stack_max) = 0; | |||
1808 | (yy_c_buf_p) = (char *) 0; | |||
1809 | (yy_init) = 0; | |||
1810 | (yy_start) = 0; | |||
1811 | ||||
1812 | (yy_state_buf) = 0; | |||
1813 | (yy_state_ptr) = 0; | |||
1814 | (yy_full_match) = 0; | |||
1815 | (yy_lp) = 0; | |||
1816 | ||||
1817 | /* Defined in main.c */ | |||
1818 | #ifdef YY_STDINIT | |||
1819 | kvin = stdin(&__sF[0]); | |||
1820 | kvout = stdout(&__sF[1]); | |||
1821 | #else | |||
1822 | kvin = (FILE *) 0; | |||
1823 | kvout = (FILE *) 0; | |||
1824 | #endif | |||
1825 | ||||
1826 | /* For future reference: Set errno on error, since we are called by | |||
1827 | * kvlex_init() | |||
1828 | */ | |||
1829 | return 0; | |||
1830 | } | |||
1831 | ||||
1832 | /* kvlex_destroy is for both reentrant and non-reentrant scanners. */ | |||
1833 | int kvlex_destroy (void) | |||
1834 | { | |||
1835 | ||||
1836 | /* Pop the buffer stack, destroying each element. */ | |||
1837 | while(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0))){ | |||
1838 | kv_delete_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top) ] : ((void *)0)) ); | |||
1839 | YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = NULL((void *)0); | |||
1840 | kvpop_buffer_state(); | |||
1841 | } | |||
1842 | ||||
1843 | /* Destroy the stack itself. */ | |||
1844 | kvfree((yy_buffer_stack) ); | |||
1845 | (yy_buffer_stack) = NULL((void *)0); | |||
1846 | ||||
1847 | kvfree ( (yy_state_buf) ); | |||
1848 | (yy_state_buf) = NULL((void *)0); | |||
1849 | ||||
1850 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | |||
1851 | * kvlex() is called, initialization will occur. */ | |||
1852 | yy_init_globals( ); | |||
1853 | ||||
1854 | return 0; | |||
1855 | } | |||
1856 | ||||
1857 | /* | |||
1858 | * Internal utility routines. | |||
1859 | */ | |||
1860 | ||||
1861 | #ifndef yytext_ptrkvtext | |||
1862 | static void yy_flex_strncpy (char* s1, yyconstconst char * s2, int n ) | |||
1863 | { | |||
1864 | int i; | |||
1865 | for ( i = 0; i < n; ++i ) | |||
1866 | s1[i] = s2[i]; | |||
1867 | } | |||
1868 | #endif | |||
1869 | ||||
1870 | #ifdef YY_NEED_STRLEN | |||
1871 | static int yy_flex_strlen (yyconstconst char * s ) | |||
1872 | { | |||
1873 | int n; | |||
1874 | for ( n = 0; s[n]; ++n ) | |||
1875 | ; | |||
1876 | ||||
1877 | return n; | |||
1878 | } | |||
1879 | #endif | |||
1880 | ||||
1881 | void *kvalloc (yy_size_t size ) | |||
1882 | { | |||
1883 | return (void *) malloc( size ); | |||
1884 | } | |||
1885 | ||||
1886 | void *kvrealloc (void * ptr, yy_size_t size ) | |||
1887 | { | |||
1888 | /* The cast to (char *) in the following accommodates both | |||
1889 | * implementations that use char* generic pointers, and those | |||
1890 | * that use void* generic pointers. It works with the latter | |||
1891 | * because both ANSI C and C++ allow castless assignment from | |||
1892 | * any pointer type to void*, and deal with argument conversions | |||
1893 | * as though doing an assignment. | |||
1894 | */ | |||
1895 | return (void *) realloc( (char *) ptr, size ); | |||
1896 | } | |||
1897 | ||||
1898 | void kvfree (void * ptr ) | |||
1899 | { | |||
1900 | free( (char *) ptr ); /* see kvrealloc() for (char *) cast */ | |||
1901 | } | |||
1902 | ||||
1903 | #define YYTABLES_NAME"yytables" "yytables" | |||
1904 | ||||
1905 | #line 76 "/usr/src/usr.bin/keynote/../../lib/libkeynote/keynote-ver.l" | |||
1906 | ||||
1907 | ||||
1908 | ||||
1909 | /* | |||
1910 | * Return RESULT_TRUE if character is octal digit, RESULT_FALSE otherwise. | |||
1911 | */ | |||
1912 | static int | |||
1913 | is_octal(char c) | |||
1914 | { | |||
1915 | switch (c) | |||
1916 | { | |||
1917 | case '0': case '1': case '2': case '3': | |||
1918 | case '4': case '5': case '6': case '7': | |||
1919 | return RESULT_TRUE1; | |||
1920 | ||||
1921 | default: | |||
1922 | return RESULT_FALSE0; | |||
1923 | } | |||
1924 | } | |||
1925 | ||||
1926 | /* | |||
1927 | * Return octal value (non-zero) if argument starts with such a | |||
1928 | * representation, otherwise 0. | |||
1929 | */ | |||
1930 | static unsigned char | |||
1931 | get_octal(char *s, int len, int *adv) | |||
1932 | { | |||
1933 | unsigned char res = 0; | |||
1934 | ||||
1935 | if (*s == '0') | |||
1936 | { | |||
1937 | if (len > 0) | |||
1938 | { | |||
1939 | if (is_octal(*(s + 1))) | |||
1940 | { | |||
1941 | res = *(s + 1) - '0'; | |||
1942 | *adv = 2; | |||
1943 | ||||
1944 | if (is_octal(*(s + 2)) && (len - 1 > 0)) | |||
1945 | { | |||
1946 | res = res * 8 + (*(s + 2) - '0'); | |||
1947 | *adv = 3; | |||
1948 | } | |||
1949 | } | |||
1950 | } | |||
1951 | } | |||
1952 | else | |||
1953 | if (is_octal(*s) && (len - 1 > 0)) /* Non-zero leading */ | |||
1954 | { | |||
1955 | if (is_octal(*(s + 1)) && | |||
1956 | is_octal(*(s + 2))) | |||
1957 | { | |||
1958 | *adv = 3; | |||
1959 | res = (((*s) - '0') * 64) + | |||
1960 | (((*(s + 1)) - '0') * 8) + | |||
1961 | ((*(s + 2)) - '0'); | |||
1962 | } | |||
1963 | } | |||
1964 | ||||
1965 | return res; | |||
1966 | } | |||
1967 | ||||
1968 | /* | |||
1969 | * Copy at most len characters to string s1 from string s2, taking | |||
1970 | * care of escaped characters in the process. String s1 is assumed | |||
1971 | * to have enough space, and be zero'ed. | |||
1972 | */ | |||
1973 | void | |||
1974 | mystrncpy(char *s1, char *s2, int len) | |||
1975 | { | |||
1976 | unsigned char c; | |||
1977 | int advance; | |||
1978 | ||||
1979 | if (len == 0) | |||
1980 | return; | |||
1981 | ||||
1982 | while (len-- > 0) | |||
1983 | { | |||
1984 | if (*s2 == '\\') | |||
1985 | { | |||
1986 | s2++; | |||
1987 | ||||
1988 | if (len-- <= 0) | |||
1989 | break; | |||
1990 | ||||
1991 | if (*s2 == '\n') | |||
1992 | { | |||
1993 | while (isspace((unsigned char)*(++s2)) && (len-- > 0)) | |||
1994 | ; | |||
1995 | } | |||
1996 | else | |||
1997 | if ((c = get_octal(s2, len, &advance)) != 0) | |||
1998 | { | |||
1999 | len -= advance - 1; | |||
2000 | s2 += advance; | |||
2001 | *s1++ = c; | |||
2002 | } | |||
2003 | else | |||
2004 | if (*s2 == 'n') /* Newline */ | |||
2005 | { | |||
2006 | *s1++ = '\n'; | |||
2007 | s2++; | |||
2008 | } | |||
2009 | else | |||
2010 | if (*s2 == 't') /* Tab */ | |||
2011 | { | |||
2012 | *s1++ = '\t'; | |||
2013 | s2++; | |||
2014 | } | |||
2015 | else | |||
2016 | if (*s2 == 'r') /* Linefeed */ | |||
2017 | { | |||
2018 | *s1++ = '\r'; | |||
2019 | s2++; | |||
2020 | } | |||
2021 | else | |||
2022 | if (*s2 == 'f') /* Formfeed */ | |||
2023 | { | |||
2024 | *s1++ = '\f'; | |||
2025 | s2++; | |||
2026 | } | |||
2027 | else | |||
2028 | if ((*s1++ = *s2++) == 0) | |||
2029 | break; | |||
2030 | ||||
2031 | continue; | |||
2032 | } | |||
2033 | ||||
2034 | if ((*s1++ = *s2++) == 0) | |||
2035 | break; | |||
2036 | } | |||
2037 | } | |||
2038 | ||||
2039 | /* | |||
2040 | * Parse a file that contains environment variable/value pairs. | |||
2041 | * Return -1 on failure. | |||
2042 | */ | |||
2043 | int | |||
2044 | read_environment(char *filename) | |||
2045 | { | |||
2046 | YY_BUFFER_STATE kvfoo; | |||
2047 | FILE *fp; | |||
2048 | int i; | |||
2049 | ||||
2050 | if ((fp = fopen(filename, "r")) == NULL((void *)0)) { | |||
2051 | perror(filename); | |||
2052 | return -1; | |||
2053 | } | |||
2054 | ||||
2055 | kvfoo = kv_create_buffer(fp, YY_BUF_SIZE16384); | |||
2056 | kv_switch_to_buffer(kvfoo); | |||
2057 | BEGIN(yy_start) = 1 + 2 *(FIRSTPART1); | |||
2058 | i = kvparse(); | |||
2059 | kv_delete_buffer(kvfoo); | |||
2060 | fclose(fp); | |||
2061 | switch (i) | |||
2062 | { | |||
2063 | case 0: | |||
2064 | return 0; | |||
2065 | ||||
2066 | default: | |||
2067 | if (keynote_errno == ERROR_MEMORY-1) | |||
2068 | fprintf(stderr(&__sF[2]), | |||
2069 | "Memory error while processing environment file <%s>\n", | |||
2070 | filename); | |||
2071 | else | |||
2072 | fprintf(stderr(&__sF[2]), | |||
2073 | "Syntax error in environment file <%s>, line %d\n", | |||
2074 | filename, kvlineno); | |||
2075 | return -1; | |||
2076 | } | |||
2077 | ||||
2078 | /* Used to avoid compiler (-Wall) warnings. Never reached */ | |||
2079 | if (0) | |||
2080 | { | |||
2081 | yyunput(0, NULL((void *)0)); | |||
2082 | } | |||
2083 | } | |||
2084 | ||||
2085 | /* | |||
2086 | * Parse a key. | |||
2087 | */ | |||
2088 | void | |||
2089 | parse_key(char *buf) | |||
2090 | { | |||
2091 | YY_BUFFER_STATE key_state; | |||
2092 | int err; | |||
2093 | ||||
2094 | key_state = kv_scan_string(buf); | |||
2095 | BEGIN(yy_start) = 1 + 2 *(KEYSTATE4); | |||
2096 | err = kvparse(); | |||
2097 | kv_delete_buffer(key_state); | |||
2098 | ||||
2099 | if (err != 0) | |||
2100 | if (keynote_errno == 0) | |||
2101 | keynote_errno = ERROR_SYNTAX-2; | |||
2102 | } | |||
2103 |