From f1a8c1950acbf8214909cf64d7c3c9c2a44e275b Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 5 Sep 2003 22:22:56 +0000 Subject: [PATCH] Get progress bar to the end even with subsections git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2851 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 42 ++++++++++++++++++++++-------------------- Source/build.h | 2 +- Source/script.cpp | 16 ++++++++-------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index 81d05d82..f8655c8c 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -872,7 +872,7 @@ int CEXEBuild::function_end() return PS_ERROR; } // add ret. - add_entry_indirect(EW_RET); + add_entry_direct(EW_RET); build_cursection_isfunc=0; build_cursection=NULL; @@ -926,7 +926,7 @@ int CEXEBuild::section_end() ERROR_MSG("Error: SectionEnd specified and no sections open\n"); return PS_ERROR; } - add_entry_indirect(EW_RET); + add_entry_direct(EW_RET); build_cursection->code_size--; build_cursection=NULL; if (!subsection_open_cnt) @@ -1024,7 +1024,9 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/ else subsection_open_cnt++; - add_entry_indirect(EW_RET); + add_entry_direct(EW_RET); + build_cursection->code_size = 0; + build_cursection = 0; } @@ -1073,7 +1075,7 @@ int CEXEBuild::add_entry(const entry *ent) return PS_OK; } -int CEXEBuild::add_entry_indirect(int which, int o0, int o1, int o2, int o3, int o4, int o5 /*o#=0*/) +int CEXEBuild::add_entry_direct(int which, int o0, int o1, int o2, int o3, int o4, int o5 /*o#=0*/) { entry ent; ent.which = which; @@ -2824,62 +2826,62 @@ again: zero_offset=add_string("$0"); // SetDetailsPrint none - ret=add_entry_indirect(EW_UPDATETEXT, 0, 16); + ret=add_entry_direct(EW_UPDATETEXT, 0, 16); if (ret != PS_OK) return ret; // StrCmp $PLUGINSDIR "" - ret=add_entry_indirect(EW_STRCMP, add_string("$PLUGINSDIR"), 0, 0, ns_label.add("Initialize_____Plugins_done",0)); + ret=add_entry_direct(EW_STRCMP, add_string("$PLUGINSDIR"), 0, 0, ns_label.add("Initialize_____Plugins_done",0)); if (ret != PS_OK) return ret; // Push $0 - ret=add_entry_indirect(EW_PUSHPOP, zero_offset); + ret=add_entry_direct(EW_PUSHPOP, zero_offset); if (ret != PS_OK) return ret; // ClearErrors - ret=add_entry_indirect(EW_SETFLAG, FLAG_OFFSET(exec_error)); + ret=add_entry_direct(EW_SETFLAG, FLAG_OFFSET(exec_error)); if (ret != PS_OK) return ret; // GetTempFileName $0 #ifdef NSIS_SUPPORT_NAMED_USERVARS - ret=add_entry_indirect(EW_GETTEMPFILENAME, var_zero, add_string("$TEMP")); + ret=add_entry_direct(EW_GETTEMPFILENAME, var_zero, add_string("$TEMP")); #else - ret=add_entry_indirect(EW_GETTEMPFILENAME, 0, add_string("$TEMP")); + ret=add_entry_direct(EW_GETTEMPFILENAME, 0, add_string("$TEMP")); #endif if (ret != PS_OK) return ret; // Delete $0 - the temp file created - ret=add_entry_indirect(EW_DELETEFILE, zero_offset); + ret=add_entry_direct(EW_DELETEFILE, zero_offset); if (ret != PS_OK) return ret; // CraeteDirectory $0 - a dir instead of that temp file - ret=add_entry_indirect(EW_CREATEDIR, zero_offset); + ret=add_entry_direct(EW_CREATEDIR, zero_offset); if (ret != PS_OK) return ret; // IfErrors Initialize_____Plugins_error - detect errors - ret=add_entry_indirect(EW_IFFLAG, ns_label.add("Initialize_____Plugins_error",0), 0, FLAG_OFFSET(exec_error)); + ret=add_entry_direct(EW_IFFLAG, ns_label.add("Initialize_____Plugins_error",0), 0, FLAG_OFFSET(exec_error)); if (ret != PS_OK) return ret; // Copy $0 to $PLUGINSDIR #ifdef NSIS_SUPPORT_NAMED_USERVARS - ret=add_entry_indirect(EW_ASSIGNVAR, m_UserVarNames.get("PLUGINSDIR"), zero_offset); + ret=add_entry_direct(EW_ASSIGNVAR, m_UserVarNames.get("PLUGINSDIR"), zero_offset); #else - ret=add_entry_indirect(EW_ASSIGNVAR, 25, zero_offset); + ret=add_entry_direct(EW_ASSIGNVAR, 25, zero_offset); #endif if (ret != PS_OK) return ret; // Pop $0 #ifdef NSIS_SUPPORT_NAMED_USERVARS - ret=add_entry_indirect(EW_PUSHPOP, var_zero, 1); + ret=add_entry_direct(EW_PUSHPOP, var_zero, 1); #else - ret=add_entry_indirect(EW_PUSHPOP, 0, 1); + ret=add_entry_direct(EW_PUSHPOP, 0, 1); #endif if (ret != PS_OK) return ret; // done if (add_label("Initialize_____Plugins_done")) return PS_ERROR; // Return - ret=add_entry_indirect(EW_RET); + ret=add_entry_direct(EW_RET); if (ret != PS_OK) return ret; // error if (add_label("Initialize_____Plugins_error")) return PS_ERROR; // error message box - ret=add_entry_indirect(EW_MESSAGEBOX, MB_OK|MB_ICONSTOP, add_string("Error! Can't initialize plug-ins directory. Please try again later.")); + ret=add_entry_direct(EW_MESSAGEBOX, MB_OK|MB_ICONSTOP, add_string("Error! Can't initialize plug-ins directory. Please try again later.")); if (ret != PS_OK) return ret; // Quit - ret=add_entry_indirect(EW_QUIT); + ret=add_entry_direct(EW_QUIT); if (ret != PS_OK) return ret; // FunctionEnd diff --git a/Source/build.h b/Source/build.h index 5caac0da..ab5825dd 100644 --- a/Source/build.h +++ b/Source/build.h @@ -169,7 +169,7 @@ class CEXEBuild { int page_end(); int add_label(const char *name); int add_entry(const entry *ent); - int add_entry_indirect(int which, int o0=0, int o1=0, int o2=0, int o3=0, int o4=0, int o5=0); + int add_entry_direct(int which, int o0=0, int o1=0, int o2=0, int o3=0, int o4=0, int o5=0); int add_data(const char *data, int length, IGrowBuf *dblock=NULL); // returns offset int add_string(const char *string, int process=1); // returns offset (in string table) int add_intstring(const int i); // returns offset in stringblock diff --git a/Source/script.cpp b/Source/script.cpp index 0712d876..4c23d371 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -4737,9 +4737,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) { int ret; SCRIPT_MSG("SetCurInstType: %s\n",line.gettoken_str(1)); - ret = add_entry_indirect(EW_SETFLAG, FLAG_OFFSET(cur_insttype), add_string(line.gettoken_str(1))); + ret = add_entry_direct(EW_SETFLAG, FLAG_OFFSET(cur_insttype), add_string(line.gettoken_str(1))); if (ret != PS_OK) return ret; - ret = add_entry_indirect(EW_INSTTYPESET, 0, 0, 0, 1); + ret = add_entry_direct(EW_INSTTYPESET, 0, 0, 0, 1); if (ret != PS_OK) return ret; } return PS_OK; @@ -5304,14 +5304,14 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn strcat(spec,fspec); if (generatecode) { - a=add_entry_indirect(EW_PUSHPOP, add_string("$OUTDIR")); + a=add_entry_direct(EW_PUSHPOP, add_string("$OUTDIR")); if (a != PS_OK) { FindClose(h); return a; } - a=add_entry_indirect(EW_ASSIGNVAR, m_UserVarNames.get("OUTDIR"), add_string(out_path)); + a=add_entry_direct(EW_ASSIGNVAR, m_UserVarNames.get("OUTDIR"), add_string(out_path)); if (a != PS_OK) { FindClose(h); @@ -5323,7 +5323,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn { FindClose(htemp); - a=add_entry_indirect(EW_CREATEDIR, add_string("$OUTDIR"), 1); + a=add_entry_direct(EW_CREATEDIR, add_string("$OUTDIR"), 1); if (a != PS_OK) { FindClose(h); @@ -5340,7 +5340,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn if (generatecode) { - a=add_entry_indirect(EW_PUSHPOP, m_UserVarNames.get("OUTDIR"), 1); + a=add_entry_direct(EW_PUSHPOP, m_UserVarNames.get("OUTDIR"), 1); if (a != PS_OK) { FindClose(h); @@ -5349,7 +5349,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn if (attrib) { - a=add_entry_indirect(EW_SETFILEATTRIBUTES, add_string(out_path), d.dwFileAttributes); + a=add_entry_direct(EW_SETFILEATTRIBUTES, add_string(out_path), d.dwFileAttributes); if (a != PS_OK) { FindClose(h); @@ -5366,7 +5366,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn if (!rec_depth) { // return to the original $OUTDIR - a=add_entry_indirect(EW_CREATEDIR, add_string("$OUTDIR"), 1); + a=add_entry_direct(EW_CREATEDIR, add_string("$OUTDIR"), 1); if (a != PS_OK) { FindClose(h);