Added preprocess only mode (/[SAFE]PPO switch)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6495 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2014-06-19 19:06:49 +00:00
parent d91176ba49
commit 0bffaecea3
9 changed files with 99 additions and 38 deletions

View file

@ -335,10 +335,29 @@ bool CEXEBuild::is_ppbranch_token(TCHAR *s)
case TOK_P_IFDEF: case TOK_P_IFNDEF:
case TOK_P_IFMACRODEF: case TOK_P_IFMACRONDEF:
return true;
default: return false;
default:
return false;
}
}
bool CEXEBuild::is_pp_token(int tkid)
{
// NOTE: This assumes that all TOK_P_* in tokens.h are grouped together.
return (tkid >= TOK_P_IF && tkid <= TOK_P_SEARCHREPLACESTRING);
}
bool CEXEBuild::is_unsafe_pp_token(int tkid)
{
switch(tkid)
{
case TOK_P_TEMPFILE: case TOK_P_APPENDFILE: case TOK_P_DELFILE:
case TOK_P_SYSTEMEXEC: case TOK_P_EXECUTE: case TOK_P_FINALIZE:
case TOK_P_PACKEXEHEADER:
return true;
}
return false;
}
int CEXEBuild::get_commandtoken(TCHAR *s, int *np, int *op, int *pos)
{
for (int x = 0; x < TOK__LAST; x ++)
@ -355,16 +374,7 @@ int CEXEBuild::get_commandtoken(TCHAR *s, int *np, int *op, int *pos)
int CEXEBuild::GetCurrentTokenPlace()
{
if (build_cursection)
{
if (build_cursection_isfunc)
{
return TP_FUNC;
}
else
{
return TP_SEC;
}
}
return build_cursection_isfunc ? TP_FUNC : TP_SEC;
if (cur_page)
return TP_PAGEEX;
@ -374,6 +384,8 @@ int CEXEBuild::GetCurrentTokenPlace()
int CEXEBuild::IsTokenPlacedRight(int pos, TCHAR *tok)
{
if (preprocessonly)
return PS_OK;
if ((unsigned int) pos > (sizeof(tokenlist) / sizeof(tokenType)))
return PS_OK;