Commit b20c9dd2 authored by John van Groningen's avatar John van Groningen

add dispatch_null_message_hook to start_compiler_process,

pass NULL for BatchBuild, in the latter case the compiler will remove
the reference to the dispatch_null_message_hook label,
this makes it possible to link BatchBuild on windows without ObjectIO
parent afeb04fe
......@@ -246,6 +246,11 @@ CompileStartCommand cocl` write_module_times errwin compileOrCheckSyntax path pa
where
write_module_times_string = if write_module_times " -wmt " " "
dispatch_null_message_hook :: Int;
dispatch_null_message_hook = code {
pushLc dispatch_null_message_hook
}
start_compile_with_cache :: String Int String String String CompilerProcessIds *env -> (!Bool,!CompilerProcessIds,!*env)
start_compile_with_cache path slot directory startup_arguments arguments compiler_process_ids ps
| slot<length compiler_process_ids
......@@ -253,7 +258,8 @@ start_compile_with_cache path slot directory startup_arguments arguments compile
= start_compile_with_cache2 path compiler_handles_and_id directory arguments compiler_process_ids ps
# thread_id=get_current_thread_id;
# begin_arguments=startup_arguments+++" -ide "+++int_to_hex thread_id;
# (r,compiler_thread_id,compiler_thread_handle,compiler_process_handle) = start_compiler_process (path+++"\0") (directory+++"\0") ("\""+++path+++"\" "+++begin_arguments+++"\0");
# (r,compiler_thread_id,compiler_thread_handle,compiler_process_handle)
= start_compiler_process (IF_BATCHBUILD_OR_IDE 0 dispatch_null_message_hook) (path+++"\0") (directory+++"\0") ("\""+++path+++"\" "+++begin_arguments+++"\0");
| r==0
= (False,compiler_process_ids,ps)
# compiler_handles_and_id = {compiler_thread_id=compiler_thread_id,compiler_thread_handle=compiler_thread_handle,compiler_process_handle=compiler_process_handle}
......@@ -860,7 +866,8 @@ compile_with_cache path directory startup_arguments arguments prog=:(CompilingIn
// # startup_arguments = ""
# thread_id=get_current_thread_id;
# begin_arguments=startup_arguments+++" -ide "+++int_to_hex thread_id;
# (r,compiler_thread_id,compiler_thread_handle,compiler_process_handle) = start_compiler_process (path+++"\0") (directory+++"\0") ("\""+++path+++"\" "+++begin_arguments+++"\0");
# (r,compiler_thread_id,compiler_thread_handle,compiler_process_handle)
= start_compiler_process (IF_BATCHBUILD_OR_IDE 0 dispatch_null_message_hook) (path+++"\0") (directory+++"\0") ("\""+++path+++"\" "+++begin_arguments+++"\0");
| r==0
= (False,0,prog)
# (ok,s) = compile_with_cache2 path directory arguments compiler_thread_id compiler_thread_handle compiler_process_handle;
......
......@@ -4,8 +4,6 @@
#include "Clean.h"
#include "thread_message.h"
static int CleanCompiler_message_nunber;
int get_message_number (void)
{
return RegisterWindowMessage ("CleanCompiler");
......@@ -16,9 +14,9 @@ int get_current_thread_id (void)
return GetCurrentThreadId();
}
int compiler_result_handler_installed=0;
static int CleanCompiler_message_nunber;
extern void (*dispatch_null_message_hook) (MSG*);
int compiler_result_handler_installed=0;
#define MAX_N_COMPILERS 32
......@@ -39,14 +37,13 @@ void compiler_result_handler (MSG *msg)
}
}
void install_compiler_result_handler (void)
void install_compiler_result_handler (void (**dispatch_null_message_hook_p) (MSG*))
{
CleanCompiler_message_nunber=get_message_number();
dispatch_null_message_hook = &compiler_result_handler;
*dispatch_null_message_hook_p = &compiler_result_handler;
}
int start_compiler_process (CleanString compiler_path,CleanString compiler_directory,CleanString command,
int start_compiler_process (void (**dispatch_null_message_hook_p) (MSG*),CleanString compiler_path,CleanString compiler_directory,CleanString command,
int *compiler_thread_id_p,size_t *compiler_thread_handle_p,size_t *compiler_process_handle_p)
{
PSTR application_name,command_line,env,dir;
......@@ -55,7 +52,8 @@ int start_compiler_process (CleanString compiler_path,CleanString compiler_direc
int r;
if (!compiler_result_handler_installed){
install_compiler_result_handler();
if (dispatch_null_message_hook_p!=NULL)
install_compiler_result_handler (dispatch_null_message_hook_p);
compiler_result_handler_installed=1;
}
......@@ -255,7 +253,6 @@ int get_finished_compiler_id_and_exit_code (int *exit_code_p)
void win_create_process (PSTR commandline,PSTR dir,int *success,int *exitcode)
{
SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL fsuccess;
......@@ -263,10 +260,6 @@ void win_create_process (PSTR commandline,PSTR dir,int *success,int *exitcode)
*success = FALSE;
*exitcode = -1;
sa.nLength = sizeof (SECURITY_ATTRIBUTES);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
si.cb = sizeof (STARTUPINFO);
si.lpReserved = NULL;
si.lpReserved2 = NULL;
......
......@@ -6,8 +6,8 @@ get_message_number :: Int;
// int get_message_number ();
get_current_thread_id :: Int;
// int get_current_thread_id ();
start_compiler_process :: !String !String !String -> (!Int,!Int,!Int,!Int);
// int start_compiler_process (CleanString compiler_path,CleanString compiler_directory,CleanString command,int* compiler_thread_id_p,int* compiler_thread_handle_p,int* process_handle_p);
start_compiler_process :: !Int !String !String !String -> (!Int,!Int,!Int,!Int);
// int start_compiler_process (void (**dispatch_null_message_hook) (MSG*),CleanString compiler_path,CleanString compiler_directory,CleanString command,int* compiler_thread_id_p,int* compiler_thread_handle_p,int* process_handle_p);
send_string_to_thread :: !Int !Int !Int !String -> Int;
// int send_string_to_thread (int thread_id,int thread_handle,int wm_number,CleanString s);
send_integers_to_thread :: !Int !Int !Int !Int -> Int;
......
......@@ -3,10 +3,10 @@ implementation module thread_message;
import StdString,StdInt;
import code from "c_thread_message.";
import code from library "thread_kernel32_library";
import code from library "thread_user32_library";
get_message_number :: Int;
get_message_number = code {
ccall get_message_number ":I"
......@@ -19,19 +19,19 @@ get_current_thread_id = code {
};
// int get_current_thread_id ();
start_compiler_process :: !String !String !String -> (!Int,!Int,!Int,!Int);
start_compiler_process a0 a1 a2
= IF_INT_64_OR_32 (start_compiler_process_64 a0 a1 a2) (start_compiler_process_32 a0 a1 a2);
// int start_compiler_process (CleanString compiler_path,CleanString compiler_directory,CleanString command,int* compiler_thread_id_p,size_t* compiler_thread_handle_p,size_t* process_handle_p);
start_compiler_process :: !Int !String !String !String -> (!Int,!Int,!Int,!Int);
start_compiler_process a0 a1 a2 a3
= IF_INT_64_OR_32 (start_compiler_process_64 a0 a1 a2 a3) (start_compiler_process_32 a0 a1 a2 a3);
// int start_compiler_process (void (**dispatch_null_message_hook_p) (MSG*),CleanString compiler_path,CleanString compiler_directory,CleanString command,int* compiler_thread_id_p,size_t* compiler_thread_handle_p,size_t* process_handle_p);
start_compiler_process_32 :: !String !String !String -> (!Int,!Int,!Int,!Int);
start_compiler_process_32 a0 a1 a2 = code {
ccall start_compiler_process "SSS:IIII"
start_compiler_process_32 :: !Int !String !String !String -> (!Int,!Int,!Int,!Int);
start_compiler_process_32 a0 a1 a2 a3 = code {
ccall start_compiler_process "ISSS:IIII"
};
start_compiler_process_64 :: !String !String !String -> (!Int,!Int,!Int,!Int);
start_compiler_process_64 a0 a1 a2 = code {
ccall start_compiler_process "SSS:IIpp"
start_compiler_process_64 :: !Int !String !String !String -> (!Int,!Int,!Int,!Int);
start_compiler_process_64 a0 a1 a2 a3 = code {
ccall start_compiler_process "pSSS:IIpp"
};
send_string_to_thread :: !Int !Int !Int !String -> Int;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment