From e327e8681aab6da4d30ad489d7a7717349a13679 Mon Sep 17 00:00:00 2001 From: justin1014 Date: Wed, 18 Sep 2002 19:08:53 +0000 Subject: [PATCH] Fuxing things up making things compile/smaller when lots of options are disabled. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1034 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 37 ++++++++++++++++-- Source/build.h | 4 ++ Source/exehead/Ui.c | 4 ++ Source/exehead/config.h | 7 +++- Source/exehead/exec.c | 80 +++++++++++++++++++-------------------- Source/exehead/fileform.h | 72 ++++++++++++++++++++++++++++++++--- Source/lang.cpp | 25 +++++++++++- Source/script.cpp | 15 +++++++- 8 files changed, 190 insertions(+), 54 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index c130d3b5..044fefdd 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -195,7 +195,9 @@ CEXEBuild::CEXEBuild() db_opt_save=db_comp_save=db_full_size=db_opt_save_u=db_comp_save_u=db_full_size_u=0; // Added by Amir Szekely 31st July 2002 +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT compressor = &zlib_compressor; +#endif build_compressor_set = false; #ifdef NSIS_ZLIB_COMPRESS_WHOLE build_compress_whole = true; @@ -869,11 +871,13 @@ int CEXEBuild::resolve_instruction(const char *fn, const char *str, entry *w, in { if (resolve_jump_int(fn,&w->offsets[0],offs,start,end)) return 1; } +#ifdef NSIS_SUPPORT_MESSAGEBOX else if (w->which == EW_MESSAGEBOX) { if (resolve_jump_int(fn,&w->offsets[3],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[4],offs,start,end)) return 1; } +#endif else if (w->which == EW_IFFILEEXISTS) { if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1; @@ -884,27 +888,35 @@ int CEXEBuild::resolve_instruction(const char *fn, const char *str, entry *w, in if (resolve_jump_int(fn,&w->offsets[0],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1; } +#ifdef NSIS_SUPPORT_REBOOT else if (w->which == EW_IFREBOOTFLAG) { if (resolve_jump_int(fn,&w->offsets[0],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1; } +#endif +#ifdef NSIS_SUPPORT_STROPTS else if (w->which == EW_STRCMP) { if (resolve_jump_int(fn,&w->offsets[2],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[3],offs,start,end)) return 1; } +#endif +#ifdef NSIS_SUPPORT_INTOPTS else if (w->which == EW_INTCMP || w->which == EW_INTCMPU) { if (resolve_jump_int(fn,&w->offsets[2],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[3],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[4],offs,start,end)) return 1; } +#endif +#ifdef NSIS_SUPPORT_HWNDS else if (w->which == EW_ISWINDOW) { if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1; if (resolve_jump_int(fn,&w->offsets[2],offs,start,end)) return 1; } +#endif else if (w->which == EW_CALL) { if (w->offsets[0] >= 0 && w->offsets[1]) // get as jump @@ -921,6 +933,7 @@ int CEXEBuild::resolve_instruction(const char *fn, const char *str, entry *w, in w->offsets[0]++; } } +#ifdef NSIS_SUPPORT_STROPTS else if (w->which == EW_GETFUNCTIONADDR) { char buf[32]; @@ -944,6 +957,7 @@ int CEXEBuild::resolve_instruction(const char *fn, const char *str, entry *w, in wsprintf(buf,"%d",w->offsets[1]); w->offsets[1]=add_string(buf); } +#endif return 0; } @@ -1339,6 +1353,8 @@ int CEXEBuild::write_output(void) int installinfo_compressed; int fd_start; + +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT if (build_compress_whole) { if ((compressor->Init(9)) != C_OK) @@ -1347,6 +1363,8 @@ int CEXEBuild::write_output(void) return PS_ERROR; } } +#endif + { GrowBuf ihd; { @@ -1375,6 +1393,7 @@ int CEXEBuild::write_output(void) return PS_ERROR; } +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT if (build_compress_whole) { if (deflateToFile(fp,(char*)ihd.get(),ihd.getlen())) { @@ -1382,7 +1401,9 @@ int CEXEBuild::write_output(void) return PS_ERROR; } } - else { + else +#endif + { if (fwrite(ihd.get(),1,ihd.getlen(),fp) != (unsigned int)ihd.getlen()) { ERROR_MSG("Error: can't write %d bytes to output\n",ihd.getlen()); @@ -1487,6 +1508,7 @@ int CEXEBuild::write_output(void) { int l=dbl; if (l > 32768) l=32768; +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT if (build_compress_whole) { if (deflateToFile(fp,dbptr,l)) { @@ -1494,7 +1516,9 @@ int CEXEBuild::write_output(void) return PS_ERROR; } } - else { + else +#endif + { #ifdef NSIS_CONFIG_CRC_SUPPORT crc=CRC32(crc,(unsigned char *)dbptr,l); #endif @@ -1509,13 +1533,17 @@ int CEXEBuild::write_output(void) dbl-=l; } } - if (build_compress_whole) { +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT + if (build_compress_whole) + { if (deflateToFile(fp,NULL,0)) { fclose(fp); return PS_ERROR; } +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT compressor->End(); +#endif fh.length_of_all_following_data=(ftell(fp)-fd_start)+(build_crcchk?sizeof(int):0); INFO_MSG("%10d / %d bytes\n",(ftell(fp)-fd_start),build_datablock.getlen()); @@ -1539,6 +1567,7 @@ int CEXEBuild::write_output(void) #endif fseek(fp,0,SEEK_END); // reset eof flag } +#endif if (build_crcchk) { @@ -1562,6 +1591,7 @@ int CEXEBuild::write_output(void) return PS_OK; } +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT int CEXEBuild::deflateToFile(FILE *fp, char *buf, int len) // len==0 to flush { // Changed by Amir Szekely 31st July 2002 @@ -1599,6 +1629,7 @@ int CEXEBuild::deflateToFile(FILE *fp, char *buf, int len) // len==0 to flush } return 0; } +#endif int CEXEBuild::uninstall_generate() { diff --git a/Source/build.h b/Source/build.h index 0d7c6e6b..2b434974 100644 --- a/Source/build.h +++ b/Source/build.h @@ -146,9 +146,11 @@ class CEXEBuild { // a whole bunch O data. // Added by Amir Szekely 31st July 2002 +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT ICompressor *compressor; CZlib zlib_compressor; CBzip2 bzip2_compressor; +#endif bool build_compressor_set; bool build_compress_whole; @@ -206,7 +208,9 @@ class CEXEBuild { bool branding_image_found; // Added by Amir Szekely 29nd July 2002 WORD branding_image_id; // Added by Amir Szekely 29nd July 2002 unsigned char *m_unicon_data; +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT int deflateToFile(FILE *fp, char *buf, int len); // len==0 to flush +#endif }; #endif //_BUILD_H_ diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 44733b31..90d2e018 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -143,6 +143,7 @@ static HWND NSISCALL GetUIItem(HWND defhw, WORD def, WORD custom) { #define GetUIText(it,a,s,ss) GetDlgItemText(hwndDlg,it,s,ss) #define GetUIItem(hw,it,a) GetDlgItem(hw,it) +#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT #define HandleStaticBkColor() _HandleStaticBkColor(uMsg, wParam, lParam) static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL ret=0; @@ -156,6 +157,9 @@ static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lPara } return ret; } +#else//NSIS_CONFIG_ENHANCEDUI_SUPPORT +#define HandleStaticBkColor() 0 +#endif//!NSIS_CONFIG_ENHANCEDUI_SUPPORT #ifdef NSIS_CONFIG_LOG void NSISCALL build_g_logfile() diff --git a/Source/exehead/config.h b/Source/exehead/config.h index 182e9cd6..3abc2496 100644 --- a/Source/exehead/config.h +++ b/Source/exehead/config.h @@ -54,7 +54,8 @@ // that are visible. #define NSIS_CONFIG_VISIBLE_SUPPORT -// NSIS_CONFIG_ENHANCEDUI_SUPPORT enables support for CreateFont, SetStaticBkColor (used by some UIs),etc +// NSIS_CONFIG_ENHANCEDUI_SUPPORT enables support for CreateFont, +// SetStaticBkColor (used by some UIs), SetBrandingImage, .onInitDialog, etc #define NSIS_CONFIG_ENHANCEDUI_SUPPORT @@ -222,7 +223,6 @@ // be deleted. #define NSIS_CONFIG_PLUGIN_SUPPORT - // fixes #ifndef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_LICENSEPAGE @@ -234,6 +234,9 @@ #ifdef NSIS_SUPPORT_BGBG #undef NSIS_SUPPORT_BGBG #endif + #ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT + #undef NSIS_CONFIG_ENHANCEDUI_SUPPORT + #endif #endif #ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index aba70673..146e2364 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -686,6 +686,7 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos) case EW_ISWINDOW: if (IsWindow((HWND)process_string_fromtab_toint(parm0))) return parm1; return parm2; +#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT case EW_GETDLGITEM: myitoa( var, @@ -698,7 +699,43 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos) case EW_SETWINDOWLONG: SetWindowLong((HWND)process_string_fromtab_toint(parm0),parm1,process_string_fromtab_toint(parm2)); return 0; -#endif + case EW_SETBRANDINGIMAGE: + { + RECT r; + HWND hwImage = GetDlgItem(g_hwnd, parm1); + GetWindowRect(hwImage, &r); + process_string_fromtab(buf, parm0); + if (g_hBrandingBitmap) DeleteObject(g_hBrandingBitmap); + g_hBrandingBitmap=LoadImage( + 0, + buf, + IMAGE_BITMAP, + parm2?r.right-r.left:0, + parm2?r.bottom-r.top:0, + LR_LOADFROMFILE + ); + SendMessage( + hwImage, + STM_SETIMAGE, + IMAGE_BITMAP, + (LPARAM)g_hBrandingBitmap + ); + } + return 0; + case EW_CREATEFONT: + { + LOGFONT f={0,}; + f.lfHeight=-MulDiv(process_string_fromtab_toint(parm2),GetDeviceCaps(GetDC(g_hwnd),LOGPIXELSY),72); + f.lfWeight=process_string_fromtab_toint(parm3); + f.lfItalic=parm4&1; + f.lfUnderline=parm4&2; + f.lfStrikeOut=parm4&4; + process_string_fromtab(f.lfFaceName,parm1); + myitoa(var,(int)CreateFontIndirect(&f)); + } + return 0; +#endif//NSIS_CONFIG_ENHANCEDUI_SUPPORT +#endif//NSIS_SUPPORT_HWNDS #ifdef NSIS_SUPPORT_SHELLEXECUTE case EW_SHELLEXEC: // this uses improvements of Andras Varga { @@ -1387,51 +1424,14 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos) } return 0; #endif//NSIS_CONFIG_COMPONENTPAGE -// Added by Amir Szekely 21st 2002 -#ifdef NSIS_CONFIG_VISIBLE_SUPPORT - case EW_SETBRANDINGIMAGE: - { - RECT r; - HWND hwImage = GetDlgItem(g_hwnd, parm1); - GetWindowRect(hwImage, &r); - process_string_fromtab(buf, parm0); - if (g_hBrandingBitmap) DeleteObject(g_hBrandingBitmap); - g_hBrandingBitmap=LoadImage( - 0, - buf, - IMAGE_BITMAP, - parm2?r.right-r.left:0, - parm2?r.bottom-r.top:0, - LR_LOADFROMFILE - ); - SendMessage( - hwImage, - STM_SETIMAGE, - IMAGE_BITMAP, - (LPARAM)g_hBrandingBitmap - ); - } - return 0; -#endif //NSIS_CONFIG_VISIBLE_SUPPORT -// Added by Ximon Eighteen 5th August 2002 + + // Added by Ximon Eighteen 5th August 2002 #ifdef NSIS_CONFIG_PLUGIN_SUPPORT case EW_PLUGINCOMMANDPREP: // $0 temp plug-ins dir if (!*plugins_temp_dir) mystrcpy(plugins_temp_dir,g_usrvars[0]); return 0; #endif // NSIS_CONFIG_PLUGIN_SUPPORT - case EW_CREATEFONT: - { - LOGFONT f={0,}; - f.lfHeight=-MulDiv(process_string_fromtab_toint(parm2),GetDeviceCaps(GetDC(g_hwnd),LOGPIXELSY),72); - f.lfWeight=process_string_fromtab_toint(parm3); - f.lfItalic=parm4&1; - f.lfUnderline=parm4&2; - f.lfStrikeOut=parm4&4; - process_string_fromtab(f.lfFaceName,parm1); - myitoa(var,(int)CreateFontIndirect(&f)); - } - return 0; } my_MessageBox(STR(LANG_INSTCORRUPTED),MB_OK|MB_ICONSTOP); return EXEC_ERROR; diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 7f4148cf..67fbf978 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -46,80 +46,132 @@ enum EW_CREATEDIR, // Create directory: 2, [path, ?update$INSTDIR] EW_IFFILEEXISTS, // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists] EW_IFERRORS, //a IfErrors: 3 [jump if error, jump if not error, new_erflag] +#ifdef NSIS_SUPPORT_RENAME EW_RENAME, // Rename: 3 [old, new, rebootok] +#endif +#ifdef NSIS_SUPPORT_FNUTIL EW_GETFULLPATHNAME, // GetFullPathName: 2 [output, input, ?lfn:sfn] EW_SEARCHPATH, // SearchPath: 2 [output, filename] EW_GETTEMPFILENAME, // GetTempFileName: 1 [output] +#endif +#ifdef NSIS_SUPPORT_FILE EW_EXTRACTFILE, // File to extract: 5,[overwriteflag, output filename, compressed filedata, filedatetimelow, filedatetimehigh] // overwriteflag: 0x1 = no. 0x0=force, 0x2=try, 0x3=if date is newer +#endif +#ifdef NSIS_SUPPORT_DELETE EW_DELETEFILE, // Delete File: 2, [filename, rebootok] +#endif +#ifdef NSIS_SUPPORT_MESSAGEBOX EW_MESSAGEBOX, // MessageBox: 5,[MB_flags,text,retv1:retv2,moveonretv1:moveonretv2] +#endif +#ifdef NSIS_SUPPORT_RMDIR EW_RMDIR, // RMDir: 2 [path, recursiveflag] +#endif +#ifdef NSIS_SUPPORT_STROPTS EW_STRLEN, // StrLen: 2 [output, input] EW_ASSIGNVAR, // Assign: 4 [variable (0-9) to assign, string to assign, maxlen, startpos] EW_STRCMP, // StrCmp: 4 [str1, str2, jump_if_equal, jump_if_not_equal] (case-insensitive) +#endif +#ifdef NSIS_SUPPORT_ENVIRONMENT EW_READENVSTR, // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead] +#endif +#ifdef NSIS_SUPPORT_INTOPTS EW_INTCMP, // IntCmp: 5 [val1, val2, equal, val1val2] EW_INTCMPU, // IntCmpU: 5 [val1, val2, equal, val1val2] EW_INTOP, // IntOp: 4 [output, input1, input2, op] where op: 0=add, 1=sub, 2=mul, 3=div, 4=bor, 5=band, 6=bxor, 7=bnot input1, 8=lnot input1, 9=lor, 10=land], 11=1%2 EW_INTFMT, // IntFmt: [output, format, input] +#endif +#ifdef NSIS_SUPPORT_STACK EW_PUSHPOP, // Push/Pop/Exchange: 3 [variable/string, ?pop:push, ?exch] - +#endif +#ifdef NSIS_SUPPORT_HWNDS EW_FINDWINDOW, // FindWindow: 5, [outputvar, window class,window name, window_parent, window_after] EW_SENDMESSAGE, // SendMessage: 6 [output, hwnd, msg, wparam, lparam, [wparamstring?1:0 | lparamstring?2:0 | timeout<<2] EW_ISWINDOW, // IsWindow: 3 [hwnd, jump_if_window, jump_if_notwindow] +#endif + +#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT EW_GETDLGITEM, // GetDlgItem: 3 [outputvar, dialog, item_id] - EW_SETWINDOWLONG, // SetStaticBkColor: 2 [hwnd, color] + EW_SETWINDOWLONG, // SetWindowLong (used by StaticBkColor): 3 [hwnd, which(numeric), value] + EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file] + EW_CREATEFONT, // CreateFont: 5: [handle output, face name, height, weight, flags] +#endif +#ifdef NSIS_SUPPORT_SHELLEXECUTE EW_SHELLEXEC, // ShellExecute program: 4, [shell action, complete commandline, parameters, showwindow] +#endif +#ifdef NSIS_SUPPORT_EXECUTE EW_EXECUTE, // Execute program: 3,[complete command line,waitflag,>=0?output errorcode] +#endif +#ifdef NSIS_SUPPORT_GETFILETIME EW_GETFILETIME, // GetFileTime; 3 [file highout lowout] +#endif +#ifdef NSIS_SUPPORT_GETDLLVERSION EW_GETDLLVERSION, // GetDLLVersion: 3 [file highout lowout] +#endif +#ifdef NSIS_SUPPORT_ACTIVEXREG EW_REGISTERDLL, // Register DLL: 3,[DLL file name, string ptr of function to call, text to put in display (<0 if none/pass parms), 1 - no unload, 0 - unload] +#endif +#ifdef NSIS_SUPPORT_CREATESHORTCUT EW_CREATESHORTCUT, // Make Shortcut: 5, [link file, target file, parameters, icon file, iconindex|show mode<<8|hotkey<<16] +#endif +#ifdef NSIS_SUPPORT_COPYFILES EW_COPYFILES, // CopyFiles: 3 [source mask, destination location, flags] +#endif +#ifdef NSIS_SUPPORT_REBOOT EW_REBOOT, // Reboot: 0 EW_IFREBOOTFLAG, // IfRebootFlag: 2 [if reboot flag set, if not reboot flag] EW_SETREBOOTFLAG, // SetRebootFlag: 1 [new value] +#endif +#ifdef NSIS_SUPPORT_INIFILES EW_WRITEINI, // Write INI String: 4, [Section, Name, Value, INI File] EW_READINISTR, // ReadINIStr: 4 [output, section, name, ini_file] +#endif +#ifdef NSIS_SUPPORT_REGISTRYFUNCTIONS EW_DELREG, // DeleteRegValue/DeleteRegKey: 4, [root key(int), KeyName, ValueName, delkeyonlyifempty]. ValueName is -1 if delete key EW_WRITEREG, // Write Registry value: 5, [RootKey(int),KeyName,ItemName,ItemData,typelen] // typelen=1 for str, 2 for dword, 3 for binary, 0 for expanded str EW_READREGSTR, // ReadRegStr: 5 [output, rootkey(int), keyname, itemname, ==1?int::str] EW_REGENUM, // RegEnum: 5 [output, rootkey, keyname, index, ?key:value] +#endif +#ifdef NSIS_SUPPORT_FILEFUNCTIONS EW_FCLOSE, // FileClose: 1 [handle] EW_FOPEN, // FileOpen: 4 [name, openmode, createmode, outputhandle] EW_FPUTS, // FileWrite: 3 [handle, string, ?int:string] EW_FGETS, // FileRead: 4 [handle, output, maxlen, ?getchar:gets] EW_FSEEK, // FileSeek: 4 [handle, offset, mode, >=0?positionoutput] +#endif//NSIS_SUPPORT_FILEFUNCTIONS +#ifdef NSIS_SUPPORT_FINDFIRST EW_FINDCLOSE, // FindClose: 1 [handle] EW_FINDNEXT, // FindNext: 2 [output, handle] EW_FINDFIRST, // FindFirst: 2 [filespec, output, handleoutput] +#endif +#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT EW_WRITEUNINSTALLER, // WriteUninstaller: 1 [name] +#endif +#ifdef NSIS_CONFIG_LOG EW_LOG, // LogText: 2 [0, text] / LogSet: [1, logstate] +#endif +#ifdef NSIS_CONFIG_COMPONENTPAGE EW_SECTIONSET, // SectionSetText: 3: [idx, 0, text] // SectionGetText: 3: [idx, 1, output] // SectionSetFlags: 3: [idx, 2, flags] // SectionGetFlags: 3: [idx, 3, output] - - EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file] - - EW_CREATEFONT, // CreateFont: 5: [handle output, face name, height, weight, flags] +#endif // instructions not actually implemented in exehead, but used in compiler. EW_GETLABELADDR, // both of these get converted to EW_ASSIGNVAR @@ -248,7 +300,9 @@ typedef struct int code_onInstFailed; int code_onUserAbort; int code_onNextPage; +#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT int code_onInitDialog; +#endif #endif//NSIS_SUPPORT_CODECALLBACKS char show_details; @@ -270,6 +324,7 @@ typedef struct typedef struct { // these first strings are literals (should not be encoded) +#ifdef NSIS_CONFIG_VISIBLE_SUPPORT int backbutton; int nextbutton; int browse; // "Browse..." @@ -288,6 +343,9 @@ typedef struct int licensedata; // license text int licensebutton; // license button text #endif//NSIS_CONFIG_LICENSEPAGE +#else + int foo; +#endif } installer_strings; // Settings specific to installers @@ -324,7 +382,9 @@ typedef struct // .on* calls int code_onPrevPage; int code_onVerifyInstDir; +#ifdef NSIS_CONFIG_ENHANCEDUI_SUPPORT int code_onMouseOverSection; +#endif #ifdef NSIS_CONFIG_COMPONENTPAGE int code_onSelChange; #endif//NSIS_CONFIG_COMPONENTPAGE diff --git a/Source/lang.cpp b/Source/lang.cpp index 87159947..def346e1 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -109,7 +109,9 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table) HANDLE_STRING_C(NLF_BTN_CLOSE, common.closebutton); HANDLE_STRING_C(NLF_BTN_DETAILS, common.showdetailsbutton); HANDLE_STRING_C(NLF_COMPLETED, common.completed); +#ifdef NSIS_SUPPORT_FILE HANDLE_STRING_C(NLF_FILE_ERROR, common.fileerrtext); +#endif HANDLE_STRING_I(NLF_CAPTION, common.caption); HANDLE_STRING_I(NLF_SUBCAPTION_LICENSE, common.subcaptions[0]); @@ -117,33 +119,51 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table) HANDLE_STRING_I(NLF_SUBCAPTION_DIR, common.subcaptions[2]); HANDLE_STRING_I(NLF_SUBCAPTION_INSTFILES, common.subcaptions[3]); HANDLE_STRING_I(NLF_SUBCAPTION_COMPLETED, common.subcaptions[4]); +#ifdef NSIS_CONFIG_VISIBLE_SUPPORT HANDLE_STRING_I(NLF_BTN_NEXT, installer.nextbutton); HANDLE_STRING_I(NLF_BTN_BACK, installer.backbutton); +#ifdef NSIS_CONFIG_LICENSEPAGE HANDLE_STRING_I(NLF_BTN_LICENSE, installer.licensebutton); +#endif HANDLE_STRING_I(NLF_BTN_INSTALL, installer.installbutton); HANDLE_STRING_I(NLF_BTN_BROWSE, installer.browse); +#ifdef NSIS_CONFIG_COMPONENTPAGE HANDLE_STRING_I(NLF_COMP_SUBTEXT1, installer.componentsubtext[0]); HANDLE_STRING_I(NLF_COMP_SUBTEXT2, installer.componentsubtext[1]); +#endif HANDLE_STRING_I(NLF_COMP_CUSTOM, installer.custom); HANDLE_STRING_I(NLF_DIR_SUBTEXT, installer.dirsubtext); HANDLE_STRING_I(NLF_SPACE_AVAIL, installer.spaceavailable); HANDLE_STRING_I(NLF_SPACE_REQ, installer.spacerequired); +#endif +#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT HANDLE_STRING_U(NLF_UCAPTION, ucommon.caption); HANDLE_STRING_U(NLF_USUBCAPTION_CONFIRM, ucommon.subcaptions[0]); HANDLE_STRING_U(NLF_USUBCAPTION_INSTFILES, ucommon.subcaptions[1]); HANDLE_STRING_U(NLF_USUBCAPTION_COMPLETED, ucommon.subcaptions[2]); HANDLE_STRING_U(NLF_BTN_UNINSTALL, uninstall.uninstbutton); HANDLE_STRING_U(NLF_UNINST_SUBTEXT, uninstall.uninstalltext2); +#endif HANDLE_STRING_C(LANG_NAME, common.name); +#ifdef NSIS_CONFIG_COMPONENTPAGE HANDLE_STRING_I(LANG_COMP_TEXT, installer.componenttext); +#endif + +#ifdef NSIS_CONFIG_LICENSEPAGE HANDLE_STRING_I(LANG_LICENSE_TEXT, installer.licensetext); HANDLE_STRING_I(LANG_LICENSE_DATA, installer.licensedata); - HANDLE_STRING_I(LANG_DIR_TEXT, installer.text); +#endif +#ifdef NSIS_CONFIG_VISIBLE_SUPPORT + HANDLE_STRING_I(LANG_DIR_TEXT, installer.text); +#endif + +#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT HANDLE_STRING_U(LANG_UNINST_TEXT, uninstall.uninstalltext); +#endif default: ERROR_MSG("Error: string doesn't exist or is not changeable (%d)\n", id); @@ -275,6 +295,7 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { table->common.name=add_string_main(str(NLF_DEF_NAME),0); table->ucommon.name=add_string_uninst(str(NLF_DEF_NAME),0); } +#ifdef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_LICENSEPAGE if (table->installer.licensedata<0 || table->installer.licensetext<0) @@ -336,6 +357,8 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { if (table->common.closebutton<0) table->common.closebutton=add_string_main(str(NLF_BTN_CLOSE),0); if (table->common.completed<0) table->common.completed=add_string_main(str(NLF_COMPLETED),0); +#endif + #ifdef NSIS_SUPPORT_FILE if (m_inst_fileused && table->common.fileerrtext<0) { diff --git a/Source/script.cpp b/Source/script.cpp index a19b4557..c870975b 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -594,12 +594,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char } return make_sure_not_in_secorfunc(line.gettoken_str(0)); #else//NSIS_CONFIG_COMPONENTPAGE - case TOK_ENABLEDBITMAP: - case TOK_DISABLEDBITMAP: + case TOK_CHECKBITMAP: ERROR_MSG("Error: %s specified, NSIS_CONFIG_COMPONENTPAGE not defined.\n", line.gettoken_str(0)); return PS_ERROR; #endif//!NSIS_CONFIG_COMPONENTPAGE case TOK_DIRTEXT: +#ifdef NSIS_CONFIG_VISIBLE_SUPPORT { int a = 1; WORD lang = 0; @@ -613,6 +613,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char SCRIPT_MSG("DirText: \"%s\" \"%s\" \"%s\"\n",line.gettoken_str(a),line.gettoken_str(a+1),line.gettoken_str(a+2)); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); +#else//NSIS_CONFIG_VISIBLE_SUPPORT + ERROR_MSG("Error: %s specified, NSIS_CONFIG_VISIBLE_SUPPORT not defined.\n", line.gettoken_str(0)); + return PS_ERROR; +#endif//!NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_COMPONENTPAGE case TOK_COMPTEXT: { @@ -1326,6 +1330,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char // Added by Amir Szekely 31st July 2002 // Ability to change compression methods from within the script case TOK_SETCOMPRESSOR: +#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT { if (build_compressor_set) { ERROR_MSG("Error: can't change compressor after data already got compressed or header already changed!\n"); @@ -1379,6 +1384,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char SCRIPT_MSG("SetCompressor: %s\n", line.gettoken_str(1)); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); +#else//NSIS_CONFIG_COMPRESSION_SUPPORT + ERROR_MSG("Error: %s specified, NSIS_CONFIG_COMPRESSION_SUPPORT not defined.\n", line.gettoken_str(0)); + return PS_ERROR; +#endif//NSIS_CONFIG_COMPRESSION_SUPPORT case TOK_LOADNLF: { SCRIPT_MSG("LoadLanguageFile: %s\n", line.gettoken_str(1)); @@ -3599,6 +3608,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char return PS_ERROR; } +#ifdef NSIS_SUPPORT_FILE int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecnt, int *total_files, const char *name_override) { char dir[1024]; @@ -3833,3 +3843,4 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn } return PS_OK; } +#endif \ No newline at end of file