(kichik) MakeNSIS now sends output directly to MakeNSISw, faster, and no
more problems with foreign languages in the output. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1996 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
db21b77527
commit
763d9a15b9
5 changed files with 281 additions and 265 deletions
|
@ -202,6 +202,28 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
|
|||
break;
|
||||
}
|
||||
return TRUE;
|
||||
case WM_COPYDATA:
|
||||
{
|
||||
PCOPYDATASTRUCT cds = PCOPYDATASTRUCT(lParam);
|
||||
switch (cds->dwData) {
|
||||
case MAKENSIS_NOTIFY_SCRIPT:
|
||||
if (g_sdata.input_script) GlobalFree(g_sdata.input_script);
|
||||
g_sdata.input_script = (char *)GlobalAlloc(GPTR, cds->cbData);
|
||||
lstrcpy(g_sdata.input_script, (char *)cds->lpData);
|
||||
break;
|
||||
case MAKENSIS_NOTIFY_WARNING:
|
||||
g_sdata.warnings++;
|
||||
break;
|
||||
case MAKENSIS_NOTIFY_ERROR:
|
||||
break;
|
||||
case MAKENSIS_NOTIFY_OUTPUT:
|
||||
if (g_sdata.output_exe) GlobalFree(g_sdata.output_exe);
|
||||
g_sdata.output_exe = (char *)GlobalAlloc(GPTR, cds->cbData);
|
||||
lstrcpy(g_sdata.output_exe, (char *)cds->lpData);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam)) {
|
||||
|
|
|
@ -58,6 +58,13 @@
|
|||
|
||||
#define WM_MAKENSIS_PROCESSCOMPLETE (WM_USER+1001)
|
||||
|
||||
enum {
|
||||
MAKENSIS_NOTIFY_SCRIPT,
|
||||
MAKENSIS_NOTIFY_WARNING,
|
||||
MAKENSIS_NOTIFY_ERROR,
|
||||
MAKENSIS_NOTIFY_OUTPUT
|
||||
};
|
||||
|
||||
// Extern Variables
|
||||
extern const char* NSISW_VERSION;
|
||||
|
||||
|
@ -79,7 +86,7 @@ typedef struct NSISScriptData {
|
|||
char *brandingv;
|
||||
int retcode;
|
||||
DWORD logLength;
|
||||
BOOL warnings;
|
||||
DWORD warnings;
|
||||
BOOL appended;
|
||||
HINSTANCE hInstance;
|
||||
HWND hwnd;
|
||||
|
|
|
@ -89,50 +89,6 @@ void DisableItems(HWND hwnd) {
|
|||
}
|
||||
|
||||
void EnableItems(HWND hwnd) {
|
||||
HWND hwLog = GetDlgItem(hwnd, IDC_LOGWIN);
|
||||
#define MSG(a) SendMessage(hwLog,a,0,0)
|
||||
#define MSG1(a,b) SendMessage(hwLog,a,b,0)
|
||||
#define MSG2(a,b,c) SendMessage(hwLog,a,b,c)
|
||||
if (g_sdata.input_script) {
|
||||
GlobalFree(g_sdata.input_script);
|
||||
g_sdata.input_script = 0;
|
||||
}
|
||||
if (g_sdata.output_exe) {
|
||||
GlobalFree(g_sdata.output_exe);
|
||||
g_sdata.output_exe = 0;
|
||||
}
|
||||
TEXTRANGE tr;
|
||||
FINDTEXT ft;
|
||||
|
||||
// find input script
|
||||
ft.chrg.cpMin = 0;
|
||||
ft.chrg.cpMax = MSG(WM_GETTEXTLENGTH);
|
||||
ft.lpstrText = "Processing script file: \"";
|
||||
ft.chrg.cpMin = tr.chrg.cpMin = MSG2(EM_FINDTEXT, 0, (LPARAM)&ft) + lstrlen("Processing script file: \"");
|
||||
ft.lpstrText = "\"";
|
||||
tr.chrg.cpMax = MSG2(EM_FINDTEXT, 0, (LPARAM)&ft);
|
||||
if (tr.chrg.cpMin == lstrlen("Processing script file: \"") - 1) tr.chrg.cpMax = tr.chrg.cpMin = 0;
|
||||
tr.lpstrText = g_sdata.input_script = (char *)GlobalAlloc(GPTR, tr.chrg.cpMax-tr.chrg.cpMin+1);
|
||||
MSG2(EM_GETTEXTRANGE, 0, (WPARAM)&tr);
|
||||
|
||||
// find output exe
|
||||
ft.chrg.cpMin = 0;
|
||||
ft.chrg.cpMax = MSG(WM_GETTEXTLENGTH);
|
||||
ft.lpstrText = "Output: \"";
|
||||
ft.chrg.cpMin = tr.chrg.cpMin = MSG2(EM_FINDTEXT, 0, (LPARAM)&ft) + lstrlen("Output: \"");
|
||||
ft.lpstrText = "\"";
|
||||
tr.chrg.cpMax = MSG2(EM_FINDTEXT, 0, (LPARAM)&ft);
|
||||
if (tr.chrg.cpMin == lstrlen("Output: \"") - 1) tr.chrg.cpMax = tr.chrg.cpMin = 0;
|
||||
tr.lpstrText = g_sdata.output_exe = (char *)GlobalAlloc(GPTR, tr.chrg.cpMax-tr.chrg.cpMin+1);
|
||||
MSG2(EM_GETTEXTRANGE, 0, (WPARAM)&tr);
|
||||
|
||||
g_sdata.warnings = FALSE;
|
||||
|
||||
ft.lpstrText = "warning:";
|
||||
if (MSG2(EM_FINDTEXT, 0, (LPARAM)&ft) != -1) g_sdata.warnings++;
|
||||
ft.lpstrText = "warnings:";
|
||||
if (MSG2(EM_FINDTEXT, 0, (LPARAM)&ft) != -1) g_sdata.warnings++;
|
||||
|
||||
if (g_sdata.output_exe && !g_sdata.retcode) {
|
||||
EnableWindow(GetDlgItem(hwnd,IDC_TEST),1);
|
||||
EnableMenuItem(g_sdata.menu,IDM_TEST,MF_ENABLED);
|
||||
|
@ -166,13 +122,18 @@ void CompileNSISScript() {
|
|||
}
|
||||
if (!g_sdata.appended) {
|
||||
if (s) GlobalFree(s);
|
||||
s = (char *)GlobalAlloc(GPTR, lstrlen(g_sdata.script)+sizeof(EXENAME)+2);
|
||||
wsprintf(s,"%s %s",EXENAME,g_sdata.script);
|
||||
s = (char *)GlobalAlloc(GPTR, lstrlen(g_sdata.script)+sizeof(EXENAME)+sizeof(" /NOTIFYHWND ")+16);
|
||||
wsprintf(s,"%s /NOTIFYHWND %d %s",EXENAME,g_sdata.hwnd,g_sdata.script);
|
||||
if (g_sdata.script_alloced) GlobalFree(g_sdata.script);
|
||||
g_sdata.script_alloced = true;
|
||||
g_sdata.script = s;
|
||||
g_sdata.appended = TRUE;
|
||||
}
|
||||
GlobalFree(g_sdata.input_script);
|
||||
GlobalFree(g_sdata.output_exe);
|
||||
g_sdata.input_script = 0;
|
||||
g_sdata.output_exe = 0;
|
||||
g_sdata.warnings = 0;
|
||||
g_sdata.logLength = 0;
|
||||
// Disable buttons during compile
|
||||
DisableItems(g_sdata.hwnd);
|
||||
|
|
|
@ -313,6 +313,8 @@ CEXEBuild::CEXEBuild()
|
|||
|
||||
build_last_page_define[0]=0;
|
||||
ubuild_last_page_define[0]=0;
|
||||
|
||||
notify_hwnd=0;
|
||||
}
|
||||
|
||||
int CEXEBuild::getcurdbsize() { return cur_datablock->getlen(); }
|
||||
|
@ -1619,6 +1621,7 @@ int CEXEBuild::write_output(void)
|
|||
{
|
||||
char buffer[1024],*p;
|
||||
GetFullPathName(build_output_filename,1024,buffer,&p);
|
||||
notify(MAKENSIS_NOTIFY_OUTPUT, buffer);
|
||||
INFO_MSG("\nOutput: \"%s\"\n",buffer);
|
||||
}
|
||||
FILE *fp = fopen(build_output_filename,"w+b");
|
||||
|
@ -2133,6 +2136,7 @@ void CEXEBuild::warning(const char *s, ...)
|
|||
vsprintf(buf,s,val);
|
||||
va_end(val);
|
||||
m_warnings.add(buf,-1);
|
||||
notify(MAKENSIS_NOTIFY_WARNING,buf);
|
||||
if (display_warnings)
|
||||
{
|
||||
fprintf(g_output,"warning: %s\n",buf);
|
||||
|
@ -2142,16 +2146,20 @@ void CEXEBuild::warning(const char *s, ...)
|
|||
|
||||
void CEXEBuild::ERROR_MSG(const char *s, ...)
|
||||
{
|
||||
if (display_errors)
|
||||
if (display_errors || notify_hwnd)
|
||||
{
|
||||
char buf[4096];
|
||||
va_list val;
|
||||
va_start(val,s);
|
||||
vsprintf(buf,s,val);
|
||||
va_end(val);
|
||||
notify(MAKENSIS_NOTIFY_ERROR,buf);
|
||||
if (display_errors)
|
||||
{
|
||||
fprintf(g_output,"%s",buf);
|
||||
fflush(g_output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEXEBuild::SCRIPT_MSG(const char *s, ...)
|
||||
|
@ -2197,6 +2205,15 @@ void CEXEBuild::print_warnings()
|
|||
fflush(g_output);
|
||||
}
|
||||
|
||||
void CEXEBuild::notify(int code, char *data)
|
||||
{
|
||||
if (notify_hwnd)
|
||||
{
|
||||
COPYDATASTRUCT cds = {(DWORD)code, strlen(data)+1, data};
|
||||
SendMessage(notify_hwnd, WM_COPYDATA, 0, (LPARAM)&cds);
|
||||
}
|
||||
}
|
||||
|
||||
// Added by Ximon Eighteen 5th August 2002
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
void CEXEBuild::build_plugin_table(void)
|
||||
|
|
|
@ -41,6 +41,13 @@ extern "C"
|
|||
#define PS_ERROR 50
|
||||
#define IS_PS_ELSE(x) (( x ) >= PS_ELSE && ( x ) <= PS_ELSE_IF1)
|
||||
|
||||
enum {
|
||||
MAKENSIS_NOTIFY_SCRIPT,
|
||||
MAKENSIS_NOTIFY_WARNING,
|
||||
MAKENSIS_NOTIFY_ERROR,
|
||||
MAKENSIS_NOTIFY_OUTPUT
|
||||
};
|
||||
|
||||
class CEXEBuild {
|
||||
public:
|
||||
CEXEBuild();
|
||||
|
@ -75,6 +82,9 @@ class CEXEBuild {
|
|||
int display_warnings;
|
||||
int display_info;
|
||||
|
||||
HWND notify_hwnd;
|
||||
void notify(int code, char *data);
|
||||
|
||||
private:
|
||||
// tokens.cpp
|
||||
int get_commandtoken(char *s, int *np, int *op);
|
||||
|
@ -87,15 +97,14 @@ class CEXEBuild {
|
|||
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
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
// Added by Amir Szekely 9th August 2002
|
||||
int add_plugins_dir_initializer(void);
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
void ERROR_MSG(const char *s, ...);
|
||||
void SCRIPT_MSG(const char *s, ...);
|
||||
void INFO_MSG(const char *s, ...);
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
int add_plugins_dir_initializer(void);
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
// build.cpp functions used mostly by script.cpp
|
||||
int getcurdbsize();
|
||||
int add_section(const char *secname, const char *file, int line, const char *defname, int expand);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue