Added SectionInstType as a SectionIn replacement
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7134 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2c4d91c9fe
commit
5d64346b9d
7 changed files with 46 additions and 37 deletions
|
@ -199,7 +199,7 @@ int LineParser::gettoken_binstrdata(int token, char*buffer, int bufcap) const
|
|||
TCHAR* LineParser::gettoken_str(int token) const
|
||||
{
|
||||
token+=m_eat;
|
||||
if (token < 0 || token >= m_nt) return (TCHAR*) _T("");
|
||||
if (token < 0 || token >= m_nt) return const_cast<TCHAR*>(_T(""));
|
||||
return m_tokens[token];
|
||||
}
|
||||
|
||||
|
|
|
@ -1462,12 +1462,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
}
|
||||
else
|
||||
{
|
||||
TCHAR *itname = line.gettoken_str(1);
|
||||
|
||||
if (!_tcsnicmp(itname, _T("un."), 3)) {
|
||||
set_uninstall_mode(1);
|
||||
itname += 3;
|
||||
}
|
||||
const TCHAR *itname = line.gettoken_str(1), *defname = line.gettoken_str(2), setdef = *defname, *eqstr = setdef ? _T("=") : _T("");
|
||||
if (!_tcsnicmp(itname, _T("un."), 3)) set_uninstall_mode(1), itname += 3;
|
||||
|
||||
for (x = 0; x < NSIS_MAX_INST_TYPES && cur_header->install_types[x]; x++);
|
||||
if (x == NSIS_MAX_INST_TYPES)
|
||||
|
@ -1478,7 +1474,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
else
|
||||
{
|
||||
cur_header->install_types[x] = add_string(itname);
|
||||
SCRIPT_MSG(_T("InstType: %") NPRIs _T("%d=\"%") NPRIs _T("\"\n"), uninstall_mode ? _T("(uninstall) ") : _T(""), x+1, itname);
|
||||
if (setdef) definedlist.set_si32(defname, x);
|
||||
SCRIPT_MSG(_T("InstType: %") NPRIs _T("\"%") NPRIs _T("\" (%") NPRIs _T("%") NPRIs _T("%d)\n"), uninstall_mode ? _T("(uninstall) ") : _T(""), itname, defname, eqstr, x);
|
||||
}
|
||||
|
||||
set_uninstall_mode(0);
|
||||
|
@ -2674,12 +2671,15 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
case TOK_SECTIONEND:
|
||||
SCRIPT_MSG(_T("SectionEnd\n"));
|
||||
return section_end();
|
||||
case TOK_SECTIONIN:
|
||||
case TOK_SECTIONINSTTYPE: // 0 based
|
||||
case TOK_SECTIONIN: // Legacy 1 based instruction
|
||||
{
|
||||
SCRIPT_MSG(_T("SectionIn: "));
|
||||
for (int wt = 1; wt < line.getnumtokens(); wt++)
|
||||
int zerobased = which_token == TOK_SECTIONINSTTYPE, itid, succ;
|
||||
const TCHAR *cmdname = get_commandtoken_name(which_token);
|
||||
SCRIPT_MSG(_T("%") NPRIs _T(": "), cmdname);
|
||||
for (int ti = 0; ++ti < line.getnumtokens();)
|
||||
{
|
||||
TCHAR *p=line.gettoken_str(wt);
|
||||
const TCHAR *p = line.gettoken_str(ti);
|
||||
if (!_tcsicmp(p, _T("RO")))
|
||||
{
|
||||
if (section_add_flags(SF_RO) != PS_OK) return PS_ERROR;
|
||||
|
@ -2687,22 +2687,17 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
}
|
||||
else
|
||||
{
|
||||
int x=_ttoi(p)-1;
|
||||
if (x >= 0 && x < NSIS_MAX_INST_TYPES)
|
||||
itid = line.gettoken_int(ti, &succ) - (zerobased ? 0 : 1);
|
||||
if (succ && itid >= 0 && itid < NSIS_MAX_INST_TYPES)
|
||||
{
|
||||
if (section_add_install_type(1<<x) != PS_OK) return PS_ERROR;
|
||||
SCRIPT_MSG(_T("[%d] "),x);
|
||||
}
|
||||
else if (x < 0)
|
||||
{
|
||||
PRINTHELP()
|
||||
if (section_add_install_type(1<<itid) != PS_OK) return PS_ERROR;
|
||||
SCRIPT_MSG(_T("[%d] "), itid);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_MSG(_T("Error: SectionIn section %d out of range 1-%d\n"),x+1,NSIS_MAX_INST_TYPES);
|
||||
ERROR_MSG(_T("Error: %") NPRIs _T(" %") NPRIs _T(" out of range %d..%d\n"), cmdname, p, 1 - zerobased, NSIS_MAX_INST_TYPES - zerobased);
|
||||
return PS_ERROR;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
SCRIPT_MSG(_T("\n"));
|
||||
|
|
|
@ -121,7 +121,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_INSTCOLORS,_T("InstallColors"),1,1,_T("(/windows | (foreground_color background_color))"),TP_GLOBAL},
|
||||
{TOK_INSTDIR,_T("InstallDir"),1,0,_T("default_install_directory"),TP_GLOBAL},
|
||||
{TOK_INSTPROGRESSFLAGS,_T("InstProgressFlags"),0,-1,_T("[flag [...]]\n flag={smooth|colored}"),TP_GLOBAL},
|
||||
{TOK_INSTTYPE,_T("InstType"),1,0,_T("[un.]install_type_name | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM"),TP_GLOBAL},
|
||||
{TOK_INSTTYPE,_T("InstType"),1,1,_T("[un.]install_type_name [index_output] | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM"),TP_GLOBAL},
|
||||
{TOK_INTOP,_T("IntOp"),3,1,_T("$(user_var: result) val1 OP [val2]\n OP=(+ - * / % | & ^ ~ ! || && << >> >>>)"),TP_CODE},
|
||||
{TOK_INTPTROP,_T("IntPtrOp"),3,1,_T("$(user_var: result) val1 OP [val2]"),TP_CODE},
|
||||
{TOK_INTCMP,_T("IntCmp"),3,2,_T("val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]"),TP_CODE},
|
||||
|
@ -171,6 +171,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_RMDIR,_T("RMDir"),1,2,_T("[/r] [/REBOOTOK] directory_name"),TP_CODE},
|
||||
{TOK_SECTION,_T("Section"),0,3,_T("[/o] [-][un.][section_name] [section index output]"),TP_GLOBAL},
|
||||
{TOK_SECTIONEND,_T("SectionEnd"),0,0,_T(""),TP_SEC},
|
||||
{TOK_SECTIONINSTTYPE,_T("SectionInstType"),1,-1,_T("InstTypeIdx [InstTypeIdx [...]]"),TP_SEC},
|
||||
{TOK_SECTIONIN,_T("SectionIn"),1,-1,_T("InstTypeIdx [InstTypeIdx [...]]"),TP_SEC},
|
||||
{TOK_SUBSECTION,_T("SubSection"),1,2,_T("deprecated - use SectionGroup"),TP_GLOBAL},
|
||||
{TOK_SECTIONGROUP,_T("SectionGroup"),1,2,_T("[/e] [un.]section_group_name [section index output]"),TP_GLOBAL},
|
||||
|
|
|
@ -148,6 +148,7 @@ enum
|
|||
// section/function stuff
|
||||
TOK_SECTION,
|
||||
TOK_SECTIONEND,
|
||||
TOK_SECTIONINSTTYPE,
|
||||
TOK_SECTIONIN,
|
||||
TOK_SECTIONGROUP,
|
||||
TOK_SECTIONGROUPEND,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue