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
This commit is contained in:
kichik 2003-09-05 22:22:56 +00:00
parent 89c14ee511
commit f1a8c1950a
3 changed files with 31 additions and 29 deletions

View file

@ -872,7 +872,7 @@ int CEXEBuild::function_end()
return PS_ERROR; return PS_ERROR;
} }
// add ret. // add ret.
add_entry_indirect(EW_RET); add_entry_direct(EW_RET);
build_cursection_isfunc=0; build_cursection_isfunc=0;
build_cursection=NULL; build_cursection=NULL;
@ -926,7 +926,7 @@ int CEXEBuild::section_end()
ERROR_MSG("Error: SectionEnd specified and no sections open\n"); ERROR_MSG("Error: SectionEnd specified and no sections open\n");
return PS_ERROR; return PS_ERROR;
} }
add_entry_indirect(EW_RET); add_entry_direct(EW_RET);
build_cursection->code_size--; build_cursection->code_size--;
build_cursection=NULL; build_cursection=NULL;
if (!subsection_open_cnt) if (!subsection_open_cnt)
@ -1024,7 +1024,9 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/
else else
subsection_open_cnt++; subsection_open_cnt++;
add_entry_indirect(EW_RET); add_entry_direct(EW_RET);
build_cursection->code_size = 0;
build_cursection = 0; build_cursection = 0;
} }
@ -1073,7 +1075,7 @@ int CEXEBuild::add_entry(const entry *ent)
return PS_OK; 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; entry ent;
ent.which = which; ent.which = which;
@ -2824,62 +2826,62 @@ again:
zero_offset=add_string("$0"); zero_offset=add_string("$0");
// SetDetailsPrint none // SetDetailsPrint none
ret=add_entry_indirect(EW_UPDATETEXT, 0, 16); ret=add_entry_direct(EW_UPDATETEXT, 0, 16);
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
// StrCmp $PLUGINSDIR "" // 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; if (ret != PS_OK) return ret;
// Push $0 // Push $0
ret=add_entry_indirect(EW_PUSHPOP, zero_offset); ret=add_entry_direct(EW_PUSHPOP, zero_offset);
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
// ClearErrors // 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; if (ret != PS_OK) return ret;
// GetTempFileName $0 // GetTempFileName $0
#ifdef NSIS_SUPPORT_NAMED_USERVARS #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 #else
ret=add_entry_indirect(EW_GETTEMPFILENAME, 0, add_string("$TEMP")); ret=add_entry_direct(EW_GETTEMPFILENAME, 0, add_string("$TEMP"));
#endif #endif
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
// Delete $0 - the temp file created // 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; if (ret != PS_OK) return ret;
// CraeteDirectory $0 - a dir instead of that temp file // 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; if (ret != PS_OK) return ret;
// IfErrors Initialize_____Plugins_error - detect errors // 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; if (ret != PS_OK) return ret;
// Copy $0 to $PLUGINSDIR // Copy $0 to $PLUGINSDIR
#ifdef NSIS_SUPPORT_NAMED_USERVARS #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 #else
ret=add_entry_indirect(EW_ASSIGNVAR, 25, zero_offset); ret=add_entry_direct(EW_ASSIGNVAR, 25, zero_offset);
#endif #endif
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
// Pop $0 // Pop $0
#ifdef NSIS_SUPPORT_NAMED_USERVARS #ifdef NSIS_SUPPORT_NAMED_USERVARS
ret=add_entry_indirect(EW_PUSHPOP, var_zero, 1); ret=add_entry_direct(EW_PUSHPOP, var_zero, 1);
#else #else
ret=add_entry_indirect(EW_PUSHPOP, 0, 1); ret=add_entry_direct(EW_PUSHPOP, 0, 1);
#endif #endif
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
// done // done
if (add_label("Initialize_____Plugins_done")) return PS_ERROR; if (add_label("Initialize_____Plugins_done")) return PS_ERROR;
// Return // Return
ret=add_entry_indirect(EW_RET); ret=add_entry_direct(EW_RET);
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
// error // error
if (add_label("Initialize_____Plugins_error")) return PS_ERROR; if (add_label("Initialize_____Plugins_error")) return PS_ERROR;
// error message box // 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; if (ret != PS_OK) return ret;
// Quit // Quit
ret=add_entry_indirect(EW_QUIT); ret=add_entry_direct(EW_QUIT);
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
// FunctionEnd // FunctionEnd

View file

@ -169,7 +169,7 @@ class CEXEBuild {
int page_end(); int page_end();
int add_label(const char *name); int add_label(const char *name);
int add_entry(const entry *ent); 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_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_string(const char *string, int process=1); // returns offset (in string table)
int add_intstring(const int i); // returns offset in stringblock int add_intstring(const int i); // returns offset in stringblock

View file

@ -4737,9 +4737,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
{ {
int ret; int ret;
SCRIPT_MSG("SetCurInstType: %s\n",line.gettoken_str(1)); 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; 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; if (ret != PS_OK) return ret;
} }
return PS_OK; return PS_OK;
@ -5304,14 +5304,14 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
strcat(spec,fspec); strcat(spec,fspec);
if (generatecode) if (generatecode)
{ {
a=add_entry_indirect(EW_PUSHPOP, add_string("$OUTDIR")); a=add_entry_direct(EW_PUSHPOP, add_string("$OUTDIR"));
if (a != PS_OK) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
return a; 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) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
@ -5323,7 +5323,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
{ {
FindClose(htemp); 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) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
@ -5340,7 +5340,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
if (generatecode) 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) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
@ -5349,7 +5349,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
if (attrib) 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) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
@ -5366,7 +5366,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
if (!rec_depth) if (!rec_depth)
{ {
// return to the original $OUTDIR // 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) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);