!verbose varargs support (Ex: !verbose push 3)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6183 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2011-11-20 18:51:35 +00:00
parent 3095000536
commit 9a3f4e0cb1
2 changed files with 43 additions and 29 deletions

View file

@ -3397,11 +3397,21 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
case TOK_P_VERBOSE:
{
extern int g_display_errors;
int k=line.gettoken_enum(1,_T("push\0pop\0"));
int v;
for(int argi=1; argi<line.getnumtokens(); ++argi)
{
int v,k=line.gettoken_enum(argi,_T("push\0pop\0"));
if (k < 0)
{
// just set
v=line.gettoken_int(1);
int numconv;
v=line.gettoken_int(argi,&numconv);
if (!numconv || v < 0 || v > 4 )
{
// < 2.47 would reset level to 0 without warning!
ERROR_MSG("!verbose: Invalid verbose level\n");
return PS_ERROR;
}
}
else
{
if (k)
@ -3414,7 +3424,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
verbose_stack.resize(l-sizeof(int));
}
else
return PS_OK;
{
warning_fl("!verbose: Pop failed, stack is empty");
continue; // Pop failed, should still process the next parameter
}
}
else
{
@ -3437,7 +3450,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
}
}
verbose_stack.add(&v,sizeof(int));
return PS_OK;
continue;
}
}
display_script=v>3;
@ -3446,6 +3459,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
display_errors=v>0;
g_display_errors=display_errors;
}
}
return PS_OK;
case TOK_UNINSTALLEXENAME: PRINTHELP()

View file

@ -258,7 +258,7 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_P_WARNING,_T("!warning"),0,1,_T("[warning_message]"),TP_ALL},
{TOK_P_ERROR,_T("!error"),0,1,_T("[error_message]"),TP_ALL},
{TOK_P_VERBOSE,_T("!verbose"),1,0,_T("verbose_level | push | pop"),TP_ALL},
{TOK_P_VERBOSE,_T("!verbose"),1,-1,_T("(verbose_level | push | pop) [...]"),TP_ALL},
{TOK_P_MACRO,_T("!macro"),1,-1,_T("macroname [parms ...]"),TP_ALL},
{TOK_P_MACROEND,_T("!macroend"),0,0,_T(""),TP_ALL},