relative jumps now work with instructions that add multiple entries (including plug-in calls)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3670 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
66ad756138
commit
5e960e1fd3
4 changed files with 31 additions and 3 deletions
|
@ -16,5 +16,3 @@ Examples:
|
||||||
\c MessageBox MB_OK "You will never ever see this message box"
|
\c MessageBox MB_OK "You will never ever see this message box"
|
||||||
\c Goto -3
|
\c Goto -3
|
||||||
\c MessageBox MB_OK "Done"
|
\c MessageBox MB_OK "Done"
|
||||||
|
|
||||||
\\<b\\>Note:\\</b\\> relative jumps don't work with \R{Exch}{Exch}, \R{file}{File}, \R{plugindlls}{plug-ins (Plugin::Function)}, \R{initpluginsdir}{InitPluginsDir}, \R{getfiletimelocal}{GetFileTimeLocal} or \R{getdllversionlocal}{GetDLLVersionLocal}. Do \e{not} try to jump over them using relative jumps, you will not get the result you were expecting.
|
|
|
@ -76,6 +76,7 @@ CEXEBuild::CEXEBuild()
|
||||||
cur_ifblock=NULL;
|
cur_ifblock=NULL;
|
||||||
last_line_had_slash=0;
|
last_line_had_slash=0;
|
||||||
inside_comment=false;
|
inside_comment=false;
|
||||||
|
multiple_entries_instruction=0;
|
||||||
|
|
||||||
build_include_depth=0;
|
build_include_depth=0;
|
||||||
|
|
||||||
|
@ -275,6 +276,7 @@ definedlist.add("NSIS_SUPPORT_LANG_IN_STRINGS");
|
||||||
build_compress_dict_size=1<<23;
|
build_compress_dict_size=1<<23;
|
||||||
|
|
||||||
cur_entries=&build_entries;
|
cur_entries=&build_entries;
|
||||||
|
cur_instruction_entry_map=&build_instruction_entry_map;
|
||||||
cur_datablock=&build_datablock;
|
cur_datablock=&build_datablock;
|
||||||
cur_datablock_cache=&build_datablock_cache;
|
cur_datablock_cache=&build_datablock_cache;
|
||||||
cur_functions=&build_functions;
|
cur_functions=&build_functions;
|
||||||
|
@ -1278,9 +1280,12 @@ int CEXEBuild::add_entry(const entry *ent)
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_entries->add(ent,sizeof(entry));
|
cur_entries->add(ent,sizeof(entry));
|
||||||
|
cur_instruction_entry_map->add(&multiple_entries_instruction,sizeof(int));
|
||||||
build_cursection->code_size++;
|
build_cursection->code_size++;
|
||||||
cur_header->blocks[NB_ENTRIES].num++;
|
cur_header->blocks[NB_ENTRIES].num++;
|
||||||
|
|
||||||
|
multiple_entries_instruction=1;
|
||||||
|
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1304,7 +1309,26 @@ int CEXEBuild::resolve_jump_int(const char *fn, int *a, int offs, int start, int
|
||||||
char *lname=(char*)ns_label.get()+*a;
|
char *lname=(char*)ns_label.get()+*a;
|
||||||
if (lname[0] == '-' || lname[0]=='+')
|
if (lname[0] == '-' || lname[0]=='+')
|
||||||
{
|
{
|
||||||
*a=offs+atoi(lname)+1;
|
int jump = atoi(lname);
|
||||||
|
int *skip_map = (int *) cur_instruction_entry_map->get();
|
||||||
|
|
||||||
|
int direction = 1;
|
||||||
|
if (jump < 0)
|
||||||
|
direction = -1;
|
||||||
|
|
||||||
|
for (; jump != 0; jump -= direction)
|
||||||
|
{
|
||||||
|
offs += direction;
|
||||||
|
if (offs >= 0 && offs < cur_instruction_entry_map->getlen() * sizeof(int))
|
||||||
|
{
|
||||||
|
while (skip_map[offs])
|
||||||
|
{
|
||||||
|
offs += direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*a = offs + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3014,6 +3038,7 @@ void CEXEBuild::set_uninstall_mode(int un)
|
||||||
cur_datablock=&ubuild_datablock;
|
cur_datablock=&ubuild_datablock;
|
||||||
cur_datablock_cache=&ubuild_datablock_cache;
|
cur_datablock_cache=&ubuild_datablock_cache;
|
||||||
cur_entries=&ubuild_entries;
|
cur_entries=&ubuild_entries;
|
||||||
|
cur_instruction_entry_map=&ubuild_instruction_entry_map;
|
||||||
cur_functions=&ubuild_functions;
|
cur_functions=&ubuild_functions;
|
||||||
cur_labels=&ubuild_labels;
|
cur_labels=&ubuild_labels;
|
||||||
cur_pages=&ubuild_pages;
|
cur_pages=&ubuild_pages;
|
||||||
|
@ -3028,6 +3053,7 @@ void CEXEBuild::set_uninstall_mode(int un)
|
||||||
cur_datablock=&build_datablock;
|
cur_datablock=&build_datablock;
|
||||||
cur_datablock_cache=&build_datablock_cache;
|
cur_datablock_cache=&build_datablock_cache;
|
||||||
cur_entries=&build_entries;
|
cur_entries=&build_entries;
|
||||||
|
cur_instruction_entry_map=&build_instruction_entry_map;
|
||||||
cur_functions=&build_functions;
|
cur_functions=&build_functions;
|
||||||
cur_labels=&build_labels;
|
cur_labels=&build_labels;
|
||||||
cur_pages=&build_pages;
|
cur_pages=&build_pages;
|
||||||
|
|
|
@ -158,6 +158,7 @@ class CEXEBuild {
|
||||||
|
|
||||||
int last_line_had_slash;
|
int last_line_had_slash;
|
||||||
bool inside_comment;
|
bool inside_comment;
|
||||||
|
int multiple_entries_instruction;
|
||||||
|
|
||||||
void ERROR_MSG(const char *s, ...);
|
void ERROR_MSG(const char *s, ...);
|
||||||
void SCRIPT_MSG(const char *s, ...);
|
void SCRIPT_MSG(const char *s, ...);
|
||||||
|
@ -321,6 +322,7 @@ class CEXEBuild {
|
||||||
section *build_cursection;
|
section *build_cursection;
|
||||||
TinyGrowBuf build_sections, ubuild_sections, *cur_sections;
|
TinyGrowBuf build_sections, ubuild_sections, *cur_sections;
|
||||||
GrowBuf build_entries,ubuild_entries, *cur_entries;
|
GrowBuf build_entries,ubuild_entries, *cur_entries;
|
||||||
|
GrowBuf build_instruction_entry_map,ubuild_instruction_entry_map, *cur_instruction_entry_map;
|
||||||
TinyGrowBuf build_functions, ubuild_functions, *cur_functions;
|
TinyGrowBuf build_functions, ubuild_functions, *cur_functions;
|
||||||
TinyGrowBuf build_labels, ubuild_labels, *cur_labels;
|
TinyGrowBuf build_labels, ubuild_labels, *cur_labels;
|
||||||
StringList build_strlist, ubuild_strlist, *cur_strlist;
|
StringList build_strlist, ubuild_strlist, *cur_strlist;
|
||||||
|
|
|
@ -804,6 +804,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
build_plugin_table();
|
build_plugin_table();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
multiple_entries_instruction=0;
|
||||||
|
|
||||||
entry ent={0,};
|
entry ent={0,};
|
||||||
switch (which_token)
|
switch (which_token)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue