Commit 1a6c812d authored by John van Groningen's avatar John van Groningen
Browse files

add symbol_heap parameter to function empty_cache

parent 0ab124f0
...@@ -13,4 +13,5 @@ compile :: ![{#Char}] !*DclCache !*Files -> (!Bool,!*DclCache,!*Files) ...@@ -13,4 +13,5 @@ compile :: ![{#Char}] !*DclCache !*Files -> (!Bool,!*DclCache,!*Files)
heaps::!.Heaps heaps::!.Heaps
}; };
empty_cache :: *DclCache empty_cache :: *SymbolTable -> *DclCache
...@@ -7,10 +7,6 @@ import CoclSystemDependent ...@@ -7,10 +7,6 @@ import CoclSystemDependent
import portToNewSyntax import portToNewSyntax
//import RWSDebug //import RWSDebug
// MV ...
generate_tcl_file :== False;
// ... MV
:: CoclOptions = :: CoclOptions =
{ {
moduleName:: {#Char} moduleName:: {#Char}
...@@ -46,10 +42,10 @@ InitialCoclOptions = ...@@ -46,10 +42,10 @@ InitialCoclOptions =
heaps::!.Heaps heaps::!.Heaps
}; };
empty_cache :: *DclCache empty_cache :: *SymbolTable -> *DclCache
empty_cache empty_cache symbol_heap
# heaps = {hp_var_heap = newHeap, hp_expression_heap = newHeap, hp_type_heaps = {th_vars = newHeap, th_attrs = newHeap}} # heaps = {hp_var_heap = newHeap, hp_expression_heap = newHeap, hp_type_heaps = {th_vars = newHeap, th_attrs = newHeap}}
# (predef_symbols, hash_table) = buildPredefinedSymbols newHashTable # (predef_symbols, hash_table) = buildPredefinedSymbols (newHashTable symbol_heap)
= {dcl_modules={},functions_and_macros={},predef_symbols=predef_symbols,hash_table=hash_table,heaps=heaps} = {dcl_modules={},functions_and_macros={},predef_symbols=predef_symbols,hash_table=hash_table,heaps=heaps}
compile :: ![{#Char}] !*DclCache !*Files -> (!Bool,!*DclCache,!*Files) compile :: ![{#Char}] !*DclCache !*Files -> (!Bool,!*DclCache,!*Files)
...@@ -63,17 +59,6 @@ compile args cache files ...@@ -63,17 +59,6 @@ compile args cache files
parseCommandLine :: [{#Char}] CoclOptions -> ([{#Char}],[{#Char}],CoclOptions) parseCommandLine :: [{#Char}] CoclOptions -> ([{#Char}],[{#Char}],CoclOptions)
parseCommandLine [] options parseCommandLine [] options
= ([],[],options) = ([],[],options)
/*
// JVG: removed hack because the searchPaths list becomes too large when >1 file is compiled
= prependModulePath options
where
// RWS +++ hack, both module name and file path should be passed to frontEndInterface
prependModulePath options=:{pathName, searchPaths}
= { options
& moduleName = baseName pathName
, searchPaths = {searchPaths & sp_paths = [directoryName pathName : searchPaths.sp_paths]}
}
*/
parseCommandLine [arg1=:"-P", searchPathsString : args] options=:{searchPaths} parseCommandLine [arg1=:"-P", searchPathsString : args] options=:{searchPaths}
// RWS, voor Maarten +++ = parseCommandLine args {options & searchPaths = {searchPaths & sp_paths = splitPaths searchPathsString}} // RWS, voor Maarten +++ = parseCommandLine args {options & searchPaths = {searchPaths & sp_paths = splitPaths searchPathsString}}
# (args,modules,options) = parseCommandLine args {options & searchPaths.sp_paths = splitPaths searchPathsString} # (args,modules,options) = parseCommandLine args {options & searchPaths.sp_paths = splitPaths searchPathsString}
...@@ -90,13 +75,16 @@ parseCommandLine [arg1=:"-RE", errorPath : args] options ...@@ -90,13 +75,16 @@ parseCommandLine [arg1=:"-RE", errorPath : args] options
parseCommandLine [arg1=:"-RAE", errorPath : args] options parseCommandLine [arg1=:"-RAE", errorPath : args] options
# (args,modules,options)= parseCommandLine args {options & errorPath = stripQuotes errorPath, errorMode = FAppendText} # (args,modules,options)= parseCommandLine args {options & errorPath = stripQuotes errorPath, errorMode = FAppendText}
= ([arg1,errorPath:args],modules,options) = ([arg1,errorPath:args],modules,options)
parseCommandLine ["-id",compiler_id_string : args] options
# compiler_id=toInt compiler_id_string
| set_compiler_id compiler_id==compiler_id
= parseCommandLine args options
// MV ... // MV ...
parseCommandLine [arg1=:"-dynamics":args] options parseCommandLine [arg1=:"-dynamics":args] options
// generates for each icl an tcl (which contains the type information for that module) // generates for each icl an tcl (which contains the type information for that module)
# (args,modules,options)= parseCommandLine args {options & compile_for_dynamics = True} # (args,modules,options)= parseCommandLine args {options & compile_for_dynamics = True}
= (args,modules,options) = (args,modules,options)
// ... MV // ... MV
parseCommandLine [arg : args] options parseCommandLine [arg : args] options
| arg.[0] == '-' | arg.[0] == '-'
# (args,modules,options)= parseCommandLine args options # (args,modules,options)= parseCommandLine args options
...@@ -105,6 +93,11 @@ parseCommandLine [arg : args] options ...@@ -105,6 +93,11 @@ parseCommandLine [arg : args] options
# (args,modules,options) = parseCommandLine args options # (args,modules,options) = parseCommandLine args options
= (args,[arg : modules],options); = (args,[arg : modules],options);
set_compiler_id :: !Int -> Int;
set_compiler_id id = code {
ccall set_compiler_id "I:I"
};
stripExtension :: {#Char} {#Char} -> {#Char} stripExtension :: {#Char} {#Char} -> {#Char}
stripExtension extension string stripExtension extension string
| stringSize >= extensionSize && (string % (stringSize-extensionSize, stringSize-1)) == extension | stringSize >= extensionSize && (string % (stringSize-extensionSize, stringSize-1)) == extension
...@@ -189,7 +182,7 @@ compileModule options commandLineArgs {dcl_modules,functions_and_macros,predef_s ...@@ -189,7 +182,7 @@ compileModule options commandLineArgs {dcl_modules,functions_and_macros,predef_s
= abort ("couldn't open out file \"" +++ options.outPath +++ "\"\n") = abort ("couldn't open out file \"" +++ options.outPath +++ "\"\n")
# (tcl_file, files) # (tcl_file, files)
= openTclFile options options.pathName files = openTclFile options options.pathName files
# (io, files) # (io, files)
= stdio files = stdio files
// (moduleIdent, hash_table) = putIdentInHashTable options.moduleName IC_Module hash_table // (moduleIdent, hash_table) = putIdentInHashTable options.moduleName IC_Module hash_table
# ({boxed_ident=moduleIdent}, hash_table) = putIdentInHashTable options.moduleName IC_Module hash_table # ({boxed_ident=moduleIdent}, hash_table) = putIdentInHashTable options.moduleName IC_Module hash_table
...@@ -197,14 +190,10 @@ compileModule options commandLineArgs {dcl_modules,functions_and_macros,predef_s ...@@ -197,14 +190,10 @@ compileModule options commandLineArgs {dcl_modules,functions_and_macros,predef_s
# (optionalSyntaxTree,cached_functions_and_macros,n_functions_and_macros_in_dcl_modules,main_dcl_module_n,predef_symbols, hash_table, files, error, io, out,tcl_file,heaps) # (optionalSyntaxTree,cached_functions_and_macros,n_functions_and_macros_in_dcl_modules,main_dcl_module_n,predef_symbols, hash_table, files, error, io, out,tcl_file,heaps)
= frontEndInterface FrontEndPhaseAll moduleIdent options.searchPaths dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table files error io out tcl_file heaps = frontEndInterface FrontEndPhaseAll moduleIdent options.searchPaths dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table files error io out tcl_file heaps
# unique_copy_of_predef_symbols={predef_symbol\\predef_symbol<-:predef_symbols} # unique_copy_of_predef_symbols={predef_symbol\\predef_symbol<-:predef_symbols}
// MV ...
# (closed, files) # (closed, files)
= closeTclFile tcl_file files = closeTclFile tcl_file files
// ... MV
| not closed | not closed
= abort ("couldn't close tcl file \"" +++ options.pathName +++ "tcl\"\n") = abort ("couldn't close tcl file \"" +++ options.pathName +++ "tcl\"\n")
# (closed, files) # (closed, files)
= fclose io files = fclose io files
| not closed | not closed
...@@ -222,9 +211,7 @@ compileModule options commandLineArgs {dcl_modules,functions_and_macros,predef_s ...@@ -222,9 +211,7 @@ compileModule options commandLineArgs {dcl_modules,functions_and_macros,predef_s
# dcl_modules=syntaxTree.fe_dcls # dcl_modules=syntaxTree.fe_dcls
# functions_and_macros = syntaxTree.fe_icl.icl_functions # functions_and_macros = syntaxTree.fe_icl.icl_functions
# (porting_ok, files) # (porting_ok, files)
= switch_port_to_new_syntax = switch_port_to_new_syntax (createPortedFiles options.moduleName options.searchPaths files) (False, files)
(createPortedFiles options.moduleName options.searchPaths files)
(False, files)
error = switch_port_to_new_syntax error = switch_port_to_new_syntax
(case porting_ok of (case porting_ok of
True True
...@@ -286,10 +273,8 @@ openTclFile options icl_mod_pathname files ...@@ -286,10 +273,8 @@ openTclFile options icl_mod_pathname files
| opened | opened
=(Yes tcl_file, files) =(Yes tcl_file, files)
= abort ("couldn't open file \"" +++ tcl_path +++ "\"\n") = abort ("couldn't open file \"" +++ tcl_path +++ "\"\n")
closeTclFile (Yes tcl_file) files closeTclFile (Yes tcl_file) files
= fclose tcl_file files = fclose tcl_file files
closeTclFile _ files closeTclFile _ files
= (True,files); = (True,files);
// ... MV
Supports Markdown
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