* Get rid of global variable *psCurrRes, which is used by the strres_parser to operate on
* Instead pass the current STR_RES* pointer to work on to the parser function git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5654 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
d9baa8d8b7
commit
e8efe132f8
|
@ -68,9 +68,6 @@ typedef struct STR_RES
|
|||
/* Static forward declarations */
|
||||
static void strresReleaseIDStrings(STR_RES *psRes);
|
||||
|
||||
/* The string resource currently being loaded */
|
||||
STR_RES *psCurrRes;
|
||||
|
||||
/* Allocate a string block */
|
||||
static STR_BLOCK* strresAllocBlock(const size_t size)
|
||||
{
|
||||
|
@ -380,11 +377,8 @@ BOOL strresLoad(STR_RES* psRes, const char* fileName)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Set string resource to operate on
|
||||
psCurrRes = psRes;
|
||||
|
||||
strres_set_extra(&input);
|
||||
retval = (strres_parse() == 0);
|
||||
retval = (strres_parse(psRes) == 0);
|
||||
|
||||
strres_lex_destroy();
|
||||
PHYSFS_close(input.input.physfsfile);
|
||||
|
|
|
@ -36,6 +36,11 @@ void yyerror(const char* msg)
|
|||
debug(LOG_ERROR, "STRRES file parse error:\n%s at line %d\nText: '%s'", msg, strres_get_lineno(), strres_get_text());
|
||||
}
|
||||
|
||||
// Forward declaration to allow pointers to this type
|
||||
struct STR_RES;
|
||||
|
||||
#define YYPARSE_PARAM psStrRes
|
||||
|
||||
%}
|
||||
|
||||
%name-prefix="strres_"
|
||||
|
@ -70,7 +75,7 @@ file: line
|
|||
line: TEXT_T string
|
||||
{
|
||||
/* Pass the text string to the string manager */
|
||||
const bool success = strresStoreString(psCurrRes, $1, $2);
|
||||
const bool success = strresStoreString((struct STR_RES*)psStrRes, $1, $2);
|
||||
|
||||
// Clean up our tokens
|
||||
free($1);
|
||||
|
|
|
@ -25,14 +25,11 @@
|
|||
|
||||
#include "lib/framework/lexer_input.h"
|
||||
|
||||
/* The string resource currently being loaded */
|
||||
extern struct STR_RES* psCurrRes;
|
||||
|
||||
/* Set the current input buffer for the lexer - used by strresLoad */
|
||||
extern void strres_set_extra(YY_EXTRA_TYPE user_defined);
|
||||
|
||||
/* Call the yacc parser */
|
||||
extern int strres_parse(void);
|
||||
extern int strres_parse(void* psStrRes);
|
||||
|
||||
/* Destroy the lexer */
|
||||
extern int strres_lex_destroy(void);
|
||||
|
|
Loading…
Reference in New Issue