Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ipf / tools / lex_var.h
blob4bc491583c76d7f0f6da712916f2f82efb207073
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2002 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
7 */
9 extern long string_start;
10 extern long string_end;
11 extern char *string_val;
12 extern long pos;
14 #define YY_INPUT(buf, result, max_size) \
15 if (pos >= string_start && pos <= string_end) { \
16 buf[0] = string_val[pos - string_start]; \
17 pos++; \
18 result = 1; \
19 } else if ( yy_current_buffer->yy_is_interactive ) \
20 { \
21 int c = '*', n; \
22 for ( n = 0; n < 1 && \
23 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
24 buf[n] = (char) c; \
25 if ( c == '\n' ) \
26 buf[n++] = (char) c; \
27 if ( c == EOF && ferror( yyin ) ) \
28 YY_FATAL_ERROR( "input in flex scanner failed" ); \
29 result = n; \
30 pos++; \
31 } \
32 else if ( ((result = fread( buf, 1, 1, yyin )) == 0) \
33 && ferror( yyin ) ) \
34 YY_FATAL_ERROR( "input in flex scanner failed" );
36 #ifdef input
37 # undef input
38 # define input() (((pos >= string_start) && (pos < string_end)) ? \
39 yysptr = yysbuf, string_val[pos++ - string_start] : \
40 ((yytchar = yysptr > yysbuf ? U(*--yysptr) : \
41 getc(yyin)) == 10 ? (pos++, yylineno++, yytchar) : \
42 yytchar) == EOF ? (pos++, 0) : (pos++, yytchar))
43 #endif
45 #ifdef lex_input
46 # undef lex_input
47 # define lex_input() (((pos >= string_start) && (pos < string_end)) ? \
48 yysptr = yysbuf, string_val[pos++ - string_start] : \
49 ((yytchar = yysptr > yysbuf ? U(*--yysptr) : \
50 getc(yyin)) == 10 ? (pos++, yylineno++, yytchar) : \
51 yytchar) == EOF ? (pos++, 0) : (pos++, yytchar))
52 #endif
54 #ifdef unput
55 # undef unput
56 # define unput(c) { if (pos > 0) pos--; \
57 yytchar = (c); if (yytchar == '\n') yylineno--; \
58 *yysptr++ = yytchar; }
59 #endif