1145519Sdarrenr/* $FreeBSD$ */ 2145510Sdarrenr 3170268Sdarrenr/* 4255332Scy * Copyright (C) 2012 by Darren Reed. 5170268Sdarrenr * 6170268Sdarrenr * See the IPFILTER.LICENCE file for details on licencing. 7170268Sdarrenr */ 8145510Sdarrenr 9145510Sdarrenrextern long string_start; 10145510Sdarrenrextern long string_end; 11145510Sdarrenrextern char *string_val; 12145510Sdarrenrextern long pos; 13145510Sdarrenr 14145510Sdarrenr#define YY_INPUT(buf, result, max_size) \ 15145510Sdarrenr if (pos >= string_start && pos <= string_end) { \ 16145510Sdarrenr buf[0] = string_val[pos - string_start]; \ 17145510Sdarrenr pos++; \ 18145510Sdarrenr result = 1; \ 19145510Sdarrenr } else if ( yy_current_buffer->yy_is_interactive ) \ 20145510Sdarrenr { \ 21145510Sdarrenr int c = '*', n; \ 22145510Sdarrenr for ( n = 0; n < 1 && \ 23145510Sdarrenr (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 24145510Sdarrenr buf[n] = (char) c; \ 25145510Sdarrenr if ( c == '\n' ) \ 26145510Sdarrenr buf[n++] = (char) c; \ 27145510Sdarrenr if ( c == EOF && ferror( yyin ) ) \ 28145510Sdarrenr YY_FATAL_ERROR( "input in flex scanner failed" ); \ 29145510Sdarrenr result = n; \ 30145510Sdarrenr pos++; \ 31145510Sdarrenr } \ 32145510Sdarrenr else if ( ((result = fread( buf, 1, 1, yyin )) == 0) \ 33145510Sdarrenr && ferror( yyin ) ) \ 34145510Sdarrenr YY_FATAL_ERROR( "input in flex scanner failed" ); 35145510Sdarrenr 36145510Sdarrenr#ifdef input 37145510Sdarrenr# undef input 38145510Sdarrenr# define input() (((pos >= string_start) && (pos < string_end)) ? \ 39145510Sdarrenr yysptr = yysbuf, string_val[pos++ - string_start] : \ 40145510Sdarrenr ((yytchar = yysptr > yysbuf ? U(*--yysptr) : \ 41145510Sdarrenr getc(yyin)) == 10 ? (pos++, yylineno++, yytchar) : \ 42145510Sdarrenr yytchar) == EOF ? (pos++, 0) : (pos++, yytchar)) 43145510Sdarrenr#endif 44145510Sdarrenr 45145510Sdarrenr#ifdef lex_input 46145510Sdarrenr# undef lex_input 47145510Sdarrenr# define lex_input() (((pos >= string_start) && (pos < string_end)) ? \ 48145510Sdarrenr yysptr = yysbuf, string_val[pos++ - string_start] : \ 49145510Sdarrenr ((yytchar = yysptr > yysbuf ? U(*--yysptr) : \ 50145510Sdarrenr getc(yyin)) == 10 ? (pos++, yylineno++, yytchar) : \ 51145510Sdarrenr yytchar) == EOF ? (pos++, 0) : (pos++, yytchar)) 52145510Sdarrenr#endif 53145510Sdarrenr 54145510Sdarrenr#ifdef unput 55145510Sdarrenr# undef unput 56145510Sdarrenr# define unput(c) { if (pos > 0) pos--; \ 57145510Sdarrenr yytchar = (c); if (yytchar == '\n') yylineno--; \ 58145510Sdarrenr *yysptr++ = yytchar; } 59145510Sdarrenr#endif 60145510Sdarrenr 61