Use tokenmap_t struct to define all CON keywords

git-svn-id: https://svn.eduke32.com/eduke32@6432 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-08-27 10:20:23 +00:00
parent 81031df924
commit 98cd4a5c6c
4 changed files with 932 additions and 953 deletions

File diff suppressed because it is too large Load diff

View file

@ -196,14 +196,14 @@ void C_Compile(const char *filenam);
extern int32_t g_errorLineNum;
extern int32_t g_tw;
extern const char *keyw[];
typedef struct {
const char* token;
int32_t val;
} tokenmap_t;
extern const tokenmap_t iter_tokens [];
extern const tokenmap_t vm_keywords[];
extern const tokenmap_t iter_tokens[];
// KEEPINSYNC lunatic/con_lang.lua
enum SystemString_t {

View file

@ -102,7 +102,7 @@ void VM_ScriptInfo(intptr_t const *ptr, int range)
initprintf("%5d: %3d: ", (int32_t) (pScript - apScript), (int32_t) (pScript - ptr));
if (*pScript >> 12 && (*pScript & VM_INSTMASK) < CON_END)
initprintf("%5d %s\n", (int32_t) (*pScript >> 12), keyw[*pScript & VM_INSTMASK]);
initprintf("%5d %s\n", (int32_t) (*pScript >> 12), vm_keywords[*pScript & VM_INSTMASK].token);
else
initprintf("%d\n", (int32_t) *pScript);
}
@ -3856,7 +3856,7 @@ finish_qsprintf:
index=Gv_GetVarX(*insptr++);
if (EDUKE32_PREDICT_TRUE((unsigned)index < (unsigned)aGameArrays[lVarID].size))
{
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n", keyw[g_tw], g_errorLineNum,
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n", vm_keywords[g_tw].token, g_errorLineNum,
aGameArrays[lVarID].szLabel, index,
(int32_t)(m*Gv_GetArrayValue(lVarID, index)));
continue;
@ -3881,7 +3881,7 @@ finish_qsprintf:
Gv_GetVarX(*insptr++);
continue;
}
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %d %d\n",keyw[g_tw],g_errorLineNum,index,Gv_GetVar(*insptr++,index,vm.playerNum));
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %d %d\n",vm_keywords[g_tw].token,g_errorLineNum,index,Gv_GetVar(*insptr++,index,vm.playerNum));
continue;
}
}
@ -5276,7 +5276,7 @@ finish_qsprintf:
CON_ERRPRINTF("invalid iterator type %d", iterType);
continue;
badindex:
OSD_Printf(OSD_ERROR "Line %d, %s %s: index %d out of range!\n", g_errorLineNum, keyw[g_tw],
OSD_Printf(OSD_ERROR "Line %d, %s %s: index %d out of range!\n", g_errorLineNum, vm_keywords[g_tw].token,
iter_tokens[iterType].token, nIndex);
continue;
}

View file

@ -100,12 +100,12 @@ static FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum, int playerNu
}
#define CON_ERRPRINTF(Text, ...) do { \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, vm_keywords[g_tw].token, ## __VA_ARGS__); \
} while (0)
#define CON_CRITICALERRPRINTF(Text, ...) do { \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
wm_msgbox(APPNAME, "Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, vm_keywords[g_tw].token, ## __VA_ARGS__); \
wm_msgbox(APPNAME, "Line %d, %s: " Text, g_errorLineNum, vm_keywords[g_tw].token, ## __VA_ARGS__); \
} while (0)
void G_GetTimeDate(int32_t * const pValues);