Untangle the symbols in the engine's parser and the Ska parser.

This commit is contained in:
Ryan C. Gordon 2016-04-01 01:48:29 -04:00
parent b29b27a868
commit 5aea1f7c4d
5 changed files with 25 additions and 25 deletions

View File

@ -1035,7 +1035,7 @@ static void ogl_SetVertexArray( GFXVertex4 *pvtx, INDEX ctVtx)
ASSERT( !pglIsEnabled( GL_COLOR_ARRAY)); ASSERT( !pglIsEnabled( GL_COLOR_ARRAY));
ASSERT( !pglIsEnabled( GL_NORMAL_ARRAY)); ASSERT( !pglIsEnabled( GL_NORMAL_ARRAY));
ASSERT( pglIsEnabled( GL_VERTEX_ARRAY)); ASSERT( pglIsEnabled( GL_VERTEX_ARRAY));
pglVertexPointer( 3, GL_FLOAT, 16, pvtx); pglVertexPointer( 3, GL_FLOAT, sizeof (*pvtx), pvtx);
OGL_CHECKERROR; OGL_CHECKERROR;
GFX_bColorArray = FALSE; // mark that color array has been disabled (because of potential LockArrays) GFX_bColorArray = FALSE; // mark that color array has been disabled (because of potential LockArrays)
@ -1053,7 +1053,7 @@ static void ogl_SetNormalArray( GFXNormal *pnor)
pglEnableClientState(GL_NORMAL_ARRAY); pglEnableClientState(GL_NORMAL_ARRAY);
ASSERT( pglIsEnabled(GL_NORMAL_ARRAY)); ASSERT( pglIsEnabled(GL_NORMAL_ARRAY));
pglNormalPointer( GL_FLOAT, 16, pnor); pglNormalPointer( GL_FLOAT, sizeof (*pnor), pnor);
OGL_CHECKERROR; OGL_CHECKERROR;
_sfStats.StopTimer(CStatForm::STI_GFXAPI); _sfStats.StopTimer(CStatForm::STI_GFXAPI);
@ -1069,7 +1069,7 @@ static void ogl_SetColorArray( GFXColor *pcol)
ogl_EnableColorArray(); ogl_EnableColorArray();
_sfStats.StartTimer(CStatForm::STI_GFXAPI); _sfStats.StartTimer(CStatForm::STI_GFXAPI);
pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, pcol); pglColorPointer( 4, GL_UNSIGNED_BYTE, sizeof (*pcol), pcol);
OGL_CHECKERROR; OGL_CHECKERROR;
_sfStats.StopTimer(CStatForm::STI_GFXAPI); _sfStats.StopTimer(CStatForm::STI_GFXAPI);
@ -1086,7 +1086,7 @@ static void ogl_SetTexCoordArray( GFXTexCoord *ptex, BOOL b4/*=FALSE*/)
pglEnableClientState(GL_TEXTURE_COORD_ARRAY); pglEnableClientState(GL_TEXTURE_COORD_ARRAY);
ASSERT( pglIsEnabled(GL_TEXTURE_COORD_ARRAY)); ASSERT( pglIsEnabled(GL_TEXTURE_COORD_ARRAY));
pglTexCoordPointer( b4?4:2, GL_FLOAT, 0, ptex); pglTexCoordPointer( b4?4:2, GL_FLOAT, sizeof (*ptex), ptex);
OGL_CHECKERROR; OGL_CHECKERROR;
_sfStats.StopTimer(CStatForm::STI_GFXAPI); _sfStats.StopTimer(CStatForm::STI_GFXAPI);

View File

@ -71,7 +71,7 @@ void ParseSmcFile_t(CModelInstance &mi, const CTString &fnSmcFile)
_yy_mi = &mi; _yy_mi = &mi;
SMCPushBuffer(fnFileName, strIncludeFile, TRUE); SMCPushBuffer(fnFileName, strIncludeFile, TRUE);
syyparse(); engine_ska_yyparse();
} }
// Create model instance and parse smc file in it // Create model instance and parse smc file in it

View File

@ -1,10 +1,10 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ /* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
// needed for parser and scanner // needed for parser and scanner
extern int yylex(void); extern int engine_ska_yylex(void);
extern void yyerror(char *s); extern void engine_ska_yyerror(char *s);
extern int syyparse(void); extern int engine_ska_yyparse(void);
extern void syyrestart(FILE *f); extern void engine_ska_yyrestart(FILE *f);
#define YY_NEVER_INTERACTIVE 1 #define YY_NEVER_INTERACTIVE 1

View File

@ -8,9 +8,9 @@
#include <Engine/Templates/DynamicContainer.cpp> #include <Engine/Templates/DynamicContainer.cpp>
// for static linking mojo... // for static linking mojo...
#define yyparse yyparse_engine_ska_smcpars #define yyparse engine_ska_yyparse
#define yyerror yyerror_engine_ska_smcpars #define yyerror engine_ska_yyerror
#define yylex yylex_engine_ska_smcpars #define yylex engine_ska_yylex
#include "ParsingSmbs.h" #include "ParsingSmbs.h"
extern BOOL bRememberSourceFN; extern BOOL bRememberSourceFN;

View File

@ -1,4 +1,4 @@
%option prefix="syy" %option prefix="engine_ska_yy"
%{ %{
#include <Engine/Base/CTString.h> #include <Engine/Base/CTString.h>
#include <Engine/Base/CTString.inl> #include <Engine/Base/CTString.inl>
@ -12,13 +12,13 @@
extern CTFileName _fnmApplicationPath; extern CTFileName _fnmApplicationPath;
YYSTYPE syylval; YYSTYPE engine_ska_yylval;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { int syywrap(void); } extern "C" { int engine_ska_yywrap(void); }
#endif #endif
int syywrap(void) int engine_ska_yywrap(void)
{ {
// no more buffers // no more buffers
return 1; return 1;
@ -45,13 +45,13 @@ void SMCPushBuffer(const char *strName, const char *strBuffer, BOOL bParserEnd)
_abseBufferStack[_ibsBufferStackTop].bse_iLineCt = 1; _abseBufferStack[_ibsBufferStackTop].bse_iLineCt = 1;
_abseBufferStack[_ibsBufferStackTop].bse_bParserEnd = bParserEnd; _abseBufferStack[_ibsBufferStackTop].bse_bParserEnd = bParserEnd;
_abseBufferStack[_ibsBufferStackTop].bse_bs = syy_scan_string((char*)(const char*)strBuffer); _abseBufferStack[_ibsBufferStackTop].bse_bs = engine_ska_yy_scan_string((char*)(const char*)strBuffer);
syy_switch_to_buffer(_abseBufferStack[_ibsBufferStackTop].bse_bs); engine_ska_yy_switch_to_buffer(_abseBufferStack[_ibsBufferStackTop].bse_bs);
} }
BOOL SMCPopBuffer(void) BOOL SMCPopBuffer(void)
{ {
syy_delete_buffer( _abseBufferStack[_ibsBufferStackTop].bse_bs); engine_ska_yy_delete_buffer( _abseBufferStack[_ibsBufferStackTop].bse_bs);
free((void*)_abseBufferStack[_ibsBufferStackTop].bse_strName); free((void*)_abseBufferStack[_ibsBufferStackTop].bse_strName);
free((void*)_abseBufferStack[_ibsBufferStackTop].bse_strContents); free((void*)_abseBufferStack[_ibsBufferStackTop].bse_strContents);
BOOL bParserEnd = _abseBufferStack[_ibsBufferStackTop].bse_bParserEnd; BOOL bParserEnd = _abseBufferStack[_ibsBufferStackTop].bse_bParserEnd;
@ -59,7 +59,7 @@ BOOL SMCPopBuffer(void)
_ibsBufferStackTop--; _ibsBufferStackTop--;
if (_ibsBufferStackTop>=0) { if (_ibsBufferStackTop>=0) {
syy_switch_to_buffer(_abseBufferStack[_ibsBufferStackTop].bse_bs); engine_ska_yy_switch_to_buffer(_abseBufferStack[_ibsBufferStackTop].bse_bs);
} }
return bParserEnd; return bParserEnd;
} }
@ -152,16 +152,16 @@ EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+)
/* constants */ /* constants */
"-"?{DIGIT}+ { syylval.i = atoi(yytext); return(c_int); } "-"?{DIGIT}+ { engine_ska_yylval.i = atoi(yytext); return(c_int); }
"0x"{HEXDIGIT}+ { syylval.i = strtoul(yytext+2, NULL, 16); return(c_int);} "0x"{HEXDIGIT}+ { engine_ska_yylval.i = strtoul(yytext+2, NULL, 16); return(c_int);}
"-"?{NONEXP_FLT}("f"|"F")? { syylval.f = (float) atof(yytext); return(c_float); } "-"?{NONEXP_FLT}("f"|"F")? { engine_ska_yylval.f = (float) atof(yytext); return(c_float); }
"-"?{EXP_FLT}("f"|"F")? { syylval.f = (float) atof(yytext); return(c_float); } "-"?{EXP_FLT}("f"|"F")? { engine_ska_yylval.f = (float) atof(yytext); return(c_float); }
"\""{STRINGCONTENT}*"\"" { "\""{STRINGCONTENT}*"\"" {
char *strNew; char *strNew;
// remove double-quotes // remove double-quotes
yytext[strlen(yytext)-1] = 0; yytext[strlen(yytext)-1] = 0;
strNew = yytext+1; strNew = yytext+1;
syylval.str = (const char*)strNew; engine_ska_yylval.str = (const char*)strNew;
return(c_string); return(c_string);
} }