This commit is contained in:
parent
ec9c8c2ab5
commit
5e0a9da493
6 changed files with 702 additions and 798 deletions
|
@ -64,6 +64,7 @@ static int ppf_define(char *_cmd);
|
|||
static int ppf_include(char *_cmd);
|
||||
static int ppf_print(char *_cmd);
|
||||
static int ppf_undefine(char *_cmd);
|
||||
static int ppf_ignore(char *_cmd);
|
||||
|
||||
static int addMacro(char *_name,char *_replacement);
|
||||
static int removeMacro(char *_name);
|
||||
|
@ -78,6 +79,12 @@ static PreproCmd s_preproCmds[]=
|
|||
{ "include", ppf_include },
|
||||
{ "print", ppf_print },
|
||||
{ "undef", ppf_undefine },
|
||||
|
||||
// This is bad but it means we can use the include files generated by parkgrab
|
||||
// ( might have to fix this one day.. )
|
||||
{ "ifdef", ppf_ignore },
|
||||
{ "ifndef", ppf_ignore },
|
||||
{ "endif", ppf_ignore },
|
||||
};
|
||||
static int s_numPreproCmds=sizeof(s_preproCmds)/sizeof(PreproCmd);
|
||||
|
||||
|
@ -110,7 +117,7 @@ extern int preprocessorCmd(char *_cmd)
|
|||
}
|
||||
|
||||
printf("UNKNOWN PREPROCESSOR CMD '%s'\n",_cmd);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,6 +193,19 @@ static int ppf_undefine(char *_cmd)
|
|||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
static int ppf_ignore(char *_cmd)
|
||||
{
|
||||
printf("PRE-PROCESSOR COMMAND IGNORED..\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
|
@ -211,9 +231,16 @@ static int addMacro(char *_name,char *_replacement)
|
|||
// Create new macro
|
||||
newMac=(Macro*)malloc(sizeof(Macro));
|
||||
newMac->m_name=(char*)malloc(strlen(_name)+1);
|
||||
newMac->m_replacement=(char*)malloc(strlen(_replacement)+1);
|
||||
strcpy(newMac->m_name,_name);
|
||||
strcpy(newMac->m_replacement,_replacement);
|
||||
if(_replacement)
|
||||
{
|
||||
newMac->m_replacement=(char*)malloc(strlen(_replacement)+1);
|
||||
strcpy(newMac->m_replacement,_replacement);
|
||||
}
|
||||
else
|
||||
{
|
||||
newMac->m_replacement=NULL;
|
||||
}
|
||||
|
||||
// Insert it into the list
|
||||
mac=s_macros;
|
||||
|
@ -265,7 +292,10 @@ static int removeMacro(char *_name)
|
|||
s_macros=mac->m_next;
|
||||
}
|
||||
free(mac->m_name);
|
||||
free(mac->m_replacement);
|
||||
if(mac->m_replacement)
|
||||
{
|
||||
free(mac->m_replacement);
|
||||
}
|
||||
free(mac);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue