diff --git a/acc.dsp b/acc.dsp index a6e72c6..ffa8f6a 100644 --- a/acc.dsp +++ b/acc.dsp @@ -66,7 +66,7 @@ LINK32=link.exe # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX- /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/parse.c b/parse.c index 144401a..88c5425 100644 --- a/parse.c +++ b/parse.c @@ -1223,6 +1223,7 @@ static void OuterDefine(boolean force) value = EvalConstExpression(); MS_Message(MSG_DEBUG, "Constant value: %d\n", value); sym->info.constant.value = value; + sym->info.constant.strValue = pa_ConstExprIsString ? strdup(STR_Get(value)) : NULL; // Defines inside an import are deleted when the import is popped. if(ImportMode != IMPORT_Importing || force) { diff --git a/strlist.c b/strlist.c index 6fda296..b79b29a 100644 --- a/strlist.c +++ b/strlist.c @@ -119,6 +119,17 @@ int STR_FindLanguage(char *name) } return i; } + +//========================================================================== +// +// STR_Get +// +//========================================================================== + +char *STR_Get(int num) +{ + return LanguageInfo[0]->list.strings[num].name; +} //========================================================================== // diff --git a/strlist.h b/strlist.h index 40d7f37..0c001b0 100644 --- a/strlist.h +++ b/strlist.h @@ -20,6 +20,7 @@ void STR_Init(void); int STR_Find(char *name); +char *STR_Get(int index); void STR_WriteStrings(void); void STR_WriteList(void); int STR_FindLanguage(char *name); diff --git a/symbol.c b/symbol.c index 3c6a6d0..794d2dc 100644 --- a/symbol.c +++ b/symbol.c @@ -523,6 +523,11 @@ static void DeleteNode(symbolNode_t *node, symbolNode_t **parent_p) symbolNode_t **temp; char *nametemp; + if(node->type == SY_CONSTANT && node->info.constant.strValue != NULL) + { + free(node->info.constant.strValue); + node->info.constant.strValue = NULL; + } if(node->left == NULL) { *parent_p = node->right; diff --git a/symbol.h b/symbol.h index 104116e..25e1964 100644 --- a/symbol.h +++ b/symbol.h @@ -64,6 +64,7 @@ typedef struct typedef struct { int value; + char *strValue; int fileDepth; } symConstant_t; diff --git a/token.c b/token.c index 38546a2..216ef6b 100644 --- a/token.c +++ b/token.c @@ -591,6 +591,7 @@ tokenType_t TK_NextToken(void) AlreadyGot = FALSE; return tk_Token; } + tk_String = TokenStringBuffer; validToken = NO; PrevMasterSourcePos = MasterSourcePos; do @@ -914,8 +915,17 @@ static boolean CheckForConstant(void) { return FALSE; } - tk_Token = TK_NUMBER; - tk_Number = sym->info.constant.value; + if(sym->info.constant.strValue != NULL) + { + MS_Message(MSG_DEBUG, "Constant string: %s\n", sym->info.constant.strValue); + tk_Token = TK_STRING; + tk_String = sym->info.constant.strValue; + } + else + { + tk_Token = TK_NUMBER; + tk_Number = sym->info.constant.value; + } return TRUE; }