From 5aea1f7c4dbd3182d10392c6f348db589b26fda7 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 1 Apr 2016 01:48:29 -0400 Subject: [PATCH] Untangle the symbols in the engine's parser and the Ska parser. --- .../Engine/Graphics/Gfx_wrapper_OpenGL.cpp | 8 +++--- Sources/Engine/Ska/ModelInstance.cpp | 2 +- Sources/Engine/Ska/ParsingSmbs.h | 8 +++--- Sources/Engine/Ska/smcPars.y | 6 ++--- Sources/Engine/Ska/smcScan.l | 26 +++++++++---------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Sources/Engine/Graphics/Gfx_wrapper_OpenGL.cpp b/Sources/Engine/Graphics/Gfx_wrapper_OpenGL.cpp index cb4e2ec..f3a39ab 100644 --- a/Sources/Engine/Graphics/Gfx_wrapper_OpenGL.cpp +++ b/Sources/Engine/Graphics/Gfx_wrapper_OpenGL.cpp @@ -1035,7 +1035,7 @@ static void ogl_SetVertexArray( GFXVertex4 *pvtx, INDEX ctVtx) ASSERT( !pglIsEnabled( GL_COLOR_ARRAY)); ASSERT( !pglIsEnabled( GL_NORMAL_ARRAY)); ASSERT( pglIsEnabled( GL_VERTEX_ARRAY)); - pglVertexPointer( 3, GL_FLOAT, 16, pvtx); + pglVertexPointer( 3, GL_FLOAT, sizeof (*pvtx), pvtx); OGL_CHECKERROR; 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); ASSERT( pglIsEnabled(GL_NORMAL_ARRAY)); - pglNormalPointer( GL_FLOAT, 16, pnor); + pglNormalPointer( GL_FLOAT, sizeof (*pnor), pnor); OGL_CHECKERROR; _sfStats.StopTimer(CStatForm::STI_GFXAPI); @@ -1069,7 +1069,7 @@ static void ogl_SetColorArray( GFXColor *pcol) ogl_EnableColorArray(); _sfStats.StartTimer(CStatForm::STI_GFXAPI); - pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, pcol); + pglColorPointer( 4, GL_UNSIGNED_BYTE, sizeof (*pcol), pcol); OGL_CHECKERROR; _sfStats.StopTimer(CStatForm::STI_GFXAPI); @@ -1086,7 +1086,7 @@ static void ogl_SetTexCoordArray( GFXTexCoord *ptex, BOOL b4/*=FALSE*/) pglEnableClientState(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; _sfStats.StopTimer(CStatForm::STI_GFXAPI); diff --git a/Sources/Engine/Ska/ModelInstance.cpp b/Sources/Engine/Ska/ModelInstance.cpp index 5ec5c2c..4301259 100644 --- a/Sources/Engine/Ska/ModelInstance.cpp +++ b/Sources/Engine/Ska/ModelInstance.cpp @@ -71,7 +71,7 @@ void ParseSmcFile_t(CModelInstance &mi, const CTString &fnSmcFile) _yy_mi = &mi; SMCPushBuffer(fnFileName, strIncludeFile, TRUE); - syyparse(); + engine_ska_yyparse(); } // Create model instance and parse smc file in it diff --git a/Sources/Engine/Ska/ParsingSmbs.h b/Sources/Engine/Ska/ParsingSmbs.h index a8ab588..bdfebc3 100644 --- a/Sources/Engine/Ska/ParsingSmbs.h +++ b/Sources/Engine/Ska/ParsingSmbs.h @@ -1,10 +1,10 @@ /* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ // needed for parser and scanner -extern int yylex(void); -extern void yyerror(char *s); -extern int syyparse(void); -extern void syyrestart(FILE *f); +extern int engine_ska_yylex(void); +extern void engine_ska_yyerror(char *s); +extern int engine_ska_yyparse(void); +extern void engine_ska_yyrestart(FILE *f); #define YY_NEVER_INTERACTIVE 1 diff --git a/Sources/Engine/Ska/smcPars.y b/Sources/Engine/Ska/smcPars.y index f918c2e..b11a3a0 100644 --- a/Sources/Engine/Ska/smcPars.y +++ b/Sources/Engine/Ska/smcPars.y @@ -8,9 +8,9 @@ #include // for static linking mojo... -#define yyparse yyparse_engine_ska_smcpars -#define yyerror yyerror_engine_ska_smcpars -#define yylex yylex_engine_ska_smcpars +#define yyparse engine_ska_yyparse +#define yyerror engine_ska_yyerror +#define yylex engine_ska_yylex #include "ParsingSmbs.h" extern BOOL bRememberSourceFN; diff --git a/Sources/Engine/Ska/smcScan.l b/Sources/Engine/Ska/smcScan.l index 7bb4f10..15f4fb6 100644 --- a/Sources/Engine/Ska/smcScan.l +++ b/Sources/Engine/Ska/smcScan.l @@ -1,4 +1,4 @@ -%option prefix="syy" +%option prefix="engine_ska_yy" %{ #include #include @@ -12,13 +12,13 @@ extern CTFileName _fnmApplicationPath; -YYSTYPE syylval; +YYSTYPE engine_ska_yylval; #ifdef __cplusplus -extern "C" { int syywrap(void); } +extern "C" { int engine_ska_yywrap(void); } #endif -int syywrap(void) +int engine_ska_yywrap(void) { // no more buffers return 1; @@ -45,13 +45,13 @@ void SMCPushBuffer(const char *strName, const char *strBuffer, BOOL bParserEnd) _abseBufferStack[_ibsBufferStackTop].bse_iLineCt = 1; _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) { - 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_strContents); BOOL bParserEnd = _abseBufferStack[_ibsBufferStackTop].bse_bParserEnd; @@ -59,7 +59,7 @@ BOOL SMCPopBuffer(void) _ibsBufferStackTop--; if (_ibsBufferStackTop>=0) { - syy_switch_to_buffer(_abseBufferStack[_ibsBufferStackTop].bse_bs); + engine_ska_yy_switch_to_buffer(_abseBufferStack[_ibsBufferStackTop].bse_bs); } return bParserEnd; } @@ -152,16 +152,16 @@ EXP_FLT (({DIGIT}+("."({DIGIT}*)?)?)("E"|"e")("+"|"-")?{DIGIT}+) /* constants */ -"-"?{DIGIT}+ { syylval.i = atoi(yytext); return(c_int); } -"0x"{HEXDIGIT}+ { syylval.i = strtoul(yytext+2, NULL, 16); return(c_int);} -"-"?{NONEXP_FLT}("f"|"F")? { syylval.f = (float) atof(yytext); return(c_float); } -"-"?{EXP_FLT}("f"|"F")? { syylval.f = (float) atof(yytext); return(c_float); } +"-"?{DIGIT}+ { engine_ska_yylval.i = atoi(yytext); return(c_int); } +"0x"{HEXDIGIT}+ { engine_ska_yylval.i = strtoul(yytext+2, NULL, 16); return(c_int);} +"-"?{NONEXP_FLT}("f"|"F")? { engine_ska_yylval.f = (float) atof(yytext); return(c_float); } +"-"?{EXP_FLT}("f"|"F")? { engine_ska_yylval.f = (float) atof(yytext); return(c_float); } "\""{STRINGCONTENT}*"\"" { char *strNew; // remove double-quotes yytext[strlen(yytext)-1] = 0; strNew = yytext+1; - syylval.str = (const char*)strNew; + engine_ska_yylval.str = (const char*)strNew; return(c_string); }