diff options
author | ronny | 2001-10-01 16:30:01 +0000 |
---|---|---|
committer | ronny | 2001-10-01 16:30:01 +0000 |
commit | 22886adb5dc622cb76184fa8ef97e2c2234652a8 (patch) | |
tree | 79e7eb317c55feba7e2b0717fde500d3df6c6ea2 /frontend | |
parent | moved system independent code to new module "filesystem" (diff) |
pass file modification times from icl module and dcl modules to backend
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@808 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/check.icl | 13 | ||||
-rw-r--r-- | frontend/checksupport.dcl | 4 | ||||
-rw-r--r-- | frontend/checksupport.icl | 4 | ||||
-rw-r--r-- | frontend/frontend.dcl | 2 | ||||
-rw-r--r-- | frontend/frontend.icl | 12 | ||||
-rw-r--r-- | frontend/main.icl | 6 | ||||
-rw-r--r-- | frontend/parse.dcl | 2 | ||||
-rw-r--r-- | frontend/parse.icl | 20 | ||||
-rw-r--r-- | frontend/postparse.dcl | 2 | ||||
-rw-r--r-- | frontend/postparse.icl | 52 | ||||
-rw-r--r-- | frontend/predef.icl | 2 | ||||
-rw-r--r-- | frontend/scanner.dcl | 7 | ||||
-rw-r--r-- | frontend/scanner.icl | 51 | ||||
-rw-r--r-- | frontend/syntax.dcl | 1 | ||||
-rw-r--r-- | frontend/syntax.icl | 1 |
15 files changed, 98 insertions, 81 deletions
diff --git a/frontend/check.icl b/frontend/check.icl index 3c8cf6b..1ddda1f 100644 --- a/frontend/check.icl +++ b/frontend/check.icl @@ -1582,7 +1582,7 @@ checkModule m icl_global_function_range fun_defs n_functions_and_macros_in_dcl_m # icl_instance_range = {ir_from = first_inst_index, ir_to = nr_of_functions} // llslsls CheckState - = check_module2 mod_name mod_imported_objects mod_imports mod_type icl_global_function_range icl_instance_range nr_of_functions n_functions_and_macros_in_dcl_modules optional_pre_def_mod local_defs icl_functions init_dcl_modules cdefs sizes heaps cs + = check_module2 mod_name m.mod_modification_time mod_imported_objects mod_imports mod_type icl_global_function_range icl_instance_range nr_of_functions n_functions_and_macros_in_dcl_modules optional_pre_def_mod local_defs icl_functions init_dcl_modules cdefs sizes heaps cs check_module1 {mod_type,mod_name,mod_imports,mod_imported_objects,mod_defs = cdefs} icl_global_function_range fun_defs optional_dcl_mod optional_pre_def_mod scanned_modules dcl_modules functions_and_macros dcl_module_n_in_cache predef_symbols symbol_table err_file # error = {ea_file = err_file, ea_loc = [], ea_ok = True } @@ -1750,12 +1750,12 @@ add_function_conversion_table dcl_to_icl_function_conversions main_dcl_module_n # dcl_modules = {dcl_modules & [main_dcl_module_n].dcl_conversions=Yes conversion_table} -> dcl_modules -check_module2 :: Ident [.ImportedObject] .[Import ImportDeclaration] .ModuleKind !.IndexRange !.IndexRange !Int !Int +check_module2 :: Ident {#Char} [.ImportedObject] .[Import ImportDeclaration] .ModuleKind !.IndexRange !.IndexRange !Int !Int (Optional (Module a)) [Declaration] *{#FunDef} *{#DclModule} (CollectedDefinitions ClassInstance IndexRange) *{#.Int} *Heaps *CheckState -> (!Bool,.IclModule,!.{#DclModule},.{!Group},!Optional {#Int},!.{#FunDef},!Int,!.Heaps,!.{#PredefinedSymbol}, !.Heap SymbolTableEntry,!.File,[String]); -check_module2 mod_name mod_imported_objects mod_imports mod_type icl_global_function_range icl_instance_range nr_of_functions n_functions_and_macros_in_dcl_modules optional_pre_def_mod local_defs icl_functions init_dcl_modules cdefs sizes heaps cs +check_module2 mod_name mod_modification_time mod_imported_objects mod_imports mod_type icl_global_function_range icl_instance_range nr_of_functions n_functions_and_macros_in_dcl_modules optional_pre_def_mod local_defs icl_functions init_dcl_modules cdefs sizes heaps cs # (main_dcl_module_n,cs)=cs!cs_x.x_main_dcl_module_n (icl_sizes_without_added_dcl_defs, sizes) = memcpy sizes (copied_dcl_defs, dcl_modules, local_defs, cdefs, icl_sizes, cs) @@ -1910,7 +1910,7 @@ check_module2 mod_name mod_imported_objects mod_imports mod_type icl_global_func com_instance_defs = class_instances } icl_mod = { icl_name = mod_name, icl_functions = icl_functions, icl_common = icl_common, icl_instances = icl_instances, icl_specials = icl_specials, icl_imported_objects = mod_imported_objects, icl_used_module_numbers = imported_module_numbers, icl_copied_from_dcl = copied_dcl_defs, - icl_import = icl_imported } + icl_import = icl_imported, icl_modification_time = mod_modification_time} heaps = { heaps & hp_var_heap = var_heap, hp_expression_heap = expr_heap, hp_type_heaps = {hp_type_heaps & th_vars = th_vars}} @@ -1929,7 +1929,7 @@ check_module2 mod_name mod_imported_objects mod_imports mod_type icl_global_func icl_instances = icl_instance_range, icl_specials = {ir_from = nr_of_functions, ir_to = nr_of_functions}, icl_imported_objects = mod_imported_objects, icl_used_module_numbers = imported_module_numbers, icl_copied_from_dcl = copied_dcl_defs, - icl_import = icl_imported } + icl_import = icl_imported, icl_modification_time = mod_modification_time} = (False, icl_mod, dcl_modules, {}, No, {}, cs_x.x_main_dcl_module_n,heaps, cs_predef_symbols, cs_symbol_table, cs_error.ea_file, directly_imported_dcl_modules) where check_start_rule mod_kind mod_name {ir_from, ir_to} cs=:{cs_predef_symbols,cs_symbol_table,cs_x} @@ -2204,7 +2204,7 @@ makeElemTypeOfArrayFunctionStrict st=:{st_args,st_result} me_offset offset_table st_result = { st_result & at_type = TA tuple [{ elem & at_annotation = AN_Strict } : res_array]}} = st -initialDclModule ({mod_name, mod_defs=mod_defs=:{def_funtypes,def_macros}, mod_type}, sizes, all_defs) module_n +initialDclModule ({mod_name, mod_modification_time, mod_defs=mod_defs=:{def_funtypes,def_macros}, mod_type}, sizes, all_defs) module_n # dcl_common= createCommonDefinitions mod_defs = { dcl_name = mod_name , dcl_functions = { function \\ function <- mod_defs.def_funtypes } @@ -2226,6 +2226,7 @@ initialDclModule ({mod_name, mod_defs=mod_defs=:{def_funtypes,def_macros}, mod_t _ -> False */ , dcl_module_kind = mod_type + , dcl_modification_time = mod_modification_time // ... RWS , dcl_imported_module_numbers = EndNumbers } diff --git a/frontend/checksupport.dcl b/frontend/checksupport.dcl index f1baa74..6e6688f 100644 --- a/frontend/checksupport.dcl +++ b/frontend/checksupport.dcl @@ -98,6 +98,9 @@ cConversionTableSize :== 9 // AA , icl_imported_objects :: ![ImportedObject] , icl_used_module_numbers :: !NumberSet , icl_copied_from_dcl :: !CopiedDefinitions +// RWS ... + , icl_modification_time :: !{#Char} +// ... RWS } :: DclModule = @@ -112,6 +115,7 @@ cConversionTableSize :== 9 // AA , dcl_conversions :: !Optional ConversionTable // RWS ... , dcl_is_system :: !Bool , dcl_module_kind :: !ModuleKind + , dcl_modification_time:: !{#Char} // ... RWS , dcl_imported_module_numbers :: !NumberSet } diff --git a/frontend/checksupport.icl b/frontend/checksupport.icl index 3320f1a..223da52 100644 --- a/frontend/checksupport.icl +++ b/frontend/checksupport.icl @@ -111,6 +111,9 @@ where , icl_imported_objects :: ![ImportedObject] , icl_used_module_numbers :: !NumberSet , icl_copied_from_dcl :: !CopiedDefinitions +// RWS ... + , icl_modification_time :: !{#Char} +// ... RWS } :: DclModule = @@ -125,6 +128,7 @@ where , dcl_conversions :: !Optional ConversionTable // RWS ... , dcl_is_system :: !Bool , dcl_module_kind :: !ModuleKind + , dcl_modification_time:: !{#Char} // ... RWS , dcl_imported_module_numbers :: !NumberSet } diff --git a/frontend/frontend.dcl b/frontend/frontend.dcl index 7751e3d..84fdf3b 100644 --- a/frontend/frontend.dcl +++ b/frontend/frontend.dcl @@ -31,5 +31,5 @@ import checksupport, transform, overloading | FrontEndPhaseConvertModules | FrontEndPhaseAll -frontEndInterface :: !FrontEndOptions !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable !*Files !*File !*File !*File (!Optional !*File) !*Heaps +frontEndInterface :: !FrontEndOptions !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable (ModTimeFunction *Files) !*Files !*File !*File !*File (!Optional !*File) !*Heaps -> ( !Optional *FrontEndSyntaxTree,!*{# FunDef },!{#DclModule},!Int,!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File, !*File, !*File, !Optional !*File, !*Heaps) diff --git a/frontend/frontend.icl b/frontend/frontend.icl index 1cd3a5a..24fd0a4 100644 --- a/frontend/frontend.icl +++ b/frontend/frontend.icl @@ -83,20 +83,20 @@ frontSyntaxTree cached_functions_and_macros cached_dcl_mods n_functions_and_macr // import StdDebug -frontEndInterface :: !FrontEndOptions !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable !*Files !*File !*File !*File (!Optional !*File) !*Heaps +frontEndInterface :: !FrontEndOptions !Ident !SearchPaths !{#DclModule} !{#FunDef} !(Optional Bool) !*PredefinedSymbols !*HashTable (ModTimeFunction *Files) !*Files !*File !*File !*File (!Optional !*File) !*Heaps -> ( !Optional *FrontEndSyntaxTree,!*{# FunDef },!{#DclModule},!Int,!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File, !*File, !*File, !Optional !*File, !*Heaps) -frontEndInterface options mod_ident search_paths cached_dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table files error io out tcl_file heaps +frontEndInterface options mod_ident search_paths cached_dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table modtimefunction files error io out tcl_file heaps // # files = trace_n ("Compiling "+++mod_ident.id_name) files # (ok, mod, hash_table, error, predef_symbols, files) - = wantModule cWantIclFile mod_ident NoPos options.feo_generics(hash_table /* ---> ("Parsing:", mod_ident)*/) error search_paths predef_symbols files + = wantModule cWantIclFile mod_ident NoPos options.feo_generics(hash_table /* ---> ("Parsing:", mod_ident)*/) error search_paths predef_symbols modtimefunction files | not ok = (No,{},{},0,0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps) # cached_module_idents = [dcl_mod.dcl_name \\ dcl_mod<-:cached_dcl_modules] # (nr_of_chached_functions_and_macros, functions_and_macros) = usize functions_and_macros # (ok, mod, global_fun_range, mod_functions, optional_dcl_mod, modules, dcl_module_n_in_cache,n_functions_and_macros_in_dcl_modules,hash_table, error, predef_symbols, files) - = scanModule (mod -*-> "Scanning") cached_module_idents nr_of_chached_functions_and_macros options.feo_generics hash_table error search_paths predef_symbols files + = scanModule (mod -*-> "Scanning") cached_module_idents nr_of_chached_functions_and_macros options.feo_generics hash_table error search_paths predef_symbols modtimefunction files /* JVG: */ // # hash_table = {hash_table & hte_entries={}} # hash_table = remove_icl_symbols_from_hash_table hash_table @@ -275,11 +275,11 @@ frontEndInterface options mod_ident search_paths cached_dcl_modules functions_an // # (fun_defs,out,var_heap,predef_symbols) = sa components main_dcl_module_n dcl_mods fun_defs out var_heap predef_symbols; # heaps = {hp_var_heap = var_heap, hp_expression_heap=expression_heap, hp_type_heaps=type_heaps} - #! fe ={ fe_icl = + # fe ={ fe_icl = // {icl_mod & icl_functions=fun_defs } {icl_functions=fun_defs,icl_instances=icl_instances,icl_specials=icl_specials,icl_common=icl_common,icl_import=icl_import, icl_name=icl_name,icl_imported_objects=icl_imported_objects,icl_used_module_numbers=icl_used_module_numbers, - icl_copied_from_dcl=icl_copied_from_dcl} + icl_copied_from_dcl=icl_copied_from_dcl,icl_modification_time=icl_mod.icl_modification_time} , fe_dcls = dcl_mods , fe_components = components diff --git a/frontend/main.icl b/frontend/main.icl index e1795d4..087046a 100644 --- a/frontend/main.icl +++ b/frontend/main.icl @@ -165,10 +165,14 @@ compileModule mod_name dcl_cache ms dcl_cache = {dcl_cache & hash_table=hash_table} = loadModule mod_ident.boxed_ident dcl_cache ms +dummyModTime :: {#Char} .f -> ({#Char}, .f) +dummyModTime _ f + = ("", f) + loadModule :: Ident *DclCache *MainState -> *(!Optional InterMod,!*DclCache,!*MainState); loadModule mod_ident {dcl_modules,functions_and_macros,predef_symbols,hash_table,heaps} ms=:{ms_files,ms_error,ms_io,ms_out,ms_paths} # (optional_syntax_tree,cached_functions_and_macros,cached_dcl_mods,_,main_dcl_module_n,predef_symbols, hash_table, ms_files, ms_error, ms_io, ms_out,_,heaps) - = frontEndInterface { feo_up_to_phase = FrontEndPhaseAll,feo_generics = False} mod_ident {sp_locations = [], sp_paths = ms_paths} dcl_modules functions_and_macros No predef_symbols hash_table ms_files ms_error ms_io ms_out No heaps + = frontEndInterface { feo_up_to_phase = FrontEndPhaseAll, feo_generics = False, feo_fusion = False} mod_ident {sp_locations = [], sp_paths = ms_paths} dcl_modules functions_and_macros No predef_symbols hash_table dummyModTime ms_files ms_error ms_io ms_out No heaps # ms = {ms & ms_files=ms_files, ms_error=ms_error,ms_io=ms_io,ms_out=ms_out} = case optional_syntax_tree of Yes {fe_icl={/*icl_functions,*/icl_used_module_numbers}, fe_dcls, fe_dclIclConversions, fe_iclDclConversions} diff --git a/frontend/parse.dcl b/frontend/parse.dcl index 6f0659f..ac78a2f 100644 --- a/frontend/parse.dcl +++ b/frontend/parse.dcl @@ -10,5 +10,5 @@ import syntax, hashtable, scanner, predef cWantIclFile :== True cWantDclFile :== False -wantModule :: !Bool !Ident !Position !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols !*Files +wantModule :: !Bool !Ident !Position !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols (ModTimeFunction *Files) !*Files -> (!Bool, !ParsedModule, !*HashTable, !*File, !*PredefinedSymbols, !*Files) diff --git a/frontend/parse.icl b/frontend/parse.icl index 2955d9c..17cee43 100644 --- a/frontend/parse.icl +++ b/frontend/parse.icl @@ -289,23 +289,23 @@ isClassOrInstanceDefsContext context :== context bitand cClassOrInstanceDefsCont cWantIclFile :== True cWantDclFile :== False -wantModule :: !Bool !Ident !Position !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols !*Files +wantModule :: !Bool !Ident !Position !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols (ModTimeFunction *Files) !*Files -> (!Bool, !ParsedModule, !*HashTable, !*File, !*PredefinedSymbols, !*Files) -wantModule iclmodule file_id=:{id_name} import_file_position support_generics hash_table error searchPaths pre_def_symbols files - = case openScanner file_name searchPaths files of - (Yes scanState, files) +wantModule iclmodule file_id=:{id_name} import_file_position support_generics hash_table error searchPaths pre_def_symbols modtimefunction files + = case openScanner file_name searchPaths modtimefunction files of + (Yes (scanState, modification_time), files) # hash_table=set_hte_mark (if iclmodule 1 0) hash_table - # (ok,mod,hash_table,file,pre_def_symbols,files) = initModule file_name scanState hash_table error pre_def_symbols files + # (ok,mod,hash_table,file,pre_def_symbols,files) = initModule file_name modification_time scanState hash_table error pre_def_symbols files # hash_table=set_hte_mark 0 hash_table ->(ok,mod,hash_table,file,pre_def_symbols,files) (No, files) - -> let mod = { mod_name = file_id, mod_type = MK_None, mod_imports = [], mod_imported_objects = [], mod_defs = [] } in + -> let mod = { mod_name = file_id, mod_modification_time = "", mod_type = MK_None, mod_imports = [], mod_imported_objects = [], mod_defs = [] } in (False, mod, hash_table, error <<< "Error " <<< import_file_position <<< ": " <<< file_name <<< " could not be imported\n", pre_def_symbols, files) where file_name = if iclmodule (id_name +++ ".icl") (id_name +++ ".dcl") - initModule :: String ScanState !*HashTable !*File !*PredefinedSymbols *Files + initModule :: String String ScanState !*HashTable !*File !*PredefinedSymbols *Files -> (!Bool, !ParsedModule, !*HashTable, !*File, !*PredefinedSymbols, !*Files) - initModule file_name scanState hash_table error pre_def_symbols files + initModule file_name modification_time scanState hash_table error pre_def_symbols files # (succ, mod_type, mod_name, scanState) = try_module_header iclmodule scanState | succ # pState = { ps_scanState = scanState @@ -327,7 +327,7 @@ where defs = if (ParseOnly && id_name <> "StdOverloaded" && id_name <> "StdArray" && id_name <> "StdEnum" && id_name <> "StdBool" && id_name <> "StdDynamics" && id_name <> "StdGeneric") [PD_Import imports \\ PD_Import imports <- defs] defs - mod = { mod_name = mod_ident, mod_type = mod_type, mod_imports = [], mod_imported_objects = [], mod_defs = defs } + mod = { mod_name = mod_ident, mod_modification_time = modification_time, mod_type = mod_type, mod_imports = [], mod_imported_objects = [], mod_defs = defs } = ( ps_error.pea_ok , mod, ps_hash_table , ps_error.pea_file @@ -336,7 +336,7 @@ where ) // otherwise // ~ succ # ({fp_line}, scanState) = getPosition scanState - mod = { mod_name = file_id, mod_type = mod_type, mod_imports = [], mod_imported_objects = [], mod_defs = [] } + mod = { mod_name = file_id, mod_modification_time = modification_time, mod_type = mod_type, mod_imports = [], mod_imported_objects = [], mod_defs = [] } = (False, mod, hash_table, error <<< "Error [" <<< file_name <<< ',' <<< fp_line <<< "]: incorrect module header", pre_def_symbols, closeScanner scanState files) where diff --git a/frontend/postparse.dcl b/frontend/postparse.dcl index e0fa317..95d9b21 100644 --- a/frontend/postparse.dcl +++ b/frontend/postparse.dcl @@ -4,5 +4,5 @@ import StdEnv import syntax, parse, predef -scanModule :: !ParsedModule ![Ident] !Int !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols !*Files +scanModule :: !ParsedModule ![Ident] !Int !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols (ModTimeFunction *Files) !*Files -> (!Bool, !ScannedModule, !IndexRange, ![FunDef], !Optional ScannedModule, ![ScannedModule],!Int,!Int,!*HashTable, !*File, !*PredefinedSymbols, !*Files) diff --git a/frontend/postparse.icl b/frontend/postparse.icl index 112b02b..b6f7f64 100644 --- a/frontend/postparse.icl +++ b/frontend/postparse.icl @@ -1002,25 +1002,25 @@ transformArrayDenot exprs pi [{bind_dst=toParsedExpr i pi, bind_src=expr} \\ expr <- exprs & i <- [0..]] pi -scanModules :: [ParsedImport] [ScannedModule] [Ident] SearchPaths Bool *Files *CollectAdmin -> (Bool, [ScannedModule], *Files, *CollectAdmin) -scanModules [] parsed_modules cached_modules searchPaths support_generics files ca +scanModules :: [ParsedImport] [ScannedModule] [Ident] SearchPaths Bool (ModTimeFunction *Files) *Files *CollectAdmin -> (Bool, [ScannedModule], *Files, *CollectAdmin) +scanModules [] parsed_modules cached_modules searchPaths support_generics _ files ca = (True, parsed_modules, files, ca) -scanModules [{import_module,import_symbols,import_file_position} : mods] parsed_modules cached_modules searchPaths support_generics files ca +scanModules [{import_module,import_symbols,import_file_position} : mods] parsed_modules cached_modules searchPaths support_generics modtimefunction files ca | in_cache import_module cached_modules - = scanModules mods parsed_modules cached_modules searchPaths support_generics files ca + = scanModules mods parsed_modules cached_modules searchPaths support_generics modtimefunction files ca # (found_module,mod_type) = try_to_find import_module parsed_modules | found_module = case mod_type of MK_NoMainDcl # ca = postParseError import_file_position ("main module \'"+++import_module.id_name+++"\' does not have a definition module") ca - # (_,parsed_modules,files,ca) = scanModules mods parsed_modules cached_modules searchPaths support_generics files ca + # (_,parsed_modules,files,ca) = scanModules mods parsed_modules cached_modules searchPaths support_generics modtimefunction files ca -> (False,parsed_modules,files,ca) _ - -> scanModules mods parsed_modules cached_modules searchPaths support_generics files ca + -> scanModules mods parsed_modules cached_modules searchPaths support_generics modtimefunction files ca # (succ, parsed_modules, files, ca) - = parseAndScanDclModule import_module import_file_position parsed_modules cached_modules searchPaths support_generics files ca + = parseAndScanDclModule import_module import_file_position parsed_modules cached_modules searchPaths support_generics modtimefunction files ca (mods_succ, parsed_modules, files, ca) - = scanModules mods parsed_modules cached_modules searchPaths support_generics files ca + = scanModules mods parsed_modules cached_modules searchPaths support_generics modtimefunction files ca = (succ && mods_succ, parsed_modules, files, ca) where in_cache mod_id [] @@ -1039,26 +1039,26 @@ where = try_to_find mod_id pmods MakeEmptyModule name mod_type - :== { mod_name = name, mod_type = mod_type, mod_imports = [], mod_imported_objects = [], mod_defs = + :== { mod_name = name, mod_modification_time = "", mod_type = mod_type, mod_imports = [], mod_imported_objects = [], mod_defs = { def_types = [], def_constructors = [], def_selectors = [], def_classes = [], def_macros = { ir_from = 0, ir_to = 0 }, def_members = [], def_funtypes = [], def_instances = [], /* AA */ def_generics = [] } } -parseAndScanDclModule :: !Ident !Position ![ScannedModule] ![Ident] !SearchPaths !Bool !*Files !*CollectAdmin +parseAndScanDclModule :: !Ident !Position ![ScannedModule] ![Ident] !SearchPaths !Bool (ModTimeFunction *Files) !*Files !*CollectAdmin -> *(!Bool, ![ScannedModule], !*Files, !*CollectAdmin) -parseAndScanDclModule dcl_module import_file_position parsed_modules cached_modules searchPaths support_generics files ca +parseAndScanDclModule dcl_module import_file_position parsed_modules cached_modules searchPaths support_generics modtimefunction files ca # {ca_error, ca_fun_count, ca_rev_fun_defs, ca_predefs, ca_u_predefs, ca_hash_table} = ca hash_table = ca_hash_table pea_file = ca_error.pea_file predefs = ca_u_predefs - # (parse_ok, mod, hash_table, err_file, predefs, files) = wantModule cWantDclFile dcl_module import_file_position support_generics hash_table pea_file searchPaths predefs files + # (parse_ok, mod, hash_table, err_file, predefs, files) = wantModule cWantDclFile dcl_module import_file_position support_generics hash_table pea_file searchPaths predefs modtimefunction files # ca = {ca_hash_table=hash_table, ca_error={pea_file=err_file,pea_ok=True}, ca_u_predefs=predefs, ca_fun_count=ca_fun_count, ca_rev_fun_defs=ca_rev_fun_defs, ca_predefs=ca_predefs} | parse_ok - = scan_dcl_module mod parsed_modules searchPaths files ca + = scan_dcl_module mod parsed_modules searchPaths modtimefunction files ca = (False, [MakeEmptyModule mod.mod_name MK_None: parsed_modules], files, ca) where - scan_dcl_module :: ParsedModule [ScannedModule] !SearchPaths *Files *CollectAdmin -> (Bool, [ScannedModule], *Files, *CollectAdmin) - scan_dcl_module mod=:{mod_defs = pdefs} parsed_modules searchPaths files ca + scan_dcl_module :: ParsedModule [ScannedModule] !SearchPaths (ModTimeFunction *Files) *Files *CollectAdmin -> (Bool, [ScannedModule], *Files, *CollectAdmin) + scan_dcl_module mod=:{mod_defs = pdefs} parsed_modules searchPaths modtimefunction files ca # (_, defs, imports, imported_objects, ca) = reorganiseDefinitions False pdefs 0 0 0 0 ca (macro_defs, ca) @@ -1070,12 +1070,12 @@ where mod = { mod & mod_imports = imports, mod_imported_objects = imported_objects, mod_defs = { defs & def_macros = range }} (import_ok, parsed_modules, files, ca) - = scanModules imports [mod : parsed_modules] cached_modules searchPaths support_generics files ca + = scanModules imports [mod : parsed_modules] cached_modules searchPaths support_generics modtimefunction files ca = (pea_ok && import_ok, parsed_modules, files, ca) -scanModule :: !ParsedModule ![Ident] !Int !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols !*Files +scanModule :: !ParsedModule ![Ident] !Int !Bool !*HashTable !*File !SearchPaths !*PredefinedSymbols (ModTimeFunction *Files) !*Files -> (!Bool, !ScannedModule, !IndexRange, ![FunDef], !Optional ScannedModule, ![ScannedModule],!Int,!Int,!*HashTable, !*File, !*PredefinedSymbols, !*Files) -scanModule mod=:{mod_name,mod_type,mod_defs = pdefs} cached_modules first_new_function_or_macro_index support_generics hash_table err_file searchPaths predefs files +scanModule mod=:{mod_name,mod_type,mod_defs = pdefs} cached_modules first_new_function_or_macro_index support_generics hash_table err_file searchPaths predefs modtimefunction files # (predefIdents, predefs) = SelectPredefinedIdents predefs # ca = { ca_error = {pea_file = err_file, pea_ok = True} , ca_fun_count = first_new_function_or_macro_index @@ -1088,9 +1088,9 @@ scanModule mod=:{mod_name,mod_type,mod_defs = pdefs} cached_modules first_new_fu (reorganise_icl_ok, ca) = ca!ca_error.pea_ok (import_dcl_ok, optional_parsed_dcl_mod,dcl_module_n,parsed_modules, cached_modules,files, ca) - = scan_main_dcl_module mod_name mod_type files ca + = scan_main_dcl_module mod_name mod_type modtimefunction files ca (import_dcls_ok, parsed_modules, files, ca) - = scanModules imports parsed_modules cached_modules searchPaths support_generics files ca + = scanModules imports parsed_modules cached_modules searchPaths support_generics modtimefunction files ca (pea_dcl_ok,optional_dcl_mod,ca) = collect_main_dcl_module optional_parsed_dcl_mod dcl_module_n ca @@ -1122,12 +1122,12 @@ scanModule mod=:{mod_name,mod_type,mod_defs = pdefs} cached_modules first_new_fu // (pre_def_mod, ca_u_predefs) = buildPredefinedModule ca_u_predefs = (reorganise_icl_ok && pea_ok && import_dcl_ok && import_dcls_ok, mod, fun_range, reverse ca_rev_fun_defs, optional_dcl_mod, /*pre_def_mod,*/ modules, dcl_module_n,n_functions_and_macros_in_dcl_modules,hash_table, err_file, ca_u_predefs, files) where - scan_main_dcl_module :: Ident ModuleKind *Files *CollectAdmin -> (!Bool,!Optional (Module (CollectedDefinitions (ParsedInstance FunDef) [FunDef])),!Int,![ScannedModule],![Ident],!*Files,!*CollectAdmin) - scan_main_dcl_module mod_name MK_Main files ca + scan_main_dcl_module :: Ident ModuleKind (ModTimeFunction *Files) *Files *CollectAdmin -> (!Bool,!Optional (Module (CollectedDefinitions (ParsedInstance FunDef) [FunDef])),!Int,![ScannedModule],![Ident],!*Files,!*CollectAdmin) + scan_main_dcl_module mod_name MK_Main _ files ca = (True, No,NoIndex,[MakeEmptyModule mod_name MK_NoMainDcl], cached_modules,files, ca) - scan_main_dcl_module mod_name MK_None files ca + scan_main_dcl_module mod_name MK_None _ files ca = (True, No,NoIndex,[], cached_modules,files, ca) - scan_main_dcl_module mod_name kind files ca + scan_main_dcl_module mod_name kind modtimefunction files ca # module_n_in_cache = in_cache 0 cached_modules; with in_cache module_n [] @@ -1142,7 +1142,7 @@ where hash_table = ca_hash_table pea_file = ca_error.pea_file predefs = ca_u_predefs - # (parse_ok, mod, hash_table, err_file, predefs, files) = wantModule cWantDclFile mod_name NoPos support_generics hash_table pea_file searchPaths predefs files + # (parse_ok, mod, hash_table, err_file, predefs, files) = wantModule cWantDclFile mod_name NoPos support_generics hash_table pea_file searchPaths predefs modtimefunction files # ca = {ca_hash_table=hash_table, ca_error={pea_file=err_file,pea_ok=True}, ca_u_predefs=predefs, ca_fun_count=ca_fun_count, ca_rev_fun_defs=ca_rev_fun_defs, ca_predefs=ca_predefs} | not parse_ok = (False, No,NoIndex, [],cached_modules, files, ca) @@ -1150,7 +1150,7 @@ where # (_, defs, imports, imported_objects, ca) = reorganiseDefinitions False pdefs 0 0 0 0 ca # mod = { mod & mod_imports = imports, mod_imported_objects = imported_objects, mod_defs = defs} # cached_modules = [mod.mod_name:cached_modules] - # (import_ok, parsed_modules, files, ca) = scanModules imports [] cached_modules searchPaths support_generics files ca + # (import_ok, parsed_modules, files, ca) = scanModules imports [] cached_modules searchPaths support_generics modtimefunction files ca = (import_ok, Yes mod, NoIndex,parsed_modules, cached_modules,files, ca) collect_main_dcl_module (Yes mod=:{mod_defs=defs}) dcl_module_n ca diff --git a/frontend/predef.icl b/frontend/predef.icl index 43d33ac..bc13c2b 100644 --- a/frontend/predef.icl +++ b/frontend/predef.icl @@ -440,7 +440,7 @@ buildPredefinedModule pre_def_symbols (type_defs, cons_defs, pre_def_symbols) = add_tuple_defs pre_mod_id MaxTupleArity [array_def,strict_def,unboxed_def] [] pre_def_symbols alias_dummy_type = make_identity_fun_type alias_dummy_symb.pds_ident type_var // MW++ (class_def, member_def, pre_def_symbols) = make_TC_class_def pre_def_symbols - = ({ mod_name = pre_mod_id, mod_type = MK_System, mod_imports = [], mod_imported_objects = [], + = ({ mod_name = pre_mod_id, mod_modification_time = "", mod_type = MK_System, mod_imports = [], mod_imported_objects = [], mod_defs = { def_types = [string_def, list_def,strict_list_def,unboxed_list_def,tail_strict_list_def,strict_tail_strict_list_def,unboxed_tail_strict_list_def,overloaded_list_def : type_defs], def_constructors = [cons_def,strict_cons_def,unboxed_cons_def,tail_strict_cons_def,strict_tail_strict_cons_def,unboxed_tail_strict_cons_def,overloaded_cons_def, diff --git a/frontend/scanner.dcl b/frontend/scanner.dcl index dd25d2c..b20e43f 100644 --- a/frontend/scanner.dcl +++ b/frontend/scanner.dcl @@ -3,10 +3,15 @@ definition module scanner import StdEnv, general // RWS Proof ... :: SearchPaths :== [String] + :: SearchPaths = { sp_locations :: [(String, String)] // (module, path) , sp_paths :: [String] } + +:: ModTimeFunction f + :== ({#Char} !f -> *(!{#Char}, !f)) + // ... RWS :: * ScanState @@ -139,7 +144,7 @@ instance replaceToken ScanState class getPosition state :: !*state -> (!FilePosition,!*state) // Position of current Token (or Char) instance getPosition ScanState -openScanner :: !String !SearchPaths !*Files -> (!Optional ScanState, !*Files) +openScanner :: !String !SearchPaths (ModTimeFunction *Files) !*Files -> (!Optional (ScanState, {#Char}), !*Files) // state, file time closeScanner :: !ScanState !*Files -> *Files setUseLayout :: !Bool !ScanState -> ScanState diff --git a/frontend/scanner.icl b/frontend/scanner.icl index 911a127..7a5a204 100644 --- a/frontend/scanner.icl +++ b/frontend/scanner.icl @@ -9,6 +9,10 @@ from utilities import revCharListToString, isSpecialChar { sp_locations :: [(String, String)] // (module, path) , sp_paths :: [String] } + +:: ModTimeFunction f + :== ({#Char} !f -> *(!{#Char}, !f)) + // ... RWS :: *ScanState = ScanState !RScanState @@ -1467,12 +1471,12 @@ where toString NoAssoc = "infix " -openScanner :: !String !SearchPaths !*Files -> (!Optional ScanState, !*Files) -openScanner file_name searchPaths files - = case fopenInSearchPaths file_name searchPaths FReadData files of +openScanner :: !String !SearchPaths (ModTimeFunction *Files) !*Files -> (!Optional (ScanState, {#Char}), !*Files) // state, file time +openScanner file_name searchPaths modtimefunction files + = case fopenInSearchPaths file_name searchPaths FReadData modtimefunction files of (No, files) -> (No, files) - (Yes file, files) + (Yes (file, time), files) -> (Yes (ScanState { ss_input = Input { inp_stream = InFile file , inp_filename = file_name @@ -1482,48 +1486,41 @@ openScanner file_name searchPaths files , ss_offsides = [(1,False)] // to generate offsides between global definitions , ss_scanOptions = 0 , ss_tokenBuffer = Buffer0 - }) + }, time) , files ) -/* RWS Proof ... -fopenInSearchPaths :: !{#Char} [!{#Char}] !Int !*f -> (Optional *File,!*f) | FileSystem f -fopenInSearchPaths fileName [] mode f - = (No, f) -fopenInSearchPaths fileName [path : paths] mode f - # (opened, file, f) - = fopen (path + fileName) mode f - | opened - = (Yes file, f) - // otherwise - = fopenInSearchPaths fileName paths mode f -*/ -fopenInSearchPaths :: !{#Char} SearchPaths !Int !*f -> (Optional *File,!*f) | FileSystem f -fopenInSearchPaths fileName searchPaths mode f +fopenInSearchPaths :: !{#Char} SearchPaths !Int (ModTimeFunction *f) !*f -> (Optional (*File, {#Char}),!*f) | FileSystem f +fopenInSearchPaths fileName searchPaths mode modtimefunction f # filtered_locations = filter (\(moduleName,path) -> moduleName == fileName) searchPaths.sp_locations | isEmpty filtered_locations - = fopenAnywhereInSearchPaths fileName searchPaths.sp_paths mode f + = fopenAnywhereInSearchPaths fileName searchPaths.sp_paths mode modtimefunction f # (_, path) = hd filtered_locations # (opened, file, f) = fopen (path + fileName) mode f | opened - = (Yes file, f) + = getModificationTime file path modtimefunction f | otherwise = (No, f) where - fopenAnywhereInSearchPaths :: !{#Char} ![{#Char}] !Int *f -> (Optional *File, !*f) | FileSystem f - fopenAnywhereInSearchPaths fileName [] mode f + fopenAnywhereInSearchPaths :: !{#Char} ![{#Char}] !Int (ModTimeFunction *f) *f -> (Optional (*File, {#Char}),!*f) | FileSystem f + fopenAnywhereInSearchPaths fileName [] _ _ f = (No, f) - fopenAnywhereInSearchPaths fileName [path : paths] mode f + fopenAnywhereInSearchPaths fileName [path : paths] mode modtimefunction f # (opened, file, f) = fopen (path + fileName) mode f | opened - = (Yes file, f) + = getModificationTime file path modtimefunction f // otherwise - = fopenAnywhereInSearchPaths fileName paths mode f -// ... RWS + = fopenAnywhereInSearchPaths fileName paths mode modtimefunction f + + getModificationTime :: *File {#Char} (ModTimeFunction *f) *f -> (Optional (*File, {#Char}),!*f) | FileSystem f + getModificationTime file path modtimefunction f + # (time, f) + = modtimefunction (path + fileName) f + = (Yes (file, time), f) closeScanner :: !ScanState !*Files -> *Files closeScanner (ScanState scan_state) files = closeScanner_ scan_state files diff --git a/frontend/syntax.dcl b/frontend/syntax.dcl index b3dc90d..f85a457 100644 --- a/frontend/syntax.dcl +++ b/frontend/syntax.dcl @@ -83,6 +83,7 @@ instance toString Ident :: Module defs = { mod_name :: !Ident + , mod_modification_time :: {#Char} , mod_type :: !ModuleKind , mod_imports :: ![ParsedImport] , mod_imported_objects :: ![ImportedObject] diff --git a/frontend/syntax.icl b/frontend/syntax.icl index 4427233..ec1de27 100644 --- a/frontend/syntax.icl +++ b/frontend/syntax.icl @@ -80,6 +80,7 @@ where toString {import_module} = toString import_module :: Module defs = { mod_name :: !Ident + , mod_modification_time :: {#Char} , mod_type :: !ModuleKind , mod_imports :: ![ParsedImport] , mod_imported_objects :: ![ImportedObject] |