diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2001-02-01 20:21:25 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2001-02-01 20:21:25 +0000 |
commit | 8f1fff2e6a5c114c6beafd2983afb55acd3d66ae (patch) | |
tree | e33c08662c708dcfe71591897fe6ffab53bce135 /tools/lemon/lemonflex-tail.inc | |
parent | 07a925ef8b0568a2c5b8098d5734364a40eeb2f6 (diff) |
Create a more modular type system for the FT_* types. Put them
into epan/ftypes.
Re-write display filter routines using Lemon parser instead of yacc.
Besides using a different tool, the new grammar is much simpler, while
the display filter engine itself is more powerful and more easily extended.
Add dftest executable, to test display filter "bytecode" generation.
Add option to "configure" to build dftest or randpkt, both of which are not
built by default.
Implement Ed Warnicke's ideas about dranges in the new display filter and
ftype code.
Remove type FT_TEXT_ONLY in favor of FT_NONE, and have protocols registered
as FT_PROTOCOL. Thus, FT_NONE is used only for simple labels in the proto tree,
while FT_PROTOCOL is used for protocols. This was necessary for being
able to make byte slices (ranges) out of protocols, like "frame[0:3]"
Win32 Makefile.nmake's will be added tonight.
svn path=/trunk/; revision=2967
Diffstat (limited to 'tools/lemon/lemonflex-tail.inc')
-rw-r--r-- | tools/lemon/lemonflex-tail.inc | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/lemon/lemonflex-tail.inc b/tools/lemon/lemonflex-tail.inc new file mode 100644 index 0000000000..04eaf2ab2d --- /dev/null +++ b/tools/lemon/lemonflex-tail.inc @@ -0,0 +1,59 @@ +/* $Id: lemonflex-tail.inc,v 1.1 2001/02/01 20:21:25 gram Exp $ */ + +/* 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) +#define WRAP_FUNC CONCAT(MODNAME,_wrap) + + +/* Resets scanner and assigns the char* argument + * as the text to scan + */ +void +TEXT_FUNC (const 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); +} + +/* 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. + */ +int +WRAP_FUNC () +{ + return 1; /* stop at EOF, instead of looking for next file */ +} + + + |