diff options
author | ronny | 2002-06-11 09:41:13 +0000 |
---|---|---|
committer | ronny | 2002-06-11 09:41:13 +0000 |
commit | 9cfa6e6c6e1759f3806a4f15ad608aa3d4e1dfe4 (patch) | |
tree | 9c22eb8e784405a703f2b51824cca287295ca44b /main/Windows | |
parent | Moved system dependent code from coclmain to CoclSystemDependent (diff) |
Moved system dependent code from coclmain to CoclSystemDependent
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1091 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'main/Windows')
-rw-r--r-- | main/Windows/CoclSystemDependent.dcl | 5 | ||||
-rw-r--r-- | main/Windows/CoclSystemDependent.icl | 103 |
2 files changed, 108 insertions, 0 deletions
diff --git a/main/Windows/CoclSystemDependent.dcl b/main/Windows/CoclSystemDependent.dcl index bdcddb1..69b9848 100644 --- a/main/Windows/CoclSystemDependent.dcl +++ b/main/Windows/CoclSystemDependent.dcl @@ -24,3 +24,8 @@ SystemDependentInitialIO :: [a] ensureCleanSystemFilesExists :: !String !*Files -> (!Bool, !*Files) set_compiler_id :: Int -> Int + +:: CompileFun st + :== ([{#Char}] st -> (Bool, st)) + +compiler_loop :: (CompileFun *st) *st -> (!Bool, !*st) diff --git a/main/Windows/CoclSystemDependent.icl b/main/Windows/CoclSystemDependent.icl index 5ef779f..9792c1d 100644 --- a/main/Windows/CoclSystemDependent.icl +++ b/main/Windows/CoclSystemDependent.icl @@ -2,6 +2,7 @@ implementation module CoclSystemDependent import StdEnv +import ArgEnv // import for filesystem import code from "cDirectory.obj", library "directory_library" // Windows @@ -27,3 +28,105 @@ ensureCleanSystemFilesExists path env set_compiler_id :: Int -> Int set_compiler_id compiler_id = compiler_id + +:: CompileFun st + :== ([{#Char}] st -> (Bool, st)) + +import thread_message; + +import code from "thread_message.obj"; + +compiler_loop :: (CompileFun *st) *st -> (!Bool, !*st) +compiler_loop compile compile_state + | length commandArgs==2 && commandArgs!!0=="-ide" + # wm_number=get_message_number; + # thread_id=hex_to_int (commandArgs!!1); + = (True,compile_files compile thread_id wm_number compile_state) + # (r,compile_state)=compile commandArgs compile_state + = (r,compile_state) + where + commandArgs + = tl [arg \\ arg <-: getCommandLine] + +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 compile thread_id wm_number compile_state + # (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,compile_state)=compile cocl_args compile_state + # result=if ok 0(-1); + # r=send_integers_to_thread thread_id wm_number 0 result; + | r==0 + -> abort "compile_files 3"; + -> compile_files compile thread_id wm_number compile_state + ["exit"] + -> compile_state; + _ + -> abort "compile_files 4" |