On Wed August 3 2005 18:15, Henrik Sorensen wrote: > I had a problem with some of the functions since they use the YY_BUFFER_STATE > structure, and YY_BUFFER_STATE uses yy_buffer_state and yy_site_t. > > I have created a separate header file where I copied the necessary pieces > from > the generated lex.yy.c file. > Obviously this is not really portable between versions of flex. > > Is there anyway to get flex to export the necessary definitions to a file ?
The beta versions of flex (http://sourceforge.net/projects/lex/) provide ways to generate a header file (%option header-file and command-line --header-file) containing definitions which can be #included by other C files. Depending on your code structure, you may need to edit (e.g. via sed, grep, awk, etc.) the generated header file. > Are there any other way to do this ? You could (and must in some cases, e.g. to access YYSTATE or yy_start_stack_ptr in a reentrant lexical analyzer) put stub code in the .l file and call that from an external file which contains detailed code. Neither of these methods is going to work absolutely portably between flex versions (older versions have no header-file option, generated header file content and internal name changes vary with versions). _______________________________________________ Help-flex mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-flex
