File: lemonflex-tail.inc

package info (click to toggle)
wireshark 1.8.2-5wheezy18
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 196,124 kB
  • sloc: ansic: 2,186,574; xml: 55,064; python: 30,233; perl: 22,353; sh: 13,118; pascal: 5,964; lex: 4,963; cpp: 3,604; makefile: 3,471; yacc: 266; asm: 156; tcl: 35
file content (76 lines) | stat: -rw-r--r-- 1,745 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* $Id: lemonflex-tail.inc 25172 2008-04-25 17:24:29Z wmeier $ */

/* This file is #include'd at the bottom of a Lex/Flex scanner
for use with the Lemon parser. You must have #define'd:

MODNAME		module name for creating function names:

Prototypes:

void	MODNAME_scanner_text(char *text);
void	MODNAME_scanner_cleanup(void);
int	MODNAME_wrap(void);
*/

#include <cppmagic.h>

#define TEXT_FUNC	CONCAT(MODNAME,_scanner_text)
#define FILE_FUNC	CONCAT(MODNAME,_scanner_file)
#define CLEANUP_FUNC	CONCAT(MODNAME,_scanner_cleanup)
#ifndef YY_SKIP_YYWRAP
#define WRAP_FUNC	CONCAT(MODNAME,_wrap)
#endif

/* flex 2.5.31 no longer #defines these as yy_* if used with -P. */
#ifndef yy_scan_string
#define yy_scan_string		CONCAT(FLEX_YY_PREFIX, _scan_string)
#endif

#ifndef yy_create_buffer
#define yy_create_buffer	CONCAT(FLEX_YY_PREFIX, _create_buffer)
#endif

#ifndef yy_switch_to_buffer
#define yy_switch_to_buffer	CONCAT(FLEX_YY_PREFIX, _switch_to_buffer)
#endif

#ifndef yy_delete_buffer
#define yy_delete_buffer	CONCAT(FLEX_YY_PREFIX, _delete_buffer)
#endif

/* Resets scanner and assigns the char* argument
 * as the text to scan
 */
void
TEXT_FUNC (char *text)
{
	yy_scan_string(text);
}

void
FILE_FUNC (FILE* fh)
{
	YY_BUFFER_STATE new_buffer;

	new_buffer = yy_create_buffer(fh, YY_BUF_SIZE);
	yy_switch_to_buffer(new_buffer);
}

void
CLEANUP_FUNC (void)
{
	BEGIN(INITIAL);
	yy_delete_buffer(YY_CURRENT_BUFFER);
}

#ifndef YY_SKIP_YYWRAP
/* Flex has an option '%option noyywrap' so that I don't have to
 * provide this yywrap function, but in order to maintain portability,
 * I'll just use this yywrap() function if that option wasn't used.
 */
int
WRAP_FUNC (void)
{
	return 1; /* stop at EOF, instead of looking for next file */
}
#endif