On Thursday, 4 January 2007 at 13:57, Dennis Schridde wrote:
> Am Donnerstag, 4. Januar 2007 13:41 schrieb Dennis Schridde:
> > Am Dienstag, 2. Januar 2007 21:12 schrieb Roman:
> > > Author: troman
> > > Date: Tue Jan 2 21:12:14 2007
> > > New Revision: 592
> > >
> > > URL: http://svn.gna.org/viewcvs/warzone?rev=592&view=rev
> > > Log:
> > > -Implemented C-like #include preprocessor directive for the scripting
> > > engine, can be used up to depth of MAX_SCR_INCLUDE_DEPTH. Unlike C
> > > counterpart main purpose is to reuse executable and non-executable code.
> > >
> > > Example:
> > > #include "multiplay/skirmish/my_include.slo"
> > >
> > > -Implemented C-like #define preprocessor directive. Nested macros allowed
> > > with up to depth of MAX_SCR_MACRO_DEPTH. -Added a script function for a
> > > fast feature iteration (returns burning as well as non-burning oil
> > > resources) -Replaced some custom Pumpkin routines with default FLEX
> > > routines
> > > -Some cleanups
> > >
> > > Modified:
> > > trunk/lib/script/chat_parser.y
> > > trunk/lib/script/parse.h
> > > trunk/lib/script/script_lexer.l
> >
> > This one seems to create a problem, but I don't exactly know why:
> > ../lib/script/script_lexer.l: In function ‘scriptSetInputBuffer’:
> > ../lib/script/script_lexer.l:733: error: invalid lvalue in assignment
> >
> > The line it means is apparently:
> > YY_CURRENT_BUFFER = yy_scan_bytes(pBuffer, size);
> >
> > YY_CURRENT_BUFFER is defined to:
> > /* We provide macros for accessing buffer states in case in the
> > * future we want to put the buffer states in a more general
> > * "scanner state".
> > *
> > * Returns the top of the stack, or NULL.
> > */
> > #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
> > ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
> >
> > : NULL)
> >
> > Is there perhaps a function to handle those assignments via a Flex
> > function?
> >
> > If I search for YY_CURRENT_BUFFER in the created lex.c file, I also find
> > YY_CURRENT_BUFFER_LVALUE which is refrenced by several functions which seem
> > to deal with creation of buffers.
> > Also it seems as if Flex has a buffer of YY_BUF_SIZE by default and doesn't
> > need to have the whole file in the buffer... (There seem to be some input
> > streams used.)
> This fix does NOT work:
>
> Index: lib/script/script_lexer.l
> ===================================================================
> --- lib/script/script_lexer.l (revision 594)
> +++ lib/script/script_lexer.l (working copy)
> @@ -729,7 +729,8 @@
> scr__flush_buffer( YY_CURRENT_BUFFER );
>
> //yy_scan_string(pBuffer);
> - YY_CURRENT_BUFFER = yy_scan_bytes(pBuffer, size);
> + if (yy_buffer_stack != NULL)
> + YY_CURRENT_BUFFER_LVALUE = yy_scan_bytes(pBuffer, size);
> }
>
> void scriptGetErrorData(int *pLine, char **ppText)
>
>
> Without the if, it segfaults, with the if it gets into an infinite loop.
What about
if (yy_buffer_stack)
(yy_buffer_stack)[(yy_buffer_stack_top)] = yy_scan_bytes(pBuffer, size);
?
--
Civilization is fun! Anyway, it keeps me busy!!
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev