Bug Summary

File:src/lib/libkeynote/obj/lex.kn.c
Warning:line 1194, column 4
Assigned value is garbage or undefined

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name lex.kn.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/lib/libkeynote/obj -resource-dir /usr/local/lib/clang/13.0.0 -I . -I /usr/src/lib/libkeynote -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/lib/libkeynote/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c lex.kn.c
1
2#line 3 "lex.kn.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_bufferkn_create_buffer kn_create_buffer
11#define yy_delete_bufferkn_delete_buffer kn_delete_buffer
12#define yy_flex_debugkn_flex_debug kn_flex_debug
13#define yy_init_bufferkn_init_buffer kn_init_buffer
14#define yy_flush_bufferkn_flush_buffer kn_flush_buffer
15#define yy_load_buffer_statekn_load_buffer_state kn_load_buffer_state
16#define yy_switch_to_bufferkn_switch_to_buffer kn_switch_to_buffer
17#define yyinknin knin
18#define yylengknleng knleng
19#define yylexknlex knlex
20#define yylinenoknlineno knlineno
21#define yyoutknout knout
22#define yyrestartknrestart knrestart
23#define yytextkntext kntext
24#define yywrapknwrap knwrap
25#define yyallocknalloc knalloc
26#define yyreallocknrealloc knrealloc
27#define yyfreeknfree knfree
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>
66typedef int8_t flex_int8_t;
67typedef uint8_t flex_uint8_t;
68typedef int16_t flex_int16_t;
69typedef uint16_t flex_uint16_t;
70typedef int32_t flex_int32_t;
71typedef uint32_t flex_uint32_t;
72#else
73typedef signed char flex_int8_t;
74typedef short int flex_int16_t;
75typedef int flex_int32_t;
76typedef unsigned char flex_uint8_t;
77typedef unsigned short int flex_uint16_t;
78typedef 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)(41 + state + 1) (YY_END_OF_BUFFER41 + state + 1)
159
160/* Special action meaning "start processing a new file". */
161#define YY_NEW_FILEknrestart(knin ) knrestart(knin )
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
176typedef struct yy_buffer_state *YY_BUFFER_STATE;
177#endif
178
179#ifndef YY_TYPEDEF_YY_SIZE_T
180#define YY_TYPEDEF_YY_SIZE_T
181typedef size_t yy_size_t;
182#endif
183
184extern yy_size_t knleng;
185
186extern FILE *knin, *knout;
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 knlex.
195 * One obvious solution it to make yy_act a global. I tried that, and saw
196 * a 5% performance hit in a non-knlineno 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 < knleng; ++yyl ) if ( kntext
[yyl] == '\n' ) --knlineno; }while(0)
\
200 do { \
201 int yyl;\
202 for ( yyl = n; yyl < knleng; ++yyl )\
203 if ( kntext[yyl] == '\n' )\
204 --knlineno;\
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' ) --knlineno; }while(0)
\
207 do {\
208 const char *p;\
209 for ( p = yy_cp-1; p >= (dst); --p)\
210 if ( *p == '\n' )\
211 --knlineno;\
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 < knleng; ++yyl ) if ( kntext[yyl] == '\n' ) --knlineno
; }while(0); kntext[knleng] = (yy_hold_char); (yy_c_buf_p) = kntext
+ yyless_macro_arg; (yy_hold_char) = *(yy_c_buf_p); *(yy_c_buf_p
) = '\0'; knleng = yyless_macro_arg; } while ( 0 )
\
216 do \
217 { \
218 /* Undo effects of setting up kntext. */ \
219 int yyless_macro_arg = (n); \
220 YY_LESS_LINENO(yyless_macro_arg)do { int yyl; for ( yyl = yyless_macro_arg; yyl < knleng; ++
yyl ) if ( kntext[yyl] == '\n' ) --knlineno; }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(kntext) = yy_bp; knleng = (size_t) (yy_cp - yy_bp); (yy_hold_char
) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp;
; /* set up kntext again */ \
225 } \
226 while ( 0 )
227
228#define unput(c)yyunput( c, (kntext) ) yyunput( c, (yytext_ptrkntext) )
229
230#ifndef YY_STRUCT_YY_BUFFER_STATE
231#define YY_STRUCT_YY_BUFFER_STATE
232struct 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 knrestart()), so that the user can continue scanning by
288 * just pointing knin 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. */
296static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
297static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
298static 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 kntext is formed. */
316static char yy_hold_char;
317static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
318yy_size_t knleng;
319
320/* Points to current character in buffer. */
321static char *yy_c_buf_p = (char *) 0;
322static int yy_init = 0; /* whether we need to initialize */
323static int yy_start = 0; /* start state number */
324
325/* Flag which is used to allow knwrap()'s to do buffer switches
326 * instead of setting up a fresh knin. A bit of a hack ...
327 */
328static int yy_did_buffer_switch_on_eof;
329
330void knrestart (FILE *input_file );
331void kn_switch_to_buffer (YY_BUFFER_STATE new_buffer );
332YY_BUFFER_STATE kn_create_buffer (FILE *file,int size );
333void kn_delete_buffer (YY_BUFFER_STATE b );
334void kn_flush_buffer (YY_BUFFER_STATE b );
335void knpush_buffer_state (YY_BUFFER_STATE new_buffer );
336void knpop_buffer_state (void );
337
338static void knensure_buffer_stack (void );
339static void kn_load_buffer_state (void );
340static void kn_init_buffer (YY_BUFFER_STATE b,FILE *file );
341
342#define YY_FLUSH_BUFFERkn_flush_buffer(( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top
)] : ((void *)0)) )
kn_flush_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
)
343
344YY_BUFFER_STATE kn_scan_buffer (char *base,yy_size_t size );
345YY_BUFFER_STATE kn_scan_string (yyconstconst char *yy_str );
346YY_BUFFER_STATE kn_scan_bytes (yyconstconst char *bytes,yy_size_t len );
347
348void *knalloc (yy_size_t );
349void *knrealloc (void *,yy_size_t );
350void knfree (void * );
351
352#define yy_new_bufferkn_create_buffer kn_create_buffer
353
354#define yy_set_interactive(is_interactive){ if ( ! ( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top
)] : ((void *)0)) ){ knensure_buffer_stack (); (yy_buffer_stack
)[(yy_buffer_stack_top)] = kn_create_buffer(knin,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 knensure_buffer_stack (); \
358 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = \
359 kn_create_buffer(knin,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)) ){ knensure_buffer_stack (); (yy_buffer_stack
)[(yy_buffer_stack_top)] = kn_create_buffer(knin,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 knensure_buffer_stack (); \
368 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = \
369 kn_create_buffer(knin,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 knwrap()1 1
379#define YY_SKIP_YYWRAP
380
381typedef unsigned char YY_CHAR;
382
383FILE *knin = (FILE *) 0, *knout = (FILE *) 0;
384
385typedef int yy_state_type;
386
387extern int knlineno;
388
389int knlineno = 1;
390
391extern char *kntext;
392#define yytext_ptrkntext kntext
393
394static yy_state_type yy_get_previous_state (void );
395static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
396static int yy_get_next_buffer (void );
397static 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 kntext.
401 */
402#define YY_DO_BEFORE_ACTION(kntext) = yy_bp; knleng = (size_t) (yy_cp - yy_bp); (yy_hold_char
) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp;
\
403 (yytext_ptrkntext) = yy_bp; \
404 knleng = (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_RULES40 40
410#define YY_END_OF_BUFFER41 41
411/* This struct is not used in this scanner,
412 but its presence is necessary. */
413struct yy_trans_info
414 {
415 flex_int32_t yy_verify;
416 flex_int32_t yy_nxt;
417 };
418static yyconstconst flex_int16_t yy_acclist[123] =
419 { 0,
420 41, 39, 40, 38, 39, 40, 38, 40, 39, 40,
421 27, 39, 40, 31, 39, 40, 24, 39, 40, 11,
422 39, 40, 22, 39, 40, 33, 39, 40, 2, 39,
423 40, 3, 39, 40, 20, 39, 40, 6, 39, 40,
424 19, 39, 40, 21, 39, 40, 36, 39, 40, 10,
425 39, 40, 15, 39, 40, 39, 40, 16, 39, 40,
426 32, 39, 40, 30, 39, 40, 30, 39, 40, 30,
427 39, 40, 23, 39, 40, 8, 39, 40, 39, 40,
428 9, 39, 40, 39, 40, 28, 39, 40, 39, 40,
429 29, 39, 40, 39, 40, 35, 39, 40, 37, 27,
430
431 14, 4, 7, 36, 17, 13, 18, 30, 30, 30,
432 5, 12, 35, 34, 30, 30, 30, 25, 30, 1,
433 26, 30
434 } ;
435
436static yyconstconst flex_int16_t yy_accept[79] =
437 { 0,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 2, 4, 7, 9, 11, 14, 17,
440 20, 23, 26, 29, 32, 35, 38, 41, 44, 47,
441 50, 53, 56, 58, 61, 64, 67, 70, 73, 76,
442 79, 81, 84, 86, 89, 91, 94, 96, 99, 99,
443 100, 100, 101, 102, 103, 104, 104, 105, 106, 107,
444 108, 109, 110, 111, 112, 113, 113, 113, 114, 115,
445 116, 117, 117, 118, 120, 121, 123, 123
446 } ;
447
448static yyconstconst flex_int16_t yy_base[82] =
449 { 0,
450 0, 5, 43, 0, 137, 195, 289, 380, 438, 496,
451 13, 346, 203, 1463, 1463, 1463, 9, 0, 1463, 1463,
452 139, 1463, 145, 1463, 1463, 1463, 1463, 119, 1463, 160,
453 1463, 115, 75, 74, 1463, 0, 9, 57, 1463, 1463,
454 10, 1463, 10, 1463, 0, 1463, 219, 250, 138, 1463,
455 1, 0, 1463, 1463, 1463, 312, 403, 1463, 1463, 1463,
456 0, 97, 110, 1463, 1463, 123, 462, 519, 551, 143,
457 208, 208, 211, 0, 1463, 0, 1463, 622, 877, 1132,
458 1340
459 } ;
460
461static yyconstconst flex_int16_t yy_def[82] =
462 { 0,
463 78, 78, 78, 3, 3, 3, 3, 3, 3, 3,
464 78, 78, 77, 77, 77, 77, 79, 80, 77, 77,
465 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
466 77, 77, 77, 77, 77, 81, 81, 81, 77, 77,
467 77, 77, 77, 77, 77, 77, 77, 77, 79, 77,
468 79, 80, 77, 77, 77, 77, 77, 77, 77, 77,
469 81, 81, 81, 77, 77, 77, 77, 77, 77, 81,
470 81, 77, 81, 81, 77, 81, 0, 77, 77, 77,
471 77
472 } ;
473
474static yyconstconst flex_int16_t yy_nxt[1720] =
475 { 0,
476 77, 77, 77, 77, 77, 77, 77, 77, 15, 16,
477 49, 77, 77, 15, 16, 77, 77, 77, 77, 77,
478 77, 15, 16, 77, 77, 77, 77, 77, 77, 77,
479 77, 15, 77, 17, 18, 19, 15, 54, 17, 18,
480 19, 77, 50, 77, 15, 20, 17, 18, 19, 77,
481 20, 15, 16, 77, 77, 77, 77, 77, 20, 77,
482 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
483 65, 77, 77, 62, 15, 21, 17, 18, 19, 22,
484 23, 77, 24, 25, 26, 27, 77, 28, 20, 29,
485 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
486
487 51, 31, 32, 33, 34, 62, 35, 36, 36, 36,
488 36, 36, 37, 36, 36, 36, 36, 36, 36, 36,
489 36, 36, 36, 36, 36, 36, 38, 36, 36, 36,
490 36, 36, 36, 64, 60, 59, 39, 36, 63, 36,
491 36, 36, 36, 36, 37, 36, 36, 36, 36, 36,
492 36, 36, 36, 36, 36, 36, 36, 36, 38, 36,
493 36, 36, 36, 36, 36, 40, 41, 42, 43, 14,
494 63, 50, 70, 14, 14, 58, 14, 14, 14, 14,
495 55, 14, 54, 14, 14, 14, 14, 14, 14, 14,
496 14, 14, 14, 14, 71, 14, 14, 44, 14, 53,
497
498 14, 72, 77, 77, 70, 56, 36, 57, 57, 57,
499 57, 57, 57, 57, 57, 57, 57, 77, 77, 77,
500 36, 77, 77, 77, 77, 73, 71, 14, 77, 51,
501 14, 14, 14, 72, 14, 14, 14, 14, 36, 14,
502 77, 14, 14, 14, 14, 14, 14, 14, 14, 14,
503 14, 14, 36, 14, 14, 44, 14, 73, 14, 14,
504 14, 14, 14, 66, 36, 77, 67, 67, 67, 67,
505 67, 67, 67, 67, 67, 67, 74, 75, 36, 76,
506 77, 77, 77, 77, 77, 77, 77, 77, 14, 77,
507 77, 77, 77, 77, 77, 77, 36, 68, 68, 68,
508
509 68, 68, 68, 68, 68, 68, 68, 77, 74, 75,
510 36, 76, 77, 77, 77, 77, 77, 14, 14, 14,
511 14, 14, 77, 77, 77, 14, 45, 77, 77, 77,
512 14, 14, 46, 14, 77, 14, 14, 47, 47, 47,
513 47, 47, 47, 47, 47, 47, 77, 14, 14, 14,
514 14, 77, 14, 77, 15, 16, 77, 77, 36, 69,
515 69, 69, 69, 69, 69, 69, 69, 69, 69, 77,
516 77, 77, 36, 77, 77, 77, 77, 15, 77, 17,
517 18, 19, 14, 77, 77, 77, 77, 77, 77, 77,
518 36, 20, 77, 48, 48, 48, 48, 48, 48, 48,
519
520 48, 48, 48, 77, 36, 77, 77, 77, 77, 77,
521 77, 14, 14, 14, 14, 77, 14, 45, 77, 77,
522 77, 14, 14, 46, 14, 77, 14, 14, 47, 47,
523 47, 47, 47, 47, 47, 47, 47, 77, 14, 14,
524 14, 14, 77, 14, 77, 77, 77, 77, 56, 36,
525 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
526 77, 77, 77, 36, 77, 77, 77, 77, 77, 77,
527 14, 77, 77, 14, 14, 14, 77, 14, 14, 14,
528 14, 36, 14, 77, 14, 14, 14, 14, 14, 14,
529 14, 14, 14, 14, 14, 36, 14, 14, 14, 14,
530
531 77, 14, 14, 77, 14, 14, 66, 36, 77, 67,
532 67, 67, 67, 67, 67, 67, 67, 67, 67, 77,
533 77, 36, 77, 77, 77, 77, 77, 77, 14, 77,
534 77, 14, 14, 14, 77, 14, 14, 14, 14, 36,
535 14, 77, 14, 14, 14, 14, 14, 14, 14, 14,
536 14, 14, 14, 36, 14, 14, 14, 14, 77, 14,
537 14, 14, 14, 14, 77, 36, 68, 68, 68, 68,
538 68, 68, 68, 68, 68, 68, 77, 77, 77, 36,
539 77, 77, 77, 77, 77, 77, 77, 77, 77, 14,
540 77, 77, 77, 77, 77, 77, 77, 36, 69, 69,
541
542 69, 69, 69, 69, 69, 69, 69, 69, 77, 77,
543 77, 36, 77, 77, 77, 77, 77, 77, 14, 14,
544 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
545 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
546 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
547 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
548 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
549 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
550 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
551 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
552
553 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
554 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
555 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
556 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
557 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
558 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
559 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
560 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
561 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
562 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
563
564 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
565 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
566 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
567 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
568 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
569 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
570 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
571 14, 14, 14, 14, 14, 14, 14, 49, 49, 49,
572 49, 49, 49, 49, 49, 49, 77, 49, 49, 49,
573 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
574
575 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
576 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
577 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
578 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
579 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
580 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
581 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
582 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
583 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
584 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
585
586 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
587 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
588 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
589 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
590 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
591 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
592 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
593 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
594 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
595 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
596
597 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
598 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
599 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
600 49, 49, 52, 52, 52, 52, 52, 52, 52, 52,
601 52, 77, 52, 52, 52, 52, 52, 52, 52, 52,
602 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
603 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
604 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
605 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
606 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
607
608 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
609 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
610 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
611 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
612 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
613 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
614 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
615 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
616 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
617 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
618
619 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
620 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
621 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
622 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
623 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
624 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
625 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
626 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
627 52, 52, 52, 52, 52, 52, 52, 61, 61, 61,
628 61, 61, 61, 61, 61, 61, 61, 77, 77, 77,
629
630 77, 77, 77, 77, 61, 61, 61, 61, 61, 61,
631 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
632 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
633 77, 77, 77, 77, 61, 77, 61, 61, 61, 61,
634 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
635 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
636 61, 61, 13, 77, 77, 77, 77, 77, 77, 77,
637 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
638 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
639 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
640
641 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
642 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
643 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
644 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
645 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
646 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
647 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
648 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
649 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
650 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
651
652 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
653 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
654 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
655 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
656 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
657 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
658 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
659 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
660 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
661 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
662
663 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
664 77, 77, 77, 77, 77, 77, 77, 77, 77
665 } ;
666
667static yyconstconst flex_int16_t yy_chk[1720] =
668 { 0,
669 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
670 51, 0, 0, 2, 2, 0, 0, 0, 0, 0,
671 0, 11, 11, 0, 0, 0, 0, 0, 0, 0,
672 0, 1, 0, 1, 1, 1, 2, 45, 2, 2,
673 2, 0, 17, 0, 11, 1, 11, 11, 11, 0,
674 2, 3, 3, 0, 0, 0, 0, 0, 11, 0,
675 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
676 43, 0, 0, 37, 3, 3, 3, 3, 3, 3,
677 3, 0, 3, 3, 3, 3, 0, 3, 3, 3,
678 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
679
680 17, 3, 3, 3, 3, 37, 3, 3, 3, 3,
681 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
682 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
683 3, 3, 3, 41, 34, 33, 3, 3, 38, 3,
684 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
685 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
686 3, 3, 3, 3, 3, 3, 3, 3, 3, 5,
687 38, 49, 62, 5, 5, 32, 5, 5, 5, 5,
688 28, 5, 23, 5, 5, 5, 5, 5, 5, 5,
689 5, 5, 5, 5, 63, 5, 5, 5, 5, 21,
690
691 5, 66, 13, 0, 62, 30, 5, 30, 30, 30,
692 30, 30, 30, 30, 30, 30, 30, 0, 0, 0,
693 5, 0, 0, 0, 0, 70, 63, 6, 0, 49,
694 5, 6, 6, 66, 6, 6, 6, 6, 5, 6,
695 0, 6, 6, 6, 6, 6, 6, 6, 6, 6,
696 6, 6, 5, 6, 6, 6, 6, 70, 6, 5,
697 5, 5, 5, 47, 6, 0, 47, 47, 47, 47,
698 47, 47, 47, 47, 47, 47, 71, 72, 6, 73,
699 0, 0, 0, 0, 0, 0, 0, 0, 6, 0,
700 0, 0, 0, 0, 0, 0, 6, 48, 48, 48,
701
702 48, 48, 48, 48, 48, 48, 48, 0, 71, 72,
703 6, 73, 0, 0, 0, 0, 0, 6, 6, 6,
704 6, 7, 0, 0, 0, 7, 7, 0, 0, 0,
705 7, 7, 7, 7, 0, 7, 7, 7, 7, 7,
706 7, 7, 7, 7, 7, 7, 0, 7, 7, 7,
707 7, 0, 7, 0, 12, 12, 0, 0, 7, 56,
708 56, 56, 56, 56, 56, 56, 56, 56, 56, 0,
709 0, 0, 7, 0, 0, 0, 0, 12, 0, 12,
710 12, 12, 7, 0, 0, 0, 0, 0, 0, 0,
711 7, 12, 0, 12, 12, 12, 12, 12, 12, 12,
712
713 12, 12, 12, 0, 7, 0, 0, 0, 0, 0,
714 0, 7, 8, 7, 7, 0, 8, 8, 0, 0,
715 0, 8, 8, 8, 8, 0, 8, 8, 8, 8,
716 8, 8, 8, 8, 8, 8, 8, 0, 8, 8,
717 8, 8, 0, 8, 0, 0, 0, 0, 57, 8,
718 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
719 0, 0, 0, 8, 0, 0, 0, 0, 0, 0,
720 9, 0, 0, 8, 9, 9, 0, 9, 9, 9,
721 9, 8, 9, 0, 9, 9, 9, 9, 9, 9,
722 9, 9, 9, 9, 9, 8, 9, 9, 9, 9,
723
724 0, 9, 8, 0, 8, 8, 67, 9, 0, 67,
725 67, 67, 67, 67, 67, 67, 67, 67, 67, 0,
726 0, 9, 0, 0, 0, 0, 0, 0, 10, 0,
727 0, 9, 10, 10, 0, 10, 10, 10, 10, 9,
728 10, 0, 10, 10, 10, 10, 10, 10, 10, 10,
729 10, 10, 10, 9, 10, 10, 10, 10, 0, 10,
730 9, 9, 9, 9, 0, 10, 68, 68, 68, 68,
731 68, 68, 68, 68, 68, 68, 0, 0, 0, 10,
732 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
733 0, 0, 0, 0, 0, 0, 0, 10, 69, 69,
734
735 69, 69, 69, 69, 69, 69, 69, 69, 0, 0,
736 0, 10, 0, 0, 0, 0, 0, 0, 10, 10,
737 10, 10, 78, 78, 78, 78, 78, 78, 78, 78,
738 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
739 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
740 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
741 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
742 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
743 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
744 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
745
746 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
747 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
748 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
749 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
750 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
751 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
752 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
753 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
754 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
755 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
756
757 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
758 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
759 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
760 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
761 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
762 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
763 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
764 78, 78, 78, 78, 78, 78, 78, 79, 79, 79,
765 79, 79, 79, 79, 79, 79, 0, 79, 79, 79,
766 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
767
768 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
769 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
770 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
771 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
772 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
773 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
774 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
775 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
776 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
777 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
778
779 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
780 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
781 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
782 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
783 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
784 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
785 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
786 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
787 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
788 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
789
790 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
791 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
792 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
793 79, 79, 80, 80, 80, 80, 80, 80, 80, 80,
794 80, 0, 80, 80, 80, 80, 80, 80, 80, 80,
795 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
796 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
797 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
798 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
799 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
800
801 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
802 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
803 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
804 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
805 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
806 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
807 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
808 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
809 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
810 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
811
812 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
813 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
814 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
815 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
816 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
817 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
818 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
819 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
820 80, 80, 80, 80, 80, 80, 80, 81, 81, 81,
821 81, 81, 81, 81, 81, 81, 81, 0, 0, 0,
822
823 0, 0, 0, 0, 81, 81, 81, 81, 81, 81,
824 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
825 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
826 0, 0, 0, 0, 81, 0, 81, 81, 81, 81,
827 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
828 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
829 81, 81, 77, 77, 77, 77, 77, 77, 77, 77,
830 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
831 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
832 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
833
834 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
835 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
836 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
837 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
838 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
839 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
840 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
841 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
842 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
843 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
844
845 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
846 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
847 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
848 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
849 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
850 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
851 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
852 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
853 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
854 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
855
856 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
857 77, 77, 77, 77, 77, 77, 77, 77, 77
858 } ;
859
860/* Table of booleans, true if rule could match eol. */
861static yyconstconst flex_int32_t yy_rule_can_match_eol[41] =
862 { 0,
8630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
864 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
865 0, };
866
867static yyconstconst yy_state_type yy_NUL_trans[77] =
868 { 0,
869 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
870 14, 14, 0, 0, 0, 0, 49, 52, 0, 0,
871 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
872 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
873 0, 0, 0, 0, 0, 0, 0, 0, 49, 0,
874 49, 52, 0, 0, 0, 0, 0, 0, 0, 0,
875 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
876 0, 0, 0, 0, 0, 0
877 } ;
878
879extern int kn_flex_debug;
880int kn_flex_debug = 0;
881
882static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
883static char *yy_full_match;
884static int yy_lp;
885#define REJECT{ *yy_cp = (yy_hold_char); yy_cp = (yy_full_match); ++(yy_lp)
; goto find_rule; }
\
886{ \
887*yy_cp = (yy_hold_char); /* undo effects of setting up kntext */ \
888yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
889++(yy_lp); \
890goto find_rule; \
891}
892
893#define yymore()yymore_used_but_not_detected yymore_used_but_not_detected
894#define YY_MORE_ADJ0 0
895#define YY_RESTORE_YY_MORE_OFFSET
896char *kntext;
897#line 1 "/usr/src/lib/libkeynote/keynote.l"
898#line 2 "/usr/src/lib/libkeynote/keynote.l"
899/* $OpenBSD: keynote.l,v 1.24 2017/08/28 17:07:19 millert Exp $ */
900/*
901 * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
902 *
903 * This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
904 * in April-May 1998
905 *
906 * Copyright (C) 1998, 1999 by Angelos D. Keromytis.
907 *
908 * Permission to use, copy, and modify this software with or without fee
909 * is hereby granted, provided that this entire notice is included in
910 * all copies of any software which is or includes a copy or
911 * modification of this software.
912 *
913 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
914 * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
915 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
916 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
917 * PURPOSE.
918 */
919
920#include <sys/time.h>
921#include <sys/types.h>
922
923#include <ctype.h>
924#include <regex.h>
925#include <string.h>
926#include <time.h>
927#include <unistd.h>
928
929#include "k.tab.h"
930#include "keynote.h"
931#include "assertion.h"
932
933static void mystrncpy(char *, char *, int);
934
935struct lex_list
936{
937 int lex_type;
938 void *lex_s;
939};
940
941static struct lex_list *keynote_lex_list = NULL((void *)0);
942static int keynote_max_lex_list = 32;
943static int keynote_lex_counter = 0;
944static int first_tok = 0;
945
946#define YY_NO_INPUT1 1
947#line 948 "lex.kn.c"
948
949#define INITIAL0 0
950#define ACTIONSTRING1 1
951#define LOCALINIT2 2
952#define KEYPREDICATE3 3
953#define SIGNERINIT4 4
954#define KEYNOTEVERSION5 5
955
956#ifndef YY_NO_UNISTD_H
957/* Special case for "unistd.h", since it is non-ANSI. We include it way
958 * down here because we want the user's section 1 to have been scanned first.
959 * The user has a chance to override it with an option.
960 */
961#include <unistd.h>
962#endif
963
964#ifndef YY_EXTRA_TYPEvoid *
965#define YY_EXTRA_TYPEvoid * void *
966#endif
967
968static int yy_init_globals (void );
969
970/* Accessor methods to globals.
971 These are made visible to non-reentrant scanners for convenience. */
972
973int knlex_destroy (void );
974
975int knget_debug (void );
976
977void knset_debug (int debug_flag );
978
979YY_EXTRA_TYPEvoid * knget_extra (void );
980
981void knset_extra (YY_EXTRA_TYPEvoid * user_defined );
982
983FILE *knget_in (void );
984
985void knset_in (FILE * in_str );
986
987FILE *knget_out (void );
988
989void knset_out (FILE * out_str );
990
991yy_size_t knget_leng (void );
992
993char *knget_text (void );
994
995int knget_lineno (void );
996
997void knset_lineno (int line_number );
998
999/* Macros after this point can all be overridden by user definitions in
1000 * section 1.
1001 */
1002
1003#ifndef YY_SKIP_YYWRAP
1004#ifdef __cplusplus
1005extern "C" int knwrap (void );
1006#else
1007extern int knwrap (void );
1008#endif
1009#endif
1010
1011 static void yyunput (int c,char *buf_ptr );
1012
1013#ifndef yytext_ptrkntext
1014static void yy_flex_strncpy (char *,yyconstconst char *,int );
1015#endif
1016
1017#ifdef YY_NEED_STRLEN
1018static int yy_flex_strlen (yyconstconst char * );
1019#endif
1020
1021#ifndef YY_NO_INPUT1
1022
1023#ifdef __cplusplus
1024static int yyinput (void );
1025#else
1026static int input (void );
1027#endif
1028
1029#endif
1030
1031/* Amount of stuff to slurp up with each read. */
1032#ifndef YY_READ_BUF_SIZE8192
1033#define YY_READ_BUF_SIZE8192 8192
1034#endif
1035
1036/* Copy whatever the last rule matched to the standard output. */
1037#ifndef ECHOdo { if (fwrite( kntext, knleng, 1, knout )) {} } while (0)
1038/* This used to be an fputs(), but since the string might contain NUL's,
1039 * we now use fwrite().
1040 */
1041#define ECHOdo { if (fwrite( kntext, knleng, 1, knout )) {} } while (0) do { if (fwrite( kntext, knleng, 1, knout )) {} } while (0)
1042#endif
1043
1044/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1045 * is returned in "result".
1046 */
1047#ifndef YY_INPUT
1048#define YY_INPUT(buf,result,max_size)(*__errno())=0; while ( (result = read( (!__isthreaded ? ((knin
)->_file) : (fileno)(knin)), (char *) buf, max_size )) <
0 ) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed"
); break; } (*__errno())=0; (!__isthreaded ? ((void)((knin)->
_flags &= ~(0x0040|0x0020))) : (clearerr)(knin)); }
\
1049 errno(*__errno())=0; \
1050 while ( (result = read( fileno(knin)(!__isthreaded ? ((knin)->_file) : (fileno)(knin)), (char *) buf, max_size )) < 0 ) \
1051 { \
1052 if( errno(*__errno()) != EINTR4) \
1053 { \
1054 YY_FATAL_ERROR( "input in flex scanner failed" )yy_fatal_error( "input in flex scanner failed" ); \
1055 break; \
1056 } \
1057 errno(*__errno())=0; \
1058 clearerr(knin)(!__isthreaded ? ((void)((knin)->_flags &= ~(0x0040|0x0020
))) : (clearerr)(knin))
; \
1059 }\
1060\
1061
1062#endif
1063
1064/* No semi-colon after return; correct usage is to write "yyterminate();" -
1065 * we don't want an extra ';' after the "return" because that will cause
1066 * some compilers to complain about unreachable statements.
1067 */
1068#ifndef yyterminate
1069#define yyterminate()return 0 return YY_NULL0
1070#endif
1071
1072/* Number of entries by which start-condition stack grows. */
1073#ifndef YY_START_STACK_INCR25
1074#define YY_START_STACK_INCR25 25
1075#endif
1076
1077/* Report a fatal error. */
1078#ifndef YY_FATAL_ERROR
1079#define YY_FATAL_ERROR(msg)yy_fatal_error( msg ) yy_fatal_error( msg )
1080#endif
1081
1082/* end tables serialization structures and prototypes */
1083
1084/* Default declaration of generated scanner - a define so the user can
1085 * easily add parameters.
1086 */
1087#ifndef YY_DECLint knlex (void)
1088#define YY_DECL_IS_OURS1 1
1089
1090extern int knlex (void);
1091
1092#define YY_DECLint knlex (void) int knlex (void)
1093#endif /* !YY_DECL */
1094
1095/* Code executed at the beginning of each rule, after kntext and knleng
1096 * have been set up.
1097 */
1098#ifndef YY_USER_ACTION
1099#define YY_USER_ACTION
1100#endif
1101
1102/* Code executed at the end of each rule. */
1103#ifndef YY_BREAKbreak;
1104#define YY_BREAKbreak; break;
1105#endif
1106
1107#define YY_RULE_SETUP \
1108 YY_USER_ACTION
1109
1110/** The main scanner function which does all the work.
1111 */
1112YY_DECLint knlex (void)
1113{
1114 yy_state_type yy_current_state;
1115 char *yy_cp, *yy_bp;
1116 int yy_act;
1117
1118 if ( !(yy_init) )
1
Assuming 'yy_init' is 0
2
Taking true branch
1119 {
1120 (yy_init) = 1;
1121
1122#ifdef YY_USER_INIT
1123 YY_USER_INIT;
1124#endif
1125
1126 /* Create the reject buffer large enough to save one state per allowed character. */
1127 if ( ! (yy_state_buf) )
3
Assuming 'yy_state_buf' is non-null
4
Taking false branch
1128 (yy_state_buf) = (yy_state_type *)
1129 knalloc(YY_STATE_BUF_SIZE((16384 + 2) * sizeof(yy_state_type)) );
1130 if ( ! (yy_state_buf
4.1
'yy_state_buf' is non-null
) )
5
Taking false branch
1131 YY_FATAL_ERROR( "out of dynamic memory in knlex()" )yy_fatal_error( "out of dynamic memory in knlex()" );
1132
1133 if ( ! (yy_start) )
6
Assuming 'yy_start' is not equal to 0
7
Taking false branch
1134 (yy_start) = 1; /* first start state */
1135
1136 if ( ! knin ) {
8
Assuming 'knin' is non-null
9
Taking false branch
1137 knin = stdin(&__sF[0]);
1138 }
1139
1140 if ( ! knout ) {
10
Assuming 'knout' is non-null
11
Taking false branch
1141 knout = stdout(&__sF[1]);
1142 }
1143
1144 if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
) {
12
Assuming 'yy_buffer_stack' is null
13
'?' condition is false
14
Taking true branch
1145 knensure_buffer_stack ();
1146 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] =
1147 kn_create_buffer(knin,YY_BUF_SIZE16384 );
15
Calling 'kn_create_buffer'
23
Returning from 'kn_create_buffer'
1148 }
1149
1150 kn_load_buffer_state( );
1151 }
1152
1153 {
1154#line 60 "/usr/src/lib/libkeynote/keynote.l"
1155
1156
1157 /*
1158 * Return a preset token, so we can have more than one grammars
1159 * in yacc.
1160 */
1161 extern int first_tok;
1162
1163 if (first_tok)
24
Assuming 'first_tok' is 0
25
Taking false branch
1164 {
1165 int holdtok = first_tok;
1166
1167 first_tok = 0;
1168 return holdtok;
1169 }
1170
1171
1172#line 1173 "lex.kn.c"
1173
1174 while ( 1 ) /* loops until end-of-file is reached */
26
Loop condition is true. Entering loop body
1175 {
1176 yy_cp = (yy_c_buf_p);
1177
1178 /* Support of kntext. */
1179 *yy_cp = (yy_hold_char);
1180
1181 /* yy_bp points to the position in yy_ch_buf of the start of
1182 * the current run.
1183 */
1184 yy_bp = yy_cp;
1185
1186 yy_current_state = (yy_start);
1187
1188 (yy_state_ptr) = (yy_state_buf);
1189 *(yy_state_ptr)++ = yy_current_state;
1190
1191yy_match:
1192 do
29
Loop condition is true. Execution continues on line 1194
32
Loop condition is true. Execution continues on line 1194
1193 {
1194 YY_CHAR yy_c = YY_SC_TO_UI(*yy_cp)((unsigned int) (unsigned char) *yy_cp);
33
Assigned value is garbage or undefined
1195 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
27
Loop condition is false. Execution continues on line 1199
30
Loop condition is false. Execution continues on line 1199
1196 {
1197 yy_current_state = (int) yy_def[yy_current_state];
1198 }
1199 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1200 *(yy_state_ptr)++ = yy_current_state;
1201 ++yy_cp;
1202 }
1203 while ( yy_current_state != 77 );
28
Assuming 'yy_current_state' is not equal to 77
31
Assuming 'yy_current_state' is not equal to 77
1204
1205yy_find_action:
1206 yy_current_state = *--(yy_state_ptr);
1207 (yy_lp) = yy_accept[yy_current_state];
1208find_rule: /* we branch to this label when backing up */
1209 for ( ; ; ) /* until we find what rule we matched */
1210 {
1211 if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
1212 {
1213 yy_act = yy_acclist[(yy_lp)];
1214 {
1215 (yy_full_match) = yy_cp;
1216 break;
1217 }
1218 }
1219 --yy_cp;
1220 yy_current_state = *--(yy_state_ptr);
1221 (yy_lp) = yy_accept[yy_current_state];
1222 }
1223
1224 YY_DO_BEFORE_ACTION(kntext) = yy_bp; knleng = (size_t) (yy_cp - yy_bp); (yy_hold_char
) = *yy_cp; *yy_cp = '\0'; (yy_c_buf_p) = yy_cp;
;
1225
1226 if ( yy_act != YY_END_OF_BUFFER41 && yy_rule_can_match_eol[yy_act] )
1227 {
1228 yy_size_t yyl;
1229 for ( yyl = 0; yyl < knleng; ++yyl )
1230 if ( kntext[yyl] == '\n' )
1231
1232 knlineno++;
1233;
1234 }
1235
1236do_action: /* This label is used only to access EOF actions. */
1237
1238 switch ( yy_act )
1239 { /* beginning of action switch */
1240case 1:
1241YY_RULE_SETUP
1242#line 77 "/usr/src/lib/libkeynote/keynote.l"
1243{
1244 knlval.intval = atoi(kntext);
1245 return KOF258;
1246 }
1247 YY_BREAKbreak;
1248case 2:
1249YY_RULE_SETUP
1250#line 81 "/usr/src/lib/libkeynote/keynote.l"
1251return OPENPAREN264;
1252 YY_BREAKbreak;
1253case 3:
1254YY_RULE_SETUP
1255#line 82 "/usr/src/lib/libkeynote/keynote.l"
1256return CLOSEPAREN265;
1257 YY_BREAKbreak;
1258case 4:
1259YY_RULE_SETUP
1260#line 83 "/usr/src/lib/libkeynote/keynote.l"
1261return AND288;
1262 YY_BREAKbreak;
1263case 5:
1264YY_RULE_SETUP
1265#line 84 "/usr/src/lib/libkeynote/keynote.l"
1266return OR287;
1267 YY_BREAKbreak;
1268case 6:
1269YY_RULE_SETUP
1270#line 85 "/usr/src/lib/libkeynote/keynote.l"
1271return PLUS290;
1272 YY_BREAKbreak;
1273case 7:
1274YY_RULE_SETUP
1275#line 86 "/usr/src/lib/libkeynote/keynote.l"
1276return HINT274;
1277 YY_BREAKbreak;
1278case 8:
1279YY_RULE_SETUP
1280#line 87 "/usr/src/lib/libkeynote/keynote.l"
1281return OPENBLOCK275;
1282 YY_BREAKbreak;
1283case 9:
1284YY_RULE_SETUP
1285#line 88 "/usr/src/lib/libkeynote/keynote.l"
1286return CLOSEBLOCK276;
1287 YY_BREAKbreak;
1288case 10:
1289YY_RULE_SETUP
1290#line 89 "/usr/src/lib/libkeynote/keynote.l"
1291return SEMICOLON279;
1292 YY_BREAKbreak;
1293case 11:
1294YY_RULE_SETUP
1295#line 90 "/usr/src/lib/libkeynote/keynote.l"
1296return NOT289;
1297 YY_BREAKbreak;
1298case 12:
1299YY_RULE_SETUP
1300#line 91 "/usr/src/lib/libkeynote/keynote.l"
1301return REGEXP286;
1302 YY_BREAKbreak;
1303case 13:
1304YY_RULE_SETUP
1305#line 92 "/usr/src/lib/libkeynote/keynote.l"
1306return EQ280;
1307 YY_BREAKbreak;
1308case 14:
1309YY_RULE_SETUP
1310#line 93 "/usr/src/lib/libkeynote/keynote.l"
1311return NE281;
1312 YY_BREAKbreak;
1313case 15:
1314YY_RULE_SETUP
1315#line 94 "/usr/src/lib/libkeynote/keynote.l"
1316return LT282;
1317 YY_BREAKbreak;
1318case 16:
1319YY_RULE_SETUP
1320#line 95 "/usr/src/lib/libkeynote/keynote.l"
1321return GT283;
1322 YY_BREAKbreak;
1323case 17:
1324YY_RULE_SETUP
1325#line 96 "/usr/src/lib/libkeynote/keynote.l"
1326return LE284;
1327 YY_BREAKbreak;
1328case 18:
1329YY_RULE_SETUP
1330#line 97 "/usr/src/lib/libkeynote/keynote.l"
1331return GE285;
1332 YY_BREAKbreak;
1333case 19:
1334YY_RULE_SETUP
1335#line 98 "/usr/src/lib/libkeynote/keynote.l"
1336return MINUS291;
1337 YY_BREAKbreak;
1338case 20:
1339YY_RULE_SETUP
1340#line 99 "/usr/src/lib/libkeynote/keynote.l"
1341return MULT292;
1342 YY_BREAKbreak;
1343case 21:
1344YY_RULE_SETUP
1345#line 100 "/usr/src/lib/libkeynote/keynote.l"
1346return DIV293;
1347 YY_BREAKbreak;
1348case 22:
1349YY_RULE_SETUP
1350#line 101 "/usr/src/lib/libkeynote/keynote.l"
1351return MOD294;
1352 YY_BREAKbreak;
1353case 23:
1354YY_RULE_SETUP
1355#line 102 "/usr/src/lib/libkeynote/keynote.l"
1356return EXP295;
1357 YY_BREAKbreak;
1358case 24:
1359YY_RULE_SETUP
1360#line 103 "/usr/src/lib/libkeynote/keynote.l"
1361return DOTT272;
1362 YY_BREAKbreak;
1363case 25:
1364YY_RULE_SETUP
1365#line 104 "/usr/src/lib/libkeynote/keynote.l"
1366return TRUE262;
1367 YY_BREAKbreak;
1368case 26:
1369YY_RULE_SETUP
1370#line 105 "/usr/src/lib/libkeynote/keynote.l"
1371return FALSE263;
1372 YY_BREAKbreak;
1373case 27:
1374YY_RULE_SETUP
1375#line 106 "/usr/src/lib/libkeynote/keynote.l"
1376/* eat up comments */
1377 YY_BREAKbreak;
1378case 28:
1379YY_RULE_SETUP
1380#line 107 "/usr/src/lib/libkeynote/keynote.l"
1381return EQQ266;
1382 YY_BREAKbreak;
1383case 29:
1384YY_RULE_SETUP
1385#line 108 "/usr/src/lib/libkeynote/keynote.l"
1386return COMMA267;
1387 YY_BREAKbreak;
1388case 30:
1389YY_RULE_SETUP
1390#line 109 "/usr/src/lib/libkeynote/keynote.l"
1391{
1392 int len;
1393 if (keynote_exceptionflag ||
1394 keynote_donteval)
1395 {
1396 knlval.string = NULL((void *)0);
1397 return VARIABLE261;
1398 }
1399
1400 len = strlen(kntext) + 1;
1401 knlval.string = calloc(len, sizeof(char));
1402 if (knlval.string == NULL((void *)0))
1403 {
1404 keynote_errno = ERROR_MEMORY-1;
1405 return -1;
1406 }
1407 strlcpy(knlval.string, kntext, len);
1408 if (keynote_lex_add(knlval.string,
1409 LEXTYPE_CHAR0x1) ==
1410 -1)
1411 return -1;
1412 return VARIABLE261;
1413 }
1414 YY_BREAKbreak;
1415case 31:
1416YY_RULE_SETUP
1417#line 132 "/usr/src/lib/libkeynote/keynote.l"
1418return DEREF297;
1419 YY_BREAKbreak;
1420case 32:
1421YY_RULE_SETUP
1422#line 133 "/usr/src/lib/libkeynote/keynote.l"
1423return OPENNUM298;
1424 YY_BREAKbreak;
1425case 33:
1426YY_RULE_SETUP
1427#line 134 "/usr/src/lib/libkeynote/keynote.l"
1428return OPENFLT299;
1429 YY_BREAKbreak;
1430case 34:
1431YY_RULE_SETUP
1432#line 135 "/usr/src/lib/libkeynote/keynote.l"
1433{
1434 knlval.doubval = atof(kntext);
1435 return FLOAT259;
1436 }
1437 YY_BREAKbreak;
1438case 35:
1439YY_RULE_SETUP
1440#line 139 "/usr/src/lib/libkeynote/keynote.l"
1441{
1442 int len;
1443
1444 if (keynote_exceptionflag ||
1445 keynote_donteval)
1446 {
1447 knlval.string = NULL((void *)0);
1448 return STRING260;
1449 }
1450
1451 len = strlen(kntext) + 1;
1452 knlval.string = calloc(len, sizeof(char));
1453 if (knlval.string == NULL((void *)0))
1454 {
1455 keynote_errno = ERROR_MEMORY-1;
1456 return -1;
1457 }
1458 strlcpy(knlval.string, kntext, len);
1459 if (keynote_lex_add(knlval.string,
1460 LEXTYPE_CHAR0x1) == -1)
1461 return -1;
1462 return STRING260;
1463 }
1464 YY_BREAKbreak;
1465case 36:
1466YY_RULE_SETUP
1467#line 162 "/usr/src/lib/libkeynote/keynote.l"
1468{
1469 knlval.intval = atoi(kntext);
1470 return NUM257;
1471 }
1472 YY_BREAKbreak;
1473case 37:
1474/* rule 37 can match eol */
1475YY_RULE_SETUP
1476#line 166 "/usr/src/lib/libkeynote/keynote.l"
1477{
1478 if (keynote_exceptionflag ||
1479 keynote_donteval)
1480 {
1481 knlval.string = NULL((void *)0);
1482 return STRING260;
1483 }
1484
1485 knlval.string = calloc(strlen(kntext) - 1,
1486 sizeof(char));
1487 if (knlval.string == NULL((void *)0))
1488 {
1489 keynote_errno = ERROR_MEMORY-1;
1490 return -1;
1491 }
1492
1493 mystrncpy(knlval.string, kntext + 1,
1494 strlen(kntext) - 2);
1495
1496 if (keynote_lex_add(knlval.string,
1497 LEXTYPE_CHAR0x1) == -1)
1498 return -1;
1499 return STRING260;
1500 }
1501 YY_BREAKbreak;
1502case 38:
1503/* rule 38 can match eol */
1504YY_RULE_SETUP
1505#line 190 "/usr/src/lib/libkeynote/keynote.l"
1506
1507 YY_BREAKbreak;
1508case 39:
1509YY_RULE_SETUP
1510#line 191 "/usr/src/lib/libkeynote/keynote.l"
1511{ keynote_errno = ERROR_SYNTAX-2;
1512 return -1;
1513 REJECT{ *yy_cp = (yy_hold_char); yy_cp = (yy_full_match); ++(yy_lp)
; goto find_rule; }
; /* Avoid -Wall warning. Not reached */
1514 }
1515 YY_BREAKbreak;
1516case 40:
1517YY_RULE_SETUP
1518#line 195 "/usr/src/lib/libkeynote/keynote.l"
1519YY_FATAL_ERROR( "flex scanner jammed" )yy_fatal_error( "flex scanner jammed" );
1520 YY_BREAKbreak;
1521#line 1522 "lex.kn.c"
1522 case YY_STATE_EOF(INITIAL)(41 + 0 + 1):
1523 case YY_STATE_EOF(ACTIONSTRING)(41 + 1 + 1):
1524 case YY_STATE_EOF(LOCALINIT)(41 + 2 + 1):
1525 case YY_STATE_EOF(KEYPREDICATE)(41 + 3 + 1):
1526 case YY_STATE_EOF(SIGNERINIT)(41 + 4 + 1):
1527 case YY_STATE_EOF(KEYNOTEVERSION)(41 + 5 + 1):
1528 yyterminate()return 0;
1529
1530 case YY_END_OF_BUFFER41:
1531 {
1532 /* Amount of text matched not including the EOB char. */
1533 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptrkntext)) - 1;
1534
1535 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1536 *yy_cp = (yy_hold_char);
1537 YY_RESTORE_YY_MORE_OFFSET
1538
1539 if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status == YY_BUFFER_NEW0 )
1540 {
1541 /* We're scanning a new file or input source. It's
1542 * possible that this happened because the user
1543 * just pointed knin at a new source and called
1544 * knlex(). If so, then we have to assure
1545 * consistency between YY_CURRENT_BUFFER and our
1546 * globals. Here is the right place to do so, because
1547 * this is the first action (other than possibly a
1548 * back-up) that will match for the new input source.
1549 */
1550 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars;
1551 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_input_file = knin;
1552 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status = YY_BUFFER_NORMAL1;
1553 }
1554
1555 /* Note that here we test for yy_c_buf_p "<=" to the position
1556 * of the first EOB in the buffer, since yy_c_buf_p will
1557 * already have been incremented past the NUL character
1558 * (since all states make transitions on EOB to the
1559 * end-of-buffer state). Contrast this with the test
1560 * in input().
1561 */
1562 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] )
1563 { /* This was really a NUL. */
1564 yy_state_type yy_next_state;
1565
1566 (yy_c_buf_p) = (yytext_ptrkntext) + yy_amount_of_matched_text;
1567
1568 yy_current_state = yy_get_previous_state( );
1569
1570 /* Okay, we're now positioned to make the NUL
1571 * transition. We couldn't have
1572 * yy_get_previous_state() go ahead and do it
1573 * for us because it doesn't know how to deal
1574 * with the possibility of jamming (and we don't
1575 * want to build jamming into it because then it
1576 * will run more slowly).
1577 */
1578
1579 yy_next_state = yy_try_NUL_trans( yy_current_state );
1580
1581 yy_bp = (yytext_ptrkntext) + YY_MORE_ADJ0;
1582
1583 if ( yy_next_state )
1584 {
1585 /* Consume the NUL. */
1586 yy_cp = ++(yy_c_buf_p);
1587 yy_current_state = yy_next_state;
1588 goto yy_match;
1589 }
1590
1591 else
1592 {
1593 yy_cp = (yy_c_buf_p);
1594 goto yy_find_action;
1595 }
1596 }
1597
1598 else switch ( yy_get_next_buffer( ) )
1599 {
1600 case EOB_ACT_END_OF_FILE1:
1601 {
1602 (yy_did_buffer_switch_on_eof) = 0;
1603
1604 if ( knwrap( )1 )
1605 {
1606 /* Note: because we've taken care in
1607 * yy_get_next_buffer() to have set up
1608 * kntext, we can now set up
1609 * yy_c_buf_p so that if some total
1610 * hoser (like flex itself) wants to
1611 * call the scanner after we return the
1612 * YY_NULL, it'll still work - another
1613 * YY_NULL will get returned.
1614 */
1615 (yy_c_buf_p) = (yytext_ptrkntext) + YY_MORE_ADJ0;
1616
1617 yy_act = YY_STATE_EOF(YY_START)(41 + (((yy_start) - 1) / 2) + 1);
1618 goto do_action;
1619 }
1620
1621 else
1622 {
1623 if ( ! (yy_did_buffer_switch_on_eof) )
1624 YY_NEW_FILEknrestart(knin );
1625 }
1626 break;
1627 }
1628
1629 case EOB_ACT_CONTINUE_SCAN0:
1630 (yy_c_buf_p) =
1631 (yytext_ptrkntext) + yy_amount_of_matched_text;
1632
1633 yy_current_state = yy_get_previous_state( );
1634
1635 yy_cp = (yy_c_buf_p);
1636 yy_bp = (yytext_ptrkntext) + YY_MORE_ADJ0;
1637 goto yy_match;
1638
1639 case EOB_ACT_LAST_MATCH2:
1640 (yy_c_buf_p) =
1641 &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)];
1642
1643 yy_current_state = yy_get_previous_state( );
1644
1645 yy_cp = (yy_c_buf_p);
1646 yy_bp = (yytext_ptrkntext) + YY_MORE_ADJ0;
1647 goto yy_find_action;
1648 }
1649 break;
1650 }
1651
1652 default:
1653 YY_FATAL_ERROR(yy_fatal_error( "fatal flex scanner internal error--no action found"
)
1654 "fatal flex scanner internal error--no action found" )yy_fatal_error( "fatal flex scanner internal error--no action found"
)
;
1655 } /* end of action switch */
1656 } /* end of scanning one token */
1657 } /* end of user's declarations */
1658} /* end of knlex */
1659
1660/* yy_get_next_buffer - try to read in a new buffer
1661 *
1662 * Returns a code representing an action:
1663 * EOB_ACT_LAST_MATCH -
1664 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1665 * EOB_ACT_END_OF_FILE - end of file
1666 */
1667static int yy_get_next_buffer (void)
1668{
1669 char *dest = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf;
1670 char *source = (yytext_ptrkntext);
1671 int number_to_move, i;
1672 int ret_val;
1673
1674 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1] )
1675 YY_FATAL_ERROR(yy_fatal_error( "fatal flex scanner internal error--end of buffer missed"
)
1676 "fatal flex scanner internal error--end of buffer missed" )yy_fatal_error( "fatal flex scanner internal error--end of buffer missed"
)
;
1677
1678 if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_fill_buffer == 0 )
1679 { /* Don't try to fill the buffer, so this is an EOF. */
1680 if ( (yy_c_buf_p) - (yytext_ptrkntext) - YY_MORE_ADJ0 == 1 )
1681 {
1682 /* We matched a single character, the EOB, so
1683 * treat this as a final EOF.
1684 */
1685 return EOB_ACT_END_OF_FILE1;
1686 }
1687
1688 else
1689 {
1690 /* We matched some text prior to the EOB, first
1691 * process it.
1692 */
1693 return EOB_ACT_LAST_MATCH2;
1694 }
1695 }
1696
1697 /* Try to read more data. */
1698
1699 /* First move last chars to start of buffer. */
1700 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptrkntext)) - 1;
1701
1702 for ( i = 0; i < number_to_move; ++i )
1703 *(dest++) = *(source++);
1704
1705 if ( YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status == YY_BUFFER_EOF_PENDING2 )
1706 /* don't do the read, it's not guaranteed to return an EOF,
1707 * just force an EOF
1708 */
1709 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars) = 0;
1710
1711 else
1712 {
1713 yy_size_t num_to_read =
1714 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size - number_to_move - 1;
1715
1716 while ( num_to_read <= 0 )
1717 { /* Not enough room in the buffer - grow it. */
1718
1719 YY_FATAL_ERROR(yy_fatal_error( "input buffer overflow, can't enlarge buffer because scanner uses REJECT"
)
1720"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"
)
;
1721
1722 }
1723
1724 if ( num_to_read > YY_READ_BUF_SIZE8192 )
1725 num_to_read = YY_READ_BUF_SIZE8192;
1726
1727 /* Read in more data. */
1728 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),(*__errno())=0; while ( ((yy_n_chars) = read( (!__isthreaded ?
((knin)->_file) : (fileno)(knin)), (char *) (&(yy_buffer_stack
)[(yy_buffer_stack_top)]->yy_ch_buf[number_to_move]), num_to_read
)) < 0 ) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed"
); break; } (*__errno())=0; (!__isthreaded ? ((void)((knin)->
_flags &= ~(0x0040|0x0020))) : (clearerr)(knin)); }
1729 (yy_n_chars), num_to_read )(*__errno())=0; while ( ((yy_n_chars) = read( (!__isthreaded ?
((knin)->_file) : (fileno)(knin)), (char *) (&(yy_buffer_stack
)[(yy_buffer_stack_top)]->yy_ch_buf[number_to_move]), num_to_read
)) < 0 ) { if( (*__errno()) != 4) { yy_fatal_error( "input in flex scanner failed"
); break; } (*__errno())=0; (!__isthreaded ? ((void)((knin)->
_flags &= ~(0x0040|0x0020))) : (clearerr)(knin)); }
;
1730
1731 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars);
1732 }
1733
1734 if ( (yy_n_chars) == 0 )
1735 {
1736 if ( number_to_move == YY_MORE_ADJ0 )
1737 {
1738 ret_val = EOB_ACT_END_OF_FILE1;
1739 knrestart(knin );
1740 }
1741
1742 else
1743 {
1744 ret_val = EOB_ACT_LAST_MATCH2;
1745 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buffer_status =
1746 YY_BUFFER_EOF_PENDING2;
1747 }
1748 }
1749
1750 else
1751 ret_val = EOB_ACT_CONTINUE_SCAN0;
1752
1753 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size) {
1754 /* Extend the array by 50%, plus the number we really need. */
1755 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1756 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf = (char *) knrealloc((void *) YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf,new_size );
1757 if ( ! YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf )
1758 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" )yy_fatal_error( "out of dynamic memory in yy_get_next_buffer()"
)
;
1759 /* "- 2" to take care of EOB's */
1760 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size = (int) (new_size - 2);
1761 }
1762
1763 (yy_n_chars) += number_to_move;
1764 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR0;
1765 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR0;
1766
1767 (yytext_ptrkntext) = &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[0];
1768
1769 return ret_val;
1770}
1771
1772/* yy_get_previous_state - get the state just before the EOB char was reached */
1773
1774 static yy_state_type yy_get_previous_state (void)
1775{
1776 yy_state_type yy_current_state;
1777 char *yy_cp;
1778
1779 yy_current_state = (yy_start);
1780
1781 (yy_state_ptr) = (yy_state_buf);
1782 *(yy_state_ptr)++ = yy_current_state;
1783
1784 for ( yy_cp = (yytext_ptrkntext) + YY_MORE_ADJ0; yy_cp < (yy_c_buf_p); ++yy_cp )
1785 {
1786 if ( *yy_cp )
1787 {
1788 YY_CHAR yy_c = YY_SC_TO_UI(*yy_cp)((unsigned int) (unsigned char) *yy_cp);
1789 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1790 {
1791 yy_current_state = (int) yy_def[yy_current_state];
1792 }
1793 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1794 }
1795 else
1796 yy_current_state = yy_NUL_trans[yy_current_state];
1797 *(yy_state_ptr)++ = yy_current_state;
1798 }
1799
1800 return yy_current_state;
1801}
1802
1803/* yy_try_NUL_trans - try to make a transition on the NUL character
1804 *
1805 * synopsis
1806 * next_state = yy_try_NUL_trans( current_state );
1807 */
1808 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1809{
1810 int yy_is_jam;
1811
1812 yy_current_state = yy_NUL_trans[yy_current_state];
1813 yy_is_jam = (yy_current_state == 0);
1814
1815 return yy_is_jam ? 0 : yy_current_state;
1816}
1817
1818 static void yyunput (int c, char * yy_bp )
1819{
1820 char *yy_cp;
1821
1822 yy_cp = (yy_c_buf_p);
1823
1824 /* undo effects of setting up kntext */
1825 *yy_cp = (yy_hold_char);
1826
1827 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf + 2 )
1828 { /* need to shift things up to make room */
1829 /* +2 for EOB chars. */
1830 yy_size_t number_to_move = (yy_n_chars) + 2;
1831 char *dest = &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[
1832 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size + 2];
1833 char *source =
1834 &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[number_to_move];
1835
1836 while ( source > YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf )
1837 *--dest = *--source;
1838
1839 yy_cp += (int) (dest - source);
1840 yy_bp += (int) (dest - source);
1841 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars =
1842 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_size;
1843
1844 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf + 2 )
1845 YY_FATAL_ERROR( "flex scanner push-back overflow" )yy_fatal_error( "flex scanner push-back overflow" );
1846 }
1847
1848 *--yy_cp = (char) c;
1849
1850 if ( c == '\n' ){
1851 --knlineno;
1852 }
1853
1854 (yytext_ptrkntext) = yy_bp;
1855 (yy_hold_char) = *yy_cp;
1856 (yy_c_buf_p) = yy_cp;
1857}
1858
1859#ifndef YY_NO_INPUT1
1860#ifdef __cplusplus
1861 static int yyinput (void)
1862#else
1863 static int input (void)
1864#endif
1865
1866{
1867 int c;
1868
1869 *(yy_c_buf_p) = (yy_hold_char);
1870
1871 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR0 )
1872 {
1873 /* yy_c_buf_p now points to the character we want to return.
1874 * If this occurs *before* the EOB characters, then it's a
1875 * valid NUL; if not, then we've hit the end of the buffer.
1876 */
1877 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_ch_buf[(yy_n_chars)] )
1878 /* This was really a NUL. */
1879 *(yy_c_buf_p) = '\0';
1880
1881 else
1882 { /* need more input */
1883 yy_size_t offset = (yy_c_buf_p) - (yytext_ptrkntext);
1884 ++(yy_c_buf_p);
1885
1886 switch ( yy_get_next_buffer( ) )
1887 {
1888 case EOB_ACT_LAST_MATCH2:
1889 /* This happens because yy_g_n_b()
1890 * sees that we've accumulated a
1891 * token and flags that we need to
1892 * try matching the token before
1893 * proceeding. But for input(),
1894 * there's no matching to consider.
1895 * So convert the EOB_ACT_LAST_MATCH
1896 * to EOB_ACT_END_OF_FILE.
1897 */
1898
1899 /* Reset buffer status. */
1900 knrestart(knin );
1901
1902 /*FALLTHROUGH*/
1903
1904 case EOB_ACT_END_OF_FILE1:
1905 {
1906 if ( knwrap( )1 )
1907 return EOF(-1);
1908
1909 if ( ! (yy_did_buffer_switch_on_eof) )
1910 YY_NEW_FILEknrestart(knin );
1911#ifdef __cplusplus
1912 return yyinput();
1913#else
1914 return input();
1915#endif
1916 }
1917
1918 case EOB_ACT_CONTINUE_SCAN0:
1919 (yy_c_buf_p) = (yytext_ptrkntext) + offset;
1920 break;
1921 }
1922 }
1923 }
1924
1925 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1926 *(yy_c_buf_p) = '\0'; /* preserve kntext */
1927 (yy_hold_char) = *++(yy_c_buf_p);
1928
1929 if ( c == '\n' )
1930
1931 knlineno++;
1932;
1933
1934 return c;
1935}
1936#endif /* ifndef YY_NO_INPUT */
1937
1938/** Immediately switch to a different input stream.
1939 * @param input_file A readable stream.
1940 *
1941 * @note This function does not reset the start condition to @c INITIAL .
1942 */
1943 void knrestart (FILE * input_file )
1944{
1945
1946 if ( ! YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
){
1947 knensure_buffer_stack ();
1948 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] =
1949 kn_create_buffer(knin,YY_BUF_SIZE16384 );
1950 }
1951
1952 kn_init_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
,input_file );
1953 kn_load_buffer_state( );
1954}
1955
1956/** Switch to a different input buffer.
1957 * @param new_buffer The new input buffer.
1958 *
1959 */
1960 void kn_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1961{
1962
1963 /* TODO. We should be able to replace this entire function body
1964 * with
1965 * knpop_buffer_state();
1966 * knpush_buffer_state(new_buffer);
1967 */
1968 knensure_buffer_stack ();
1969 if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
== new_buffer )
1970 return;
1971
1972 if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
)
1973 {
1974 /* Flush out information for old buffer. */
1975 *(yy_c_buf_p) = (yy_hold_char);
1976 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p);
1977 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars);
1978 }
1979
1980 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer;
1981 kn_load_buffer_state( );
1982
1983 /* We don't actually know whether we did this switch during
1984 * EOF (knwrap()) processing, but the only time this flag
1985 * is looked at is after knwrap() is called, so it's safe
1986 * to go ahead and always set it.
1987 */
1988 (yy_did_buffer_switch_on_eof) = 1;
1989}
1990
1991static void kn_load_buffer_state (void)
1992{
1993 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars;
1994 (yytext_ptrkntext) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos;
1995 knin = YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_input_file;
1996 (yy_hold_char) = *(yy_c_buf_p);
1997}
1998
1999/** Allocate and initialize an input buffer state.
2000 * @param file A readable stream.
2001 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2002 *
2003 * @return the allocated buffer state.
2004 */
2005 YY_BUFFER_STATE kn_create_buffer (FILE * file, int size )
2006{
2007 YY_BUFFER_STATE b;
2008
2009 b = (YY_BUFFER_STATE) knalloc(sizeof( struct yy_buffer_state ) );
2010 if ( ! b )
16
Assuming 'b' is non-null
17
Taking false branch
2011 YY_FATAL_ERROR( "out of dynamic memory in kn_create_buffer()" )yy_fatal_error( "out of dynamic memory in kn_create_buffer()"
)
;
2012
2013 b->yy_buf_size = size;
2014
2015 /* yy_ch_buf has to be 2 characters longer than the size given because
2016 * we need to put in 2 end-of-buffer characters.
2017 */
2018 b->yy_ch_buf = (char *) knalloc(b->yy_buf_size + 2 );
18
Calling 'knalloc'
20
Returning from 'knalloc'
2019 if ( ! b->yy_ch_buf )
21
Assuming field 'yy_ch_buf' is non-null
22
Taking false branch
2020 YY_FATAL_ERROR( "out of dynamic memory in kn_create_buffer()" )yy_fatal_error( "out of dynamic memory in kn_create_buffer()"
)
;
2021
2022 b->yy_is_our_buffer = 1;
2023
2024 kn_init_buffer(b,file );
2025
2026 return b;
2027}
2028
2029/** Destroy the buffer.
2030 * @param b a buffer created with kn_create_buffer()
2031 *
2032 */
2033 void kn_delete_buffer (YY_BUFFER_STATE b )
2034{
2035
2036 if ( ! b )
2037 return;
2038
2039 if ( b == YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
) /* Not sure if we should pop here. */
2040 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = (YY_BUFFER_STATE) 0;
2041
2042 if ( b->yy_is_our_buffer )
2043 knfree((void *) b->yy_ch_buf );
2044
2045 knfree((void *) b );
2046}
2047
2048/* Initializes or reinitializes a buffer.
2049 * This function is sometimes called more than once on the same buffer,
2050 * such as during a knrestart() or at EOF.
2051 */
2052 static void kn_init_buffer (YY_BUFFER_STATE b, FILE * file )
2053
2054{
2055 int oerrno = errno(*__errno());
2056
2057 kn_flush_buffer(b );
2058
2059 b->yy_input_file = file;
2060 b->yy_fill_buffer = 1;
2061
2062 /* If b is the current buffer, then kn_init_buffer was _probably_
2063 * called from knrestart() or through yy_get_next_buffer.
2064 * In that case, we don't want to reset the lineno or column.
2065 */
2066 if (b != YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
){
2067 b->yy_bs_lineno = 1;
2068 b->yy_bs_column = 0;
2069 }
2070
2071 b->yy_is_interactive = 0;
2072
2073 errno(*__errno()) = oerrno;
2074}
2075
2076/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2077 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2078 *
2079 */
2080 void kn_flush_buffer (YY_BUFFER_STATE b )
2081{
2082 if ( ! b )
2083 return;
2084
2085 b->yy_n_chars = 0;
2086
2087 /* We always need two end-of-buffer characters. The first causes
2088 * a transition to the end-of-buffer state. The second causes
2089 * a jam in that state.
2090 */
2091 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR0;
2092 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR0;
2093
2094 b->yy_buf_pos = &b->yy_ch_buf[0];
2095
2096 b->yy_at_bol = 1;
2097 b->yy_buffer_status = YY_BUFFER_NEW0;
2098
2099 if ( b == YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
)
2100 kn_load_buffer_state( );
2101}
2102
2103/** Pushes the new state onto the stack. The new state becomes
2104 * the current state. This function will allocate the stack
2105 * if necessary.
2106 * @param new_buffer The new state.
2107 *
2108 */
2109void knpush_buffer_state (YY_BUFFER_STATE new_buffer )
2110{
2111 if (new_buffer == NULL((void *)0))
2112 return;
2113
2114 knensure_buffer_stack();
2115
2116 /* This block is copied from kn_switch_to_buffer. */
2117 if ( YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
)
2118 {
2119 /* Flush out information for old buffer. */
2120 *(yy_c_buf_p) = (yy_hold_char);
2121 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_buf_pos = (yy_c_buf_p);
2122 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)]->yy_n_chars = (yy_n_chars);
2123 }
2124
2125 /* Only push if top exists. Otherwise, replace top. */
2126 if (YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
)
2127 (yy_buffer_stack_top)++;
2128 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = new_buffer;
2129
2130 /* copied from kn_switch_to_buffer. */
2131 kn_load_buffer_state( );
2132 (yy_did_buffer_switch_on_eof) = 1;
2133}
2134
2135/** Removes and deletes the top of the stack, if present.
2136 * The next element becomes the new top.
2137 *
2138 */
2139void knpop_buffer_state (void)
2140{
2141 if (!YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
)
2142 return;
2143
2144 kn_delete_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
);
2145 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = NULL((void *)0);
2146 if ((yy_buffer_stack_top) > 0)
2147 --(yy_buffer_stack_top);
2148
2149 if (YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
) {
2150 kn_load_buffer_state( );
2151 (yy_did_buffer_switch_on_eof) = 1;
2152 }
2153}
2154
2155/* Allocates the stack if it does not exist.
2156 * Guarantees space for at least one push.
2157 */
2158static void knensure_buffer_stack (void)
2159{
2160 yy_size_t num_to_alloc;
2161
2162 if (!(yy_buffer_stack)) {
2163
2164 /* First allocation is just for 2 elements, since we don't know if this
2165 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2166 * immediate realloc on the next call.
2167 */
2168 num_to_alloc = 1;
2169 (yy_buffer_stack) = (struct yy_buffer_state**)knalloc
2170 (num_to_alloc * sizeof(struct yy_buffer_state*)
2171 );
2172 if ( ! (yy_buffer_stack) )
2173 YY_FATAL_ERROR( "out of dynamic memory in knensure_buffer_stack()" )yy_fatal_error( "out of dynamic memory in knensure_buffer_stack()"
)
;
2174
2175 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2176
2177 (yy_buffer_stack_max) = num_to_alloc;
2178 (yy_buffer_stack_top) = 0;
2179 return;
2180 }
2181
2182 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2183
2184 /* Increase the buffer to prepare for a possible push. */
2185 int grow_size = 8 /* arbitrary grow size */;
2186
2187 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2188 (yy_buffer_stack) = (struct yy_buffer_state**)knrealloc
2189 ((yy_buffer_stack),
2190 num_to_alloc * sizeof(struct yy_buffer_state*)
2191 );
2192 if ( ! (yy_buffer_stack) )
2193 YY_FATAL_ERROR( "out of dynamic memory in knensure_buffer_stack()" )yy_fatal_error( "out of dynamic memory in knensure_buffer_stack()"
)
;
2194
2195 /* zero only the new slots.*/
2196 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2197 (yy_buffer_stack_max) = num_to_alloc;
2198 }
2199}
2200
2201/** Setup the input buffer state to scan directly from a user-specified character buffer.
2202 * @param base the character buffer
2203 * @param size the size in bytes of the character buffer
2204 *
2205 * @return the newly allocated buffer state object.
2206 */
2207YY_BUFFER_STATE kn_scan_buffer (char * base, yy_size_t size )
2208{
2209 YY_BUFFER_STATE b;
2210
2211 if ( size < 2 ||
2212 base[size-2] != YY_END_OF_BUFFER_CHAR0 ||
2213 base[size-1] != YY_END_OF_BUFFER_CHAR0 )
2214 /* They forgot to leave room for the EOB's. */
2215 return 0;
2216
2217 b = (YY_BUFFER_STATE) knalloc(sizeof( struct yy_buffer_state ) );
2218 if ( ! b )
2219 YY_FATAL_ERROR( "out of dynamic memory in kn_scan_buffer()" )yy_fatal_error( "out of dynamic memory in kn_scan_buffer()" );
2220
2221 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2222 b->yy_buf_pos = b->yy_ch_buf = base;
2223 b->yy_is_our_buffer = 0;
2224 b->yy_input_file = 0;
2225 b->yy_n_chars = b->yy_buf_size;
2226 b->yy_is_interactive = 0;
2227 b->yy_at_bol = 1;
2228 b->yy_fill_buffer = 0;
2229 b->yy_buffer_status = YY_BUFFER_NEW0;
2230
2231 kn_switch_to_buffer(b );
2232
2233 return b;
2234}
2235
2236/** Setup the input buffer state to scan a string. The next call to knlex() will
2237 * scan from a @e copy of @a str.
2238 * @param yystr a NUL-terminated string to scan
2239 *
2240 * @return the newly allocated buffer state object.
2241 * @note If you want to scan bytes that may contain NUL values, then use
2242 * kn_scan_bytes() instead.
2243 */
2244YY_BUFFER_STATE kn_scan_string (yyconstconst char * yystr )
2245{
2246
2247 return kn_scan_bytes(yystr,strlen(yystr) );
2248}
2249
2250/** Setup the input buffer state to scan the given bytes. The next call to knlex() will
2251 * scan from a @e copy of @a bytes.
2252 * @param yybytes the byte buffer to scan
2253 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2254 *
2255 * @return the newly allocated buffer state object.
2256 */
2257YY_BUFFER_STATE kn_scan_bytes (yyconstconst char * yybytes, yy_size_t _yybytes_len )
2258{
2259 YY_BUFFER_STATE b;
2260 char *buf;
2261 yy_size_t n;
2262 yy_size_t i;
2263
2264 /* Get memory for full buffer, including space for trailing EOB's. */
2265 n = _yybytes_len + 2;
2266 buf = (char *) knalloc(n );
2267 if ( ! buf )
2268 YY_FATAL_ERROR( "out of dynamic memory in kn_scan_bytes()" )yy_fatal_error( "out of dynamic memory in kn_scan_bytes()" );
2269
2270 for ( i = 0; i < _yybytes_len; ++i )
2271 buf[i] = yybytes[i];
2272
2273 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR0;
2274
2275 b = kn_scan_buffer(buf,n );
2276 if ( ! b )
2277 YY_FATAL_ERROR( "bad buffer in kn_scan_bytes()" )yy_fatal_error( "bad buffer in kn_scan_bytes()" );
2278
2279 /* It's okay to grow etc. this buffer, and we should throw it
2280 * away when we're done.
2281 */
2282 b->yy_is_our_buffer = 1;
2283
2284 return b;
2285}
2286
2287#ifndef YY_EXIT_FAILURE2
2288#define YY_EXIT_FAILURE2 2
2289#endif
2290
2291static void yy_fatal_error (yyconstconst char* msg )
2292{
2293 (void) fprintf( stderr(&__sF[2]), "%s\n", msg );
2294 exit( YY_EXIT_FAILURE2 );
2295}
2296
2297/* Redefine yyless() so it works in section 3 code. */
2298
2299#undef yyless
2300#define yyless(n)do { int yyless_macro_arg = (n); do { int yyl; for ( yyl = yyless_macro_arg
; yyl < knleng; ++yyl ) if ( kntext[yyl] == '\n' ) --knlineno
; }while(0); kntext[knleng] = (yy_hold_char); (yy_c_buf_p) = kntext
+ yyless_macro_arg; (yy_hold_char) = *(yy_c_buf_p); *(yy_c_buf_p
) = '\0'; knleng = yyless_macro_arg; } while ( 0 )
\
2301 do \
2302 { \
2303 /* Undo effects of setting up kntext. */ \
2304 int yyless_macro_arg = (n); \
2305 YY_LESS_LINENO(yyless_macro_arg)do { int yyl; for ( yyl = yyless_macro_arg; yyl < knleng; ++
yyl ) if ( kntext[yyl] == '\n' ) --knlineno; }while(0)
;\
2306 kntext[knleng] = (yy_hold_char); \
2307 (yy_c_buf_p) = kntext + yyless_macro_arg; \
2308 (yy_hold_char) = *(yy_c_buf_p); \
2309 *(yy_c_buf_p) = '\0'; \
2310 knleng = yyless_macro_arg; \
2311 } \
2312 while ( 0 )
2313
2314/* Accessor methods (get/set functions) to struct members. */
2315
2316/** Get the current line number.
2317 *
2318 */
2319int knget_lineno (void)
2320{
2321
2322 return knlineno;
2323}
2324
2325/** Get the input stream.
2326 *
2327 */
2328FILE *knget_in (void)
2329{
2330 return knin;
2331}
2332
2333/** Get the output stream.
2334 *
2335 */
2336FILE *knget_out (void)
2337{
2338 return knout;
2339}
2340
2341/** Get the length of the current token.
2342 *
2343 */
2344yy_size_t knget_leng (void)
2345{
2346 return knleng;
2347}
2348
2349/** Get the current token.
2350 *
2351 */
2352
2353char *knget_text (void)
2354{
2355 return kntext;
2356}
2357
2358/** Set the current line number.
2359 * @param line_number
2360 *
2361 */
2362void knset_lineno (int line_number )
2363{
2364
2365 knlineno = line_number;
2366}
2367
2368/** Set the input stream. This does not discard the current
2369 * input buffer.
2370 * @param in_str A readable stream.
2371 *
2372 * @see kn_switch_to_buffer
2373 */
2374void knset_in (FILE * in_str )
2375{
2376 knin = in_str ;
2377}
2378
2379void knset_out (FILE * out_str )
2380{
2381 knout = out_str ;
2382}
2383
2384int knget_debug (void)
2385{
2386 return kn_flex_debug;
2387}
2388
2389void knset_debug (int bdebug )
2390{
2391 kn_flex_debug = bdebug ;
2392}
2393
2394static int yy_init_globals (void)
2395{
2396 /* Initialization is the same as for the non-reentrant scanner.
2397 * This function is called from knlex_destroy(), so don't allocate here.
2398 */
2399
2400 /* We do not touch knlineno unless the option is enabled. */
2401 knlineno = 1;
2402
2403 (yy_buffer_stack) = 0;
2404 (yy_buffer_stack_top) = 0;
2405 (yy_buffer_stack_max) = 0;
2406 (yy_c_buf_p) = (char *) 0;
2407 (yy_init) = 0;
2408 (yy_start) = 0;
2409
2410 (yy_state_buf) = 0;
2411 (yy_state_ptr) = 0;
2412 (yy_full_match) = 0;
2413 (yy_lp) = 0;
2414
2415/* Defined in main.c */
2416#ifdef YY_STDINIT
2417 knin = stdin(&__sF[0]);
2418 knout = stdout(&__sF[1]);
2419#else
2420 knin = (FILE *) 0;
2421 knout = (FILE *) 0;
2422#endif
2423
2424 /* For future reference: Set errno on error, since we are called by
2425 * knlex_init()
2426 */
2427 return 0;
2428}
2429
2430/* knlex_destroy is for both reentrant and non-reentrant scanners. */
2431int knlex_destroy (void)
2432{
2433
2434 /* Pop the buffer stack, destroying each element. */
2435 while(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
){
2436 kn_delete_buffer(YY_CURRENT_BUFFER( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)
] : ((void *)0))
);
2437 YY_CURRENT_BUFFER_LVALUE(yy_buffer_stack)[(yy_buffer_stack_top)] = NULL((void *)0);
2438 knpop_buffer_state();
2439 }
2440
2441 /* Destroy the stack itself. */
2442 knfree((yy_buffer_stack) );
2443 (yy_buffer_stack) = NULL((void *)0);
2444
2445 knfree ( (yy_state_buf) );
2446 (yy_state_buf) = NULL((void *)0);
2447
2448 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2449 * knlex() is called, initialization will occur. */
2450 yy_init_globals( );
2451
2452 return 0;
2453}
2454
2455/*
2456 * Internal utility routines.
2457 */
2458
2459#ifndef yytext_ptrkntext
2460static void yy_flex_strncpy (char* s1, yyconstconst char * s2, int n )
2461{
2462 int i;
2463 for ( i = 0; i < n; ++i )
2464 s1[i] = s2[i];
2465}
2466#endif
2467
2468#ifdef YY_NEED_STRLEN
2469static int yy_flex_strlen (yyconstconst char * s )
2470{
2471 int n;
2472 for ( n = 0; s[n]; ++n )
2473 ;
2474
2475 return n;
2476}
2477#endif
2478
2479void *knalloc (yy_size_t size )
2480{
2481 return (void *) malloc( size );
19
Storing uninitialized value
2482}
2483
2484void *knrealloc (void * ptr, yy_size_t size )
2485{
2486 /* The cast to (char *) in the following accommodates both
2487 * implementations that use char* generic pointers, and those
2488 * that use void* generic pointers. It works with the latter
2489 * because both ANSI C and C++ allow castless assignment from
2490 * any pointer type to void*, and deal with argument conversions
2491 * as though doing an assignment.
2492 */
2493 return (void *) realloc( (char *) ptr, size );
2494}
2495
2496void knfree (void * ptr )
2497{
2498 free( (char *) ptr ); /* see knrealloc() for (char *) cast */
2499}
2500
2501#define YYTABLES_NAME"yytables" "yytables"
2502
2503#line 195 "/usr/src/lib/libkeynote/keynote.l"
2504
2505
2506
2507/*
2508 * Zap everything.
2509 */
2510static void
2511keynote_lex_zap(void)
2512{
2513 int i;
2514
2515 if (keynote_lex_counter == 0)
2516 return;
2517
2518 for (i = 0; i < keynote_max_lex_list; i++)
2519 if (keynote_lex_list[i].lex_s != NULL((void *)0))
2520 {
2521 switch (keynote_lex_list[i].lex_type)
2522 {
2523 case LEXTYPE_CHAR0x1:
2524 free(keynote_lex_list[i].lex_s);
2525 break;
2526 }
2527
2528 keynote_lex_counter--;
2529 keynote_lex_list[i].lex_s = NULL((void *)0);
2530 keynote_lex_list[i].lex_type = 0;
2531 }
2532}
2533
2534/*
2535 * Initialize.
2536 */
2537static int
2538keynote_lex_init(void)
2539{
2540 if (keynote_lex_list != NULL((void *)0))
2541 memset(keynote_lex_list, 0,
2542 keynote_max_lex_list * sizeof(struct lex_list));
2543 else
2544 {
2545 keynote_lex_list = calloc(keynote_max_lex_list,
2546 sizeof(struct lex_list));
2547 if (keynote_lex_list == NULL((void *)0))
2548 {
2549 keynote_errno = ERROR_MEMORY-1;
2550 return -1;
2551 }
2552 }
2553
2554 return RESULT_TRUE1;
2555}
2556
2557/*
2558 * Add the string in a list of allocated but "dangling" memory references.
2559 * If out of memory, free the string and return -1 (and set keynote_errno).
2560 */
2561int
2562keynote_lex_add(void *s, int type)
2563{
2564 struct lex_list *p;
2565 int i;
2566
2567 if (s == NULL((void *)0))
2568 return RESULT_TRUE1;
2569
2570 for (i = 0; i < keynote_max_lex_list; i++)
2571 if (keynote_lex_list[i].lex_s == NULL((void *)0))
2572 {
2573 keynote_lex_list[i].lex_s = (void *) s;
2574 keynote_lex_list[i].lex_type = type;
2575 keynote_lex_counter++;
2576 return RESULT_TRUE1;
2577 }
2578
2579 /* Not enough space, increase the size of the array */
2580 keynote_max_lex_list *= 2;
2581
2582 p = (struct lex_list *) reallocarray(keynote_lex_list,
2583 keynote_max_lex_list,
2584 sizeof(struct lex_list));
2585 if (p == NULL((void *)0))
2586 {
2587 switch (type)
2588 {
2589 case LEXTYPE_CHAR0x1:
2590 free(s);
2591 break;
2592 }
2593
2594 keynote_max_lex_list /= 2;
2595 keynote_errno = ERROR_MEMORY-1;
2596 return -1;
2597 }
2598
2599 keynote_lex_list = p;
2600 keynote_lex_list[i].lex_s = s;
2601 keynote_lex_list[i++].lex_type = type;
2602 keynote_lex_counter++;
2603
2604 /* Zero out the rest */
2605 memset(&(keynote_lex_list[i]), 0,
2606 (keynote_max_lex_list - i) * sizeof(struct lex_list));
2607
2608 return RESULT_TRUE1;
2609}
2610
2611/*
2612 * Remove string.
2613 */
2614void
2615keynote_lex_remove(void *s)
2616{
2617 int i;
2618
2619 for (i = 0; i < keynote_max_lex_list; i++)
2620 if (keynote_lex_list[i].lex_s == s)
2621 {
2622 memset(&(keynote_lex_list[i]), 0, sizeof(struct lex_list));
2623 keynote_lex_counter--;
2624 return;
2625 }
2626}
2627
2628/*
2629 * Return RESULT_TRUE if character is octal digit, RESULT_FALSE otherwise.
2630 */
2631static int
2632is_octal(char c)
2633{
2634 switch (c)
2635 {
2636 case '0': case '1': case '2': case '3':
2637 case '4': case '5': case '6': case '7':
2638 return RESULT_TRUE1;
2639
2640 default:
2641 return RESULT_FALSE0;
2642 }
2643}
2644
2645/*
2646 * Return octal value (non-zero) if argument starts with such a
2647 * representation, otherwise 0.
2648 */
2649static unsigned char
2650get_octal(char *s, int len, int *adv)
2651{
2652 unsigned char res = 0;
2653
2654 if (*s == '0')
2655 {
2656 if (len > 0)
2657 {
2658 if (is_octal(*(s + 1)))
2659 {
2660 res = *(s + 1) - '0';
2661 *adv = 2;
2662
2663 if (is_octal(*(s + 2)) && (len - 1 > 0))
2664 {
2665 res = res * 8 + (*(s + 2) - '0');
2666 *adv = 3;
2667 }
2668 }
2669 }
2670 }
2671 else
2672 if (is_octal(*s) && (len - 1 > 0)) /* Non-zero leading */
2673 {
2674 if (is_octal(*(s + 1)) &&
2675 is_octal(*(s + 2)))
2676 {
2677 *adv = 3;
2678 res = (((*s) - '0') * 64) +
2679 (((*(s + 1)) - '0') * 8) +
2680 ((*(s + 2)) - '0');
2681 }
2682 }
2683
2684 return res;
2685}
2686
2687/*
2688 * Copy at most len characters to string s1 from string s2, taking
2689 * care of escaped characters in the process. String s1 is assumed
2690 * to have enough space, and be zero'ed.
2691 */
2692static void
2693mystrncpy(char *s1, char *s2, int len)
2694{
2695 unsigned char c;
2696 int advance;
2697
2698 if (len == 0)
2699 return;
2700
2701 while (len-- > 0)
2702 {
2703 if (*s2 == '\\')
2704 {
2705 s2++;
2706
2707 if (len-- <= 0)
2708 break;
2709
2710 if (*s2 == '\n')
2711 {
2712 while (isspace((unsigned char)*(++s2)) && (len-- > 0))
2713 ;
2714 }
2715 else
2716 if ((c = get_octal(s2, len, &advance)) != 0)
2717 {
2718 len -= advance - 1;
2719 s2 += advance;
2720 *s1++ = c;
2721 }
2722 else
2723 if (*s2 == 'n') /* Newline */
2724 {
2725 *s1++ = '\n';
2726 s2++;
2727 }
2728 else
2729 if (*s2 == 't') /* Tab */
2730 {
2731 *s1++ = '\t';
2732 s2++;
2733 }
2734 else
2735 if (*s2 == 'r') /* Linefeed */
2736 {
2737 *s1++ = '\r';
2738 s2++;
2739 }
2740 else
2741 if (*s2 == 'f') /* Formfeed */
2742 {
2743 *s1++ = '\f';
2744 s2++;
2745 }
2746 else
2747 if ((*s1++ = *s2++) == 0)
2748 break;
2749
2750 continue;
2751 }
2752
2753 if ((*s1++ = *s2++) == 0)
2754 break;
2755 }
2756}
2757
2758/*
2759 * Evaluate an assertion, with as->as_result holding the result.
2760 * Return RESULT_TRUE if all ok. Also return the result.
2761 */
2762int
2763keynote_evaluate_assertion(struct assertion *as)
2764{
2765 YY_BUFFER_STATE keynote_bs;
2766
2767 /* Non-existent Conditions field means highest return value */
2768 if (as->as_conditions_s == NULL((void *)0))
2769 {
2770 as->as_result = keynote_current_session->ks_values_num - 1;
2771 return RESULT_TRUE1;
2772 }
2773
2774 if (keynote_lex_init() != RESULT_TRUE1)
2775 return -1;
2776
2777 keynote_used_variable = 0;
2778 keynote_init_list = as->as_env; /* Setup the local-init var list */
2779
2780 keynote_bs = kn_scan_bytes(as->as_conditions_s,
2781 as->as_conditions_e - as->as_conditions_s);
2782 BEGIN(yy_start) = 1 + 2 *(ACTIONSTRING1); /* We're doing conditions-string parsing */
2783 first_tok = ACTSTR268;
2784 as->as_result = 0;
2785 keynote_returnvalue = 0;
2786
2787 switch (knparse())
2788 {
2789 case 1: /* Fall through */
2790 keynote_errno = ERROR_SYNTAX-2;
2791 case -1:
2792 as->as_result = 0;
2793 break;
2794
2795 case 0:
2796 as->as_result = keynote_returnvalue;
2797 break;
2798 }
2799
2800 keynote_env_cleanup(&keynote_temp_list, 1);
2801 keynote_lex_zap();
2802 kn_delete_buffer(keynote_bs);
2803
2804 keynote_used_variable = 0;
2805 keynote_returnvalue = 0;
2806 keynote_temp_list = NULL((void *)0);
2807 keynote_init_list = NULL((void *)0);
2808
2809 if (keynote_errno != 0)
2810 return -1;
2811 else
2812 return RESULT_TRUE1;
2813}
2814
2815/*
2816 * Parse/evaluate a key predicate field.
2817 * Store keys in key predicate as keylist in as->as_keylist, if second
2818 * argument is true.
2819 */
2820int
2821keynote_parse_keypred(struct assertion *as, int record)
2822{
2823 YY_BUFFER_STATE keypred_state;
2824 int p = 0, err;
2825
2826 if (as->as_keypred_s == NULL((void *)0))
2827 return keynote_current_session->ks_values_num - 1;
2828
2829 if (keynote_lex_init() != RESULT_TRUE1)
2830 return -1;
2831
2832 keynote_used_variable = 0;
2833 keynote_returnvalue = 0;
2834 keynote_justrecord = record; /* Just want the list of keys in predicate */
2835 keynote_init_list = as->as_env;
2836
2837 keypred_state = kn_scan_bytes(as->as_keypred_s,
2838 as->as_keypred_e - as->as_keypred_s);
2839 BEGIN(yy_start) = 1 + 2 *(KEYPREDICATE3);
2840 first_tok = KEYPRE270;
2841
2842 err = knparse();
2843 if (err != 0)
2844 if (keynote_errno == 0)
2845 keynote_errno = ERROR_SYNTAX-2;
2846
2847 kn_delete_buffer(keypred_state);
2848 keynote_lex_zap();
2849 keynote_cleanup_kth();
2850
2851 keynote_init_list = NULL((void *)0);
2852 keynote_justrecord = 0;
2853 p = keynote_returnvalue;
2854 keynote_returnvalue = 0;
2855
2856 if (record)
2857 {
2858 if (keynote_errno != 0)
2859 {
2860 keynote_keylist_free(keynote_keypred_keylist);
2861 keynote_keypred_keylist = NULL((void *)0);
2862 return -1;
2863 }
2864 else
2865 {
2866 /* Mark for re-processing if/when environment changes */
2867 if (keynote_used_variable)
2868 {
2869 keynote_used_variable = 0;
2870 as->as_internalflags |= ASSERT_IFLAG_WEIRDLICS0x0001;
2871 }
2872
2873 if (as->as_keylist)
2874 keynote_keylist_free(as->as_keylist);
2875 as->as_keylist = keynote_keypred_keylist;
2876 keynote_keypred_keylist = NULL((void *)0);
2877 return RESULT_TRUE1;
2878 }
2879 }
2880 else
2881 return p;
2882}
2883
2884/* Evaluate an authorizer or signature field. Return RESULT_TRUE on success.
2885 * Store key in as->as_authorizer. Second argument is set only for Authorizer
2886 * field parsing.
2887 */
2888int
2889keynote_evaluate_authorizer(struct assertion *as, int flag)
2890{
2891 YY_BUFFER_STATE authorizer_state;
2892 int err;
2893
2894 if (keynote_lex_init() != RESULT_TRUE1)
2895 return -1;
2896
2897 keynote_init_list = as->as_env;
2898 keynote_justrecord = 1;
2899 keynote_used_variable = 0;
2900
2901 if ((flag) && (as->as_authorizer != NULL((void *)0)))
2902 {
2903 keynote_free_key(as->as_authorizer, as->as_signeralgorithm);
2904 as->as_authorizer = NULL((void *)0);
2905 }
2906
2907 if (flag)
2908 authorizer_state = kn_scan_bytes(as->as_authorizer_string_s,
2909 as->as_authorizer_string_e -
2910 as->as_authorizer_string_s);
2911 else
2912 authorizer_state = kn_scan_bytes(as->as_signature_string_s,
2913 as->as_signature_string_e -
2914 as->as_signature_string_s);
2915
2916 BEGIN(yy_start) = 1 + 2 *(SIGNERINIT4);
2917 if (flag)
2918 first_tok = SIGNERKEY273;
2919 else
2920 first_tok = SIGNATUREENTRY277;
2921
2922 err = knparse();
2923 if ((err != 0) && (keynote_errno == 0))
2924 keynote_errno = ERROR_SYNTAX-2;
2925
2926 kn_delete_buffer(authorizer_state);
2927 keynote_lex_zap();
2928
2929 keynote_justrecord = 0;
2930 keynote_init_list = NULL((void *)0);
2931 keynote_returnvalue = 0;
2932
2933 if (keynote_keypred_keylist != NULL((void *)0))
2934 {
2935 if (flag)
2936 {
2937 if (keynote_used_variable)
2938 as->as_internalflags |= ASSERT_IFLAG_WEIRDAUTH0x0002;
2939
2940 as->as_authorizer = keynote_keypred_keylist->key_key;
2941 as->as_signeralgorithm = keynote_keypred_keylist->key_alg;
2942 }
2943 else
2944 {
2945 if (keynote_used_variable)
2946 as->as_internalflags |= ASSERT_IFLAG_WEIRDSIG0x0004;
2947
2948 as->as_signature = keynote_keypred_keylist->key_key;
2949 }
2950
2951 keynote_keypred_keylist->key_key = NULL((void *)0);
2952 keynote_keylist_free(keynote_keypred_keylist);
2953 keynote_keypred_keylist = NULL((void *)0);
2954 }
2955
2956 keynote_used_variable = 0;
2957
2958 if (keynote_errno != 0)
2959 return -1;
2960 else
2961 return RESULT_TRUE1;
2962}
2963
2964/*
2965 * Exportable front-end to keynote_get_private_key().
2966 */
2967char *
2968kn_get_string(char *buf)
2969{
2970 return keynote_get_private_key(buf);
2971}
2972
2973/*
2974 * Parse a private key -- actually, it can deal with any kind of string.
2975 */
2976char *
2977keynote_get_private_key(char *buf)
2978{
2979 YY_BUFFER_STATE pkey;
2980 char *s;
2981 int err;
2982
2983 if (keynote_lex_init() != RESULT_TRUE1)
2984 return NULL((void *)0);
2985
2986 keynote_privkey = NULL((void *)0);
2987 pkey = kn_scan_bytes(buf, strlen(buf));
2988 first_tok = PRIVATEKEY278;
2989 err = knparse();
2990 kn_delete_buffer(pkey);
2991 keynote_lex_zap();
2992
2993 if (err != 0)
2994 {
2995 if (keynote_privkey != NULL((void *)0))
2996 {
2997 free(keynote_privkey);
2998 keynote_privkey = NULL((void *)0);
2999 }
3000
3001 if (keynote_errno == 0)
3002 keynote_errno = ERROR_SYNTAX-2;
3003
3004 return NULL((void *)0);
3005 }
3006
3007 s = keynote_privkey;
3008 keynote_privkey = NULL((void *)0);
3009 return s;
3010}
3011
3012/*
3013 * Parse Local-Constants and KeyNote-Version fields.
3014 */
3015struct environment *
3016keynote_get_envlist(char *buf, char *bufend, int whichfield)
3017{
3018 struct environment *en = NULL((void *)0);
3019 YY_BUFFER_STATE localinit_state;
3020 int err;
3021
3022 if (keynote_lex_init() != RESULT_TRUE1)
3023 return NULL((void *)0);
3024
3025 localinit_state = kn_scan_bytes(buf, bufend - buf);
3026 if (whichfield == 0)
3027 {
3028 BEGIN(yy_start) = 1 + 2 *(LOCALINIT2); /* We're doing Local-Constants parsing */
3029 first_tok = LOCINI269;
3030 }
3031 else
3032 {
3033 BEGIN(yy_start) = 1 + 2 *(KEYNOTEVERSION5); /* KeyNote-Version parsing */
3034 first_tok = KNVERSION271;
3035 }
3036
3037 err = knparse();
3038 if (err != 0)
3039 if (keynote_errno == 0)
3040 keynote_errno = ERROR_SYNTAX-2;
3041
3042 kn_delete_buffer(localinit_state);
3043 keynote_lex_zap();
3044
3045 if (!whichfield)
3046 {
3047 if (keynote_errno != 0)
3048 keynote_env_cleanup(&keynote_init_list, 1);
3049 else
3050 en = keynote_init_list;
3051
3052 keynote_init_list = NULL((void *)0);
3053 }
3054
3055 /* Avoid compiler (-Wall) warnings. Never reached. */
3056 if (0)
3057 {
3058 yyunput(0, NULL((void *)0));
3059 }
3060
3061 return en;
3062}
3063