ref: a259f53b5296e16dcd596d601ef03a16ceebf966
parent: ffdb1fbfe5e74ba9015ffaf0285f61a8e71d95b1
author: ISSOtm <eldredhabert0@gmail.com>
date: Fri Mar 13 19:20:27 EDT 2020
Rename macro functions with proper prefix
--- a/include/asm/macro.h
+++ b/include/asm/macro.h
@@ -13,15 +13,15 @@
#include "helpers.h"
-void sym_AddNewMacroArg(char const *s);
-void sym_SaveCurrentMacroArgs(char *save[]);
-void sym_RestoreCurrentMacroArgs(char *save[]);
-void sym_UseNewMacroArgs(void);
-char *sym_FindMacroArg(int32_t i);
-void sym_UseCurrentMacroArgs(void);
-void sym_SetMacroArgID(uint32_t nMacroCount);
-void sym_ShiftCurrentMacroArgs(void);
-uint32_t sym_NbMacroArgs(void);
+void macro_AddNewArg(char const *s);
+void macro_SaveCurrentArgs(char *save[]);
+void macro_RestoreCurrentArgs(char *save[]);
+void macro_UseNewArgs(void);
+char *macro_FindArg(int32_t i);
+void macro_UseCurrentArgs(void);
+void macro_SetArgID(uint32_t nMacroCount);
+void macro_ShiftCurrentArgs(void);
+uint32_t macro_NbArgs(void);
void macro_Init(void);
--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -709,7 +709,7 @@
| macroarg ',' macroargs
;
-macroarg : T_STRING { sym_AddNewMacroArg($1); }
+macroarg : T_STRING { macro_AddNewArg($1); }
;
pseudoop : equ
@@ -792,11 +792,11 @@
warn : T_POP_WARN string { warning(WARNING_USER, "%s", $2); }
;
-shift : T_POP_SHIFT { sym_ShiftCurrentMacroArgs(); }
+shift : T_POP_SHIFT { macro_ShiftCurrentArgs(); }
| T_POP_SHIFT uconst {
int32_t i = $2;
while (i--)
- sym_ShiftCurrentMacroArgs();
+ macro_ShiftCurrentArgs();
}
;
--- a/src/asm/fstack.c
+++ b/src/asm/fstack.c
@@ -85,7 +85,7 @@
switch ((*ppFileStack)->nStatus = nCurrentStatus) {
case STAT_isMacroArg:
case STAT_isMacro:
- sym_SaveCurrentMacroArgs((*ppFileStack)->tzMacroArgs);
+ macro_SaveCurrentArgs((*ppFileStack)->tzMacroArgs);
(*ppFileStack)->pMacro = pCurrentMacro;
break;
case STAT_isInclude:
@@ -92,7 +92,7 @@
(*ppFileStack)->pFile = pCurrentFile;
break;
case STAT_isREPTBlock:
- sym_SaveCurrentMacroArgs((*ppFileStack)->tzMacroArgs);
+ macro_SaveCurrentArgs((*ppFileStack)->tzMacroArgs);
(*ppFileStack)->pREPTBlock = pCurrentREPTBlock;
(*ppFileStack)->nREPTBlockSize = nCurrentREPTBlockSize;
(*ppFileStack)->nREPTBlockCount = nCurrentREPTBlockCount;
@@ -122,9 +122,9 @@
yy_scan_bytes(pCurrentREPTBlock,
nCurrentREPTBlockSize);
yy_switch_to_buffer(CurrentFlexHandle);
- sym_UseCurrentMacroArgs();
- sym_SetMacroArgID(nMacroCount++);
- sym_UseNewMacroArgs();
+ macro_UseCurrentArgs();
+ macro_SetArgID(nMacroCount++);
+ macro_UseNewArgs();
/* Increment REPT count in file path */
pREPTIterationWritePtr =
@@ -179,7 +179,7 @@
switch (nCurrentStatus = pLastFile->nStatus) {
case STAT_isMacroArg:
case STAT_isMacro:
- sym_RestoreCurrentMacroArgs(pLastFile->tzMacroArgs);
+ macro_RestoreCurrentArgs(pLastFile->tzMacroArgs);
pCurrentMacro = pLastFile->pMacro;
break;
case STAT_isInclude:
@@ -186,7 +186,7 @@
pCurrentFile = pLastFile->pFile;
break;
case STAT_isREPTBlock:
- sym_RestoreCurrentMacroArgs(pLastFile->tzMacroArgs);
+ macro_RestoreCurrentArgs(pLastFile->tzMacroArgs);
pCurrentREPTBlock = pLastFile->pREPTBlock;
nCurrentREPTBlockSize = pLastFile->nREPTBlockSize;
nCurrentREPTBlockCount = pLastFile->nREPTBlockCount;
@@ -431,10 +431,10 @@
return 0;
pushcontext();
- sym_SetMacroArgID(nMacroCount++);
+ macro_SetArgID(nMacroCount++);
/* Minus 1 because there is a newline at the beginning of the buffer */
nLineNo = sym->nFileLine - 1;
- sym_UseNewMacroArgs();
+ macro_UseNewArgs();
nCurrentStatus = STAT_isMacro;
nPrintedChars = snprintf(tzCurrentFileName, _MAX_PATH + 1,
"%s::%s", sym->tzFileName, s);
@@ -463,7 +463,7 @@
else
s -= '0';
- sym = sym_FindMacroArg(s);
+ sym = macro_FindArg(s);
if (sym == NULL)
fatalerror("No such macroargument");
@@ -505,10 +505,10 @@
/* For error printing to make sense, fake nLineNo */
nCurrentREPTBodyLastLine = nLineNo;
nLineNo = nReptLineNo;
- sym_UseCurrentMacroArgs();
+ macro_UseCurrentArgs();
pushcontext();
- sym_SetMacroArgID(nMacroCount++);
- sym_UseNewMacroArgs();
+ macro_SetArgID(nMacroCount++);
+ macro_UseNewArgs();
nCurrentREPTBlockCount = count;
nCurrentStatus = STAT_isREPTBlock;
nCurrentREPTBlockSize = ulNewMacroSize;
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -197,9 +197,9 @@
char *marg;
if (whichArg == '@')
- marg = sym_FindMacroArg(-1);
+ marg = macro_FindArg(-1);
else if (whichArg >= '1' && whichArg <= '9')
- marg = sym_FindMacroArg(whichArg - '0');
+ marg = macro_FindArg(whichArg - '0');
else
fatalerror("Invalid macro argument '\\%c' in symbol", whichArg);
@@ -306,7 +306,7 @@
yyskipbytes(size);
if ((size == 2 && src[1] >= '1' && src[1] <= '9')) {
- s = sym_FindMacroArg(src[1] - '0');
+ s = macro_FindArg(src[1] - '0');
if (s != NULL)
yyunputstr(s);
@@ -325,7 +325,7 @@
yyskipbytes(size);
- s = sym_FindMacroArg(-1);
+ s = macro_FindArg(-1);
if (s != NULL)
yyunputstr(s);
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -605,7 +605,7 @@
return 0;
}
- s = sym_FindMacroArg(argNum);
+ s = macro_FindArg(argNum);
if (s == NULL)
fatalerror("Macro argument not defined");
--- a/src/asm/macro.c
+++ b/src/asm/macro.c
@@ -11,7 +11,7 @@
static char *currentmacroargs[MAXMACROARGS + 1];
static char *newmacroargs[MAXMACROARGS + 1];
-void sym_AddNewMacroArg(char const *s)
+void macro_AddNewArg(char const *s)
{
int32_t i = 0;
@@ -28,7 +28,7 @@
}
}
-void sym_SaveCurrentMacroArgs(char *save[])
+void macro_SaveCurrentArgs(char *save[])
{
int32_t i;
@@ -38,7 +38,7 @@
}
}
-void sym_RestoreCurrentMacroArgs(char *save[])
+void macro_RestoreCurrentArgs(char *save[])
{
int32_t i;
@@ -48,7 +48,7 @@
}
}
-void sym_UseNewMacroArgs(void)
+void macro_UseNewArgs(void)
{
int32_t i;
@@ -59,7 +59,7 @@
}
}
-char *sym_FindMacroArg(int32_t i)
+char *macro_FindArg(int32_t i)
{
if (i == -1)
i = MAXMACROARGS + 1;
@@ -72,15 +72,15 @@
return currentmacroargs[i - 1];
}
-void sym_UseCurrentMacroArgs(void)
+void macro_UseCurrentArgs(void)
{
int32_t i;
for (i = 1; i <= MAXMACROARGS; i++)
- sym_AddNewMacroArg(sym_FindMacroArg(i));
+ macro_AddNewArg(macro_FindArg(i));
}
-void sym_SetMacroArgID(uint32_t nMacroCount)
+void macro_SetArgID(uint32_t nMacroCount)
{
char s[256];
@@ -88,7 +88,7 @@
newmacroargs[MAXMACROARGS] = strdup(s);
}
-void sym_ShiftCurrentMacroArgs(void)
+void macro_ShiftCurrentArgs(void)
{
int32_t i;
@@ -99,7 +99,7 @@
currentmacroargs[MAXMACROARGS - 1] = NULL;
}
-uint32_t sym_NbMacroArgs(void)
+uint32_t macro_NbArgs(void)
{
uint32_t i = 0;
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -51,7 +51,7 @@
static int32_t Callback_NARG(struct sSymbol const *self)
{
(void)self;
- return sym_NbMacroArgs();
+ return macro_NbArgs();
}
static int32_t Callback__LINE__(struct sSymbol const *self)