diff options
author | johnvg | 2001-06-25 08:54:42 +0000 |
---|---|---|
committer | johnvg | 2001-06-25 08:54:42 +0000 |
commit | a4fd4e7930bdb8923c00f2dcba4b071806605bcf (patch) | |
tree | 2615354d183f67d9faa72d46a9fe5f5a689f9775 /main | |
parent | new version number (2.0.d.8) (diff) |
add code for dcl module caching using the IDE
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@501 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'main')
-rw-r--r-- | main/Windows/Clean System Files/thread_message.obj | bin | 0 -> 3665 bytes | |||
-rw-r--r-- | main/Windows/thread_message.dcl | 20 | ||||
-rw-r--r-- | main/Windows/thread_message.icl | 53 | ||||
-rw-r--r-- | main/coclmain.icl | 98 |
4 files changed, 170 insertions, 1 deletions
diff --git a/main/Windows/Clean System Files/thread_message.obj b/main/Windows/Clean System Files/thread_message.obj Binary files differnew file mode 100644 index 0000000..79e99da --- /dev/null +++ b/main/Windows/Clean System Files/thread_message.obj diff --git a/main/Windows/thread_message.dcl b/main/Windows/thread_message.dcl new file mode 100644 index 0000000..04bc56e --- /dev/null +++ b/main/Windows/thread_message.dcl @@ -0,0 +1,20 @@ +definition module thread_message; +//1.3 +from StdString import String; +//3.1 +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); +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; +// int send_integers_to_thread (int thread_id,int wm_number,int i1,int i2); +get_integers_from_message :: !Int -> (!Int,!Int,!Int); +// int get_integers_from_message (int wm_number,int* i1_p,int* i2_p); +get_integers_from_thread_message :: !Int !Int -> (!Int,!Int,!Int); +// int get_integers_from_thread_message (int wm_number,int thread_handle,int* i1_p,int* i2_p); +get_string_from_file_map_and_delete_map :: !Int !String -> Int; +// int get_string_from_file_map_and_delete_map (int file_map,CleanString s); diff --git a/main/Windows/thread_message.icl b/main/Windows/thread_message.icl new file mode 100644 index 0000000..200f172 --- /dev/null +++ b/main/Windows/thread_message.icl @@ -0,0 +1,53 @@ +implementation module thread_message; + +//1.3 +from StdString import String; +//3.1 + +get_message_number :: Int; +get_message_number = code { + ccall get_message_number ":I" +}; +// int get_message_number (); + +get_current_thread_id :: Int; +get_current_thread_id = code { + ccall get_current_thread_id ":I" +}; +// int get_current_thread_id (); + +start_compiler_process :: !String !String !String -> (!Int,!Int,!Int,!Int); +start_compiler_process a0 a1 a2 = code { + ccall start_compiler_process "SSS:IIII" +}; +// 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); + +send_string_to_thread :: !Int !Int !Int !String -> Int; +send_string_to_thread a0 a1 a2 a3 = code { + ccall send_string_to_thread "IIIS:I" +}; +// 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; +send_integers_to_thread a0 a1 a2 a3 = code { + ccall send_integers_to_thread "IIII:I" +}; +// int send_integers_to_thread (int thread_id,int wm_number,int i1,int i2); + +get_integers_from_message :: !Int -> (!Int,!Int,!Int); +get_integers_from_message a0 = code { + ccall get_integers_from_message "I:III" +}; +// int get_integers_from_message (int wm_number,int* i1_p,int* i2_p); + +get_integers_from_thread_message :: !Int !Int -> (!Int,!Int,!Int); +get_integers_from_thread_message a0 a1 = code { + ccall get_integers_from_thread_message "II:III" +}; +// int get_integers_from_thread_message (int wm_number,int thread_handle,int* i1_p,int* i2_p); + +get_string_from_file_map_and_delete_map :: !Int !String -> Int; +get_string_from_file_map_and_delete_map a0 a1 = code { + ccall get_string_from_file_map_and_delete_map "IS:I" +}; +// int get_string_from_file_map_and_delete_map (int file_map,CleanString s); diff --git a/main/coclmain.icl b/main/coclmain.icl index 18cee66..79dddbd 100644 --- a/main/coclmain.icl +++ b/main/coclmain.icl @@ -54,10 +54,106 @@ coclMainWithVersionCheck currentVersion latestDefVersion latestImpVersion testA | not (fst (checkVersion (versionCompare expectedVersion observedVersion) stderr)) = set_return_code (-1) world # (success, world) - = accFiles (\files0 -> let (r,cache,files)=compile commandArgs empty_cache files0 in (r,files)) world + = accFiles (compiler commandArgs) world = set_return_code (if success 0(-1)) world where commandArgs = if (length realArgs == 0) testArgs realArgs realArgs = tl [arg \\ arg <-: getCommandLine] + +import thread_message; + +import code from "thread_message.obj"; + +compiler :: ![{#Char}] *Files -> *(!Bool,!*Files); +compiler commandArgs files + | length commandArgs==2 && commandArgs!!0=="-ide" + # wm_number=get_message_number; + # thread_id=hex_to_int (commandArgs!!1); + = (True,compile_files empty_cache thread_id wm_number files) + # (r,cache,files)=compile commandArgs empty_cache files + = (r,files) + +hex_to_int :: {#Char} -> Int +hex_to_int s + = hex_to_int 0 0; + where + l=size s; + + hex_to_int i n + | i==l + = n; + # c=s.[i]; + # i=i+1; + # n=n<<4; + | c<='9' + = hex_to_int i (n bitor (toInt c-toInt '0')); + = hex_to_int i (n bitor (toInt c-(toInt 'A'-10))); + +string_to_args string + = string_to_args 0; + where + l=size string; + + string_to_args i + # end_spaces_i=skip_spaces i; + | end_spaces_i==l + = [] + | string.[end_spaces_i]=='"' + # next_double_quote_i=skip_to_double_quote (end_spaces_i+1) + | next_double_quote_i>=l + = [string % (end_spaces_i,l-1)] + # arg=string % (end_spaces_i+1,next_double_quote_i-1); + = [arg : string_to_args (next_double_quote_i+1)]; + # space_i=skip_to_space (end_spaces_i+1) + | space_i>=l + = [string % (end_spaces_i,l-1)] + # arg=string % (end_spaces_i,space_i-1); + = [arg : string_to_args (space_i+1)]; + + skip_spaces i + | i>=l + = l; + # c=string.[i]; + | c==' ' || c=='\t' + = skip_spaces (i+1); + = i; + + skip_to_space i + | i>=l + = l; + # c=string.[i]; + | c==' ' || c=='\t' + = i; + = skip_to_space (i+1); + + skip_to_double_quote i + | i>=l + = l; + # c=string.[i]; + | c=='"' + = i; + = skip_to_double_quote (i+1); + +compile_files cache thread_id wm_number files + # (r,a,s) =get_integers_from_message wm_number; + | r==0 + = abort "compile_files 1"; + # string=createArray a '\0'; + # r=get_string_from_file_map_and_delete_map s string; + | r==0 + = abort ("compile_files 2 "); + # args=string_to_args (string % (0,size string-2)) + = case args of + ["cocl":cocl_args] + # (ok,cache,files)=compile cocl_args cache files + # result=if ok 0(-1); + # r=send_integers_to_thread thread_id wm_number 0 result; + | r==0 + -> abort "compile_files 3"; + -> compile_files cache thread_id wm_number files + ["exit"] + -> files; + _ + -> abort "compile_files 4" |