Fixed a bug with !if and friends and fixed an ancient bug with line counting going wrong with macros
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1859 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
8c064dcf90
commit
34d7fc0f9b
2 changed files with 15 additions and 7 deletions
|
@ -83,7 +83,7 @@ class CEXEBuild {
|
||||||
int parseScript(FILE *fp, const char *curfilename, int *lineptr);
|
int parseScript(FILE *fp, const char *curfilename, int *lineptr);
|
||||||
void ps_addtoline(const char *str, GrowBuf &linedata, StringList &hist);
|
void ps_addtoline(const char *str, GrowBuf &linedata, StringList &hist);
|
||||||
int doParse(const char *str, FILE *fp, const char *curfilename, int *lineptr);
|
int doParse(const char *str, FILE *fp, const char *curfilename, int *lineptr);
|
||||||
int doCommand(int which_token, LineParser &line, FILE *fp, const char *curfilename, int linecnt);
|
int doCommand(int which_token, LineParser &line, FILE *fp, const char *curfilename, int *lineptr);
|
||||||
int do_add_file(const char *lgss, int attrib, int recurse, int linecnt, int *total_files, const char *name_override=0, int generatecode=1, int *data_handle=0);
|
int do_add_file(const char *lgss, int attrib, int recurse, int linecnt, int *total_files, const char *name_override=0, int generatecode=1, int *data_handle=0);
|
||||||
GrowBuf m_linebuild; // used for concatenating lines
|
GrowBuf m_linebuild; // used for concatenating lines
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,10 @@ parse_again:
|
||||||
|
|
||||||
if (tkid == TOK_P_ELSE)
|
if (tkid == TOK_P_ELSE)
|
||||||
{
|
{
|
||||||
if (line.getnumtokens() == 1 && !ignored_if_count) {
|
if (ignored_if_count)
|
||||||
|
return PS_OK;
|
||||||
|
|
||||||
|
if (line.getnumtokens() == 1) {
|
||||||
ignore=!ignore;
|
ignore=!ignore;
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
}
|
}
|
||||||
|
@ -139,8 +142,6 @@ parse_again:
|
||||||
if (line.getnumtokens() == 1) PRINTHELP()
|
if (line.getnumtokens() == 1) PRINTHELP()
|
||||||
if (!v) tkid = TOK_P_IFDEF;
|
if (!v) tkid = TOK_P_IFDEF;
|
||||||
else tkid = TOK_P_IFNDEF;
|
else tkid = TOK_P_IFNDEF;
|
||||||
|
|
||||||
if (ignore) return PS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tkid == TOK_P_IFNDEF || tkid == TOK_P_IFDEF)
|
if (tkid == TOK_P_IFNDEF || tkid == TOK_P_IFDEF)
|
||||||
|
@ -186,7 +187,7 @@ parse_again:
|
||||||
}
|
}
|
||||||
if (!ignore)
|
if (!ignore)
|
||||||
{
|
{
|
||||||
int ret=doCommand(tkid,line,fp,curfilename,*lineptr);
|
int ret=doCommand(tkid,line,fp,curfilename,lineptr);
|
||||||
if (ret != PS_OK) return ret;
|
if (ret != PS_OK) return ret;
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
@ -322,8 +323,10 @@ int CEXEBuild::process_jump(LineParser &line, int wt, int *offs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char *curfilename, int linecnt)
|
int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char *curfilename, int *lineptr)
|
||||||
{
|
{
|
||||||
|
int linecnt = *lineptr;
|
||||||
|
|
||||||
static const char *rootkeys[2] = {
|
static const char *rootkeys[2] = {
|
||||||
"HKCR\0HKLM\0HKCU\0HKU\0HKCC\0HKDD\0HKPD\0",
|
"HKCR\0HKLM\0HKCU\0HKU\0HKCC\0HKDD\0HKPD\0",
|
||||||
"HKEY_CLASSES_ROOT\0HKEY_LOCAL_MACHINE\0HKEY_CURRENT_USER\0HKEY_USERS\0HKEY_CURRENT_CONFIG\0HKEY_DYN_DATA\0HKEY_PERFORMANCE_DATA\0"
|
"HKEY_CLASSES_ROOT\0HKEY_LOCAL_MACHINE\0HKEY_CURRENT_USER\0HKEY_USERS\0HKEY_CURRENT_CONFIG\0HKEY_DYN_DATA\0HKEY_PERFORMANCE_DATA\0"
|
||||||
|
@ -405,7 +408,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
LineParser l2;
|
LineParser l2;
|
||||||
if (!l2.parse(str))
|
if (!l2.parse(str))
|
||||||
{
|
{
|
||||||
if (!stricmp(l2.gettoken_str(0),"!macroend")) break;
|
if (!stricmp(l2.gettoken_str(0),"!macroend"))
|
||||||
|
{
|
||||||
|
(*lineptr)++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!stricmp(l2.gettoken_str(0),"!macro"))
|
if (!stricmp(l2.gettoken_str(0),"!macro"))
|
||||||
{
|
{
|
||||||
ERROR_MSG("Error: can't define a macro inside a macro!\n");
|
ERROR_MSG("Error: can't define a macro inside a macro!\n");
|
||||||
|
@ -414,6 +421,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
}
|
}
|
||||||
if (str[0]) m_macros.add(str,strlen(str)+1);
|
if (str[0]) m_macros.add(str,strlen(str)+1);
|
||||||
else m_macros.add(" ",2);
|
else m_macros.add(" ",2);
|
||||||
|
(*lineptr)++;
|
||||||
}
|
}
|
||||||
m_macros.add("",1);
|
m_macros.add("",1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue