aboutsummaryrefslogtreecommitdiff
path: root/main/compile.icl
diff options
context:
space:
mode:
authorronny2003-10-20 13:16:07 +0000
committerronny2003-10-20 13:16:07 +0000
commit82a487c1903833ca30c4f1624fb5cee90b9bfe4d (patch)
tree72ac2869c491ceaa874ea3912e8c742a0a2981d8 /main/compile.icl
parentupdate backend.dll to version 2.1.0a1 (diff)
don't abort when tcl file can't be created but give error message
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1400 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'main/compile.icl')
-rw-r--r--main/compile.icl38
1 files changed, 25 insertions, 13 deletions
diff --git a/main/compile.icl b/main/compile.icl
index 7b04b22..b61146f 100644
--- a/main/compile.icl
+++ b/main/compile.icl
@@ -35,10 +35,10 @@ splitBy char string
stringSize
= size string
-openTclFile :: !Bool !String !*Files -> (Optional .File, !*Files)
-openTclFile False icl_mod_pathname files
- = (No,files)
-openTclFile compile_for_dynamics icl_mod_pathname files
+openTclFile :: !Bool !String !*File !*Files -> (!Bool, !Optional .File, !*File, !*Files)
+openTclFile False icl_mod_pathname error files
+ = (True,No,error,files)
+openTclFile compile_for_dynamics icl_mod_pathname error files
# csf_path
= directoryName icl_mod_pathname +++ "Clean System Files"
# tcl_path
@@ -46,17 +46,19 @@ openTclFile compile_for_dynamics icl_mod_pathname files
# (opened, tcl_file, files)
= fopen tcl_path FWriteData files
| opened
- = (Yes tcl_file, files)
+ = (True, Yes tcl_file, error, files)
// try again after creating Clean System Files folder
# (ok, files)
= ensureCleanSystemFilesExists csf_path files
| not ok
- = abort ("can't create folder \"" +++ csf_path +++"\"\n")
+ # error = fwrites ("can't create folder \"" +++ csf_path +++"\"\n") error
+ = (False, No, error, files)
# (opened, tcl_file, files)
= fopen tcl_path FWriteData files
- | opened
- =(Yes tcl_file, files)
- = abort ("couldn't open file \"" +++ tcl_path +++ "\"\n")
+ | not opened
+ # error = fwrites ("couldn't open file \"" +++ tcl_path +++ "\"\n") error
+ = (False, No, error, files)
+ = (True, Yes tcl_file, error, files)
closeTclFile :: !*(Optional *File) *Files -> *(!Bool,*Files)
closeTclFile (Yes tcl_file) files
@@ -241,7 +243,7 @@ openPath path mode files
= fopen path mode files
compileModule :: CoclOptions [{#Char}] *DclCache *Files -> (!Bool,!*DclCache,!*Files)
-compileModule options backendArgs {dcl_modules,functions_and_macros,predef_symbols,hash_table,heaps} files
+compileModule options backendArgs cache=:{dcl_modules,functions_and_macros,predef_symbols,hash_table,heaps} files
# (opened, error, files)
= openPath options.errorPath options.errorMode files
| not opened
@@ -250,9 +252,19 @@ compileModule options backendArgs {dcl_modules,functions_and_macros,predef_symbo
= openPath options.outPath options.outMode files
| not opened
= abort ("couldn't open out file \"" +++ options.outPath +++ "\"\n")
- # (tcl_file, files)
- = openTclFile options.compile_for_dynamics options.pathName files
- # (io, files)
+ # (optional_tcl_opened, tcl_file, error, files)
+ = openTclFile options.compile_for_dynamics options.pathName error files
+ | not optional_tcl_opened
+ # (closed, files)
+ = fclose out files
+ | not closed
+ = abort ("couldn't close stdio")
+ # (closed, files)
+ = fclose error files
+ | not closed
+ = abort ("couldn't close out file \"" +++ options.outPath +++ "\"\n")
+ = (False, cache, files)
+ # (io, files)
= stdio files
# ({boxed_ident=moduleIdent}, hash_table) = putIdentInHashTable options.moduleName IC_Module hash_table
# list_inferred_types