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 | |
| 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
| -rw-r--r-- | backend/backend.dcl | 14 | ||||
| -rw-r--r-- | backend/backend.icl | 22 | ||||
| -rw-r--r-- | backend/backendconvert.icl | 12 | ||||
| -rw-r--r-- | backendC/CleanCompilerSources/backend.c | 6 | ||||
| -rw-r--r-- | backendC/CleanCompilerSources/backend.h | 14 | ||||
| -rw-r--r-- | backendC/CleanCompilerSources/compiledefines.h | 2 | ||||
| -rw-r--r-- | backendC/CleanCompilerSources/instructions.c | 12 | ||||
| -rw-r--r-- | backendC/CleanCompilerSources/instructions.h | 4 | ||||
| -rw-r--r-- | backendC/CleanCompilerSources/syntaxtr.t | 10 | ||||
| -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 | ||||
| -rw-r--r-- | main/compile.icl | 4 | 
25 files changed, 156 insertions, 123 deletions
diff --git a/backend/backend.dcl b/backend/backend.dcl index f151e64..0f5a100 100644 --- a/backend/backend.dcl +++ b/backend/backend.dcl @@ -251,10 +251,10 @@ BEAbcCodeBlock :: !Bool !BEStringListP !BackEnd -> (!BECodeBlockP,!BackEnd);  // BECodeBlockP BEAbcCodeBlock (int inline,BEStringListP instructions);  BEAnyCodeBlock :: !BECodeParameterP !BECodeParameterP !BEStringListP !BackEnd -> (!BECodeBlockP,!BackEnd);  // BECodeBlockP BEAnyCodeBlock (BECodeParameterP inParams,BECodeParameterP outParams,BEStringListP instructions); -BEDeclareIclModule :: !String !Int !Int !Int !Int !BackEnd -> BackEnd; -// void BEDeclareIclModule (CleanString name,int nFunctions,int nTypes,int nConstructors,int nFields); -BEDeclareDclModule :: !Int !String !Bool !Int !Int !Int !Int !BackEnd -> BackEnd; -// void BEDeclareDclModule (int moduleIndex,CleanString name,int systemModule,int nFunctions,int nTypes,int nConstructors,int nFields); +BEDeclareIclModule :: !String !String !Int !Int !Int !Int !BackEnd -> BackEnd; +// void BEDeclareIclModule (CleanString name,CleanString modificationTime,int nFunctions,int nTypes,int nConstructors,int nFields); +BEDeclareDclModule :: !Int !String !String !Bool !Int !Int !Int !Int !BackEnd -> BackEnd; +// void BEDeclareDclModule (int moduleIndex,CleanString name,CleanString modificationTime,int systemModule,int nFunctions,int nTypes,int nConstructors,int nFields);  BEDeclarePredefinedModule :: !Int !Int !BackEnd -> BackEnd;  // void BEDeclarePredefinedModule (int nTypes,int nConstructors);  BEDefineRules :: !BEImpRuleP !BackEnd -> BackEnd; @@ -279,9 +279,9 @@ BEDeclareDynamicTypeSymbol :: !Int !Int !BackEnd -> BackEnd;  // void BEDeclareDynamicTypeSymbol (int typeIndex,int moduleIndex);  BEDynamicTempTypeSymbol :: !BackEnd -> (!BESymbolP,!BackEnd);  // BESymbolP BEDynamicTempTypeSymbol (); -kBEVersionCurrent:==0x02000212; -kBEVersionOldestDefinition:==0x02000212; -kBEVersionOldestImplementation:==0x02000212; +kBEVersionCurrent:==0x02000213; +kBEVersionOldestDefinition:==0x02000213; +kBEVersionOldestImplementation:==0x02000213;  kBEDebug:==1;  kPredefinedModuleIndex:==1;  BENoAnnot:==0; diff --git a/backend/backend.icl b/backend/backend.icl index d0494c2..ef7e6ad 100644 --- a/backend/backend.icl +++ b/backend/backend.icl @@ -680,17 +680,17 @@ BEAnyCodeBlock a0 a1 a2 a3 = code {  };  // BECodeBlockP BEAnyCodeBlock (BECodeParameterP inParams,BECodeParameterP outParams,BEStringListP instructions); -BEDeclareIclModule :: !String !Int !Int !Int !Int !BackEnd -> BackEnd; -BEDeclareIclModule a0 a1 a2 a3 a4 a5 = code { -	ccall BEDeclareIclModule "SIIII:V:I" +BEDeclareIclModule :: !String !String !Int !Int !Int !Int !BackEnd -> BackEnd; +BEDeclareIclModule a0 a1 a2 a3 a4 a5 a6 = code { +	ccall BEDeclareIclModule "SSIIII:V:I"  }; -// void BEDeclareIclModule (CleanString name,int nFunctions,int nTypes,int nConstructors,int nFields); +// void BEDeclareIclModule (CleanString name,CleanString modificationTime,int nFunctions,int nTypes,int nConstructors,int nFields); -BEDeclareDclModule :: !Int !String !Bool !Int !Int !Int !Int !BackEnd -> BackEnd; -BEDeclareDclModule a0 a1 a2 a3 a4 a5 a6 a7 = code { -	ccall BEDeclareDclModule "ISIIIII:V:I" +BEDeclareDclModule :: !Int !String !String !Bool !Int !Int !Int !Int !BackEnd -> BackEnd; +BEDeclareDclModule a0 a1 a2 a3 a4 a5 a6 a7 a8 = code { +	ccall BEDeclareDclModule "ISSIIIII:V:I"  }; -// void BEDeclareDclModule (int moduleIndex,CleanString name,int systemModule,int nFunctions,int nTypes,int nConstructors,int nFields); +// void BEDeclareDclModule (int moduleIndex,CleanString name,CleanString modificationTime,int systemModule,int nFunctions,int nTypes,int nConstructors,int nFields);  BEDeclarePredefinedModule :: !Int !Int !BackEnd -> BackEnd;  BEDeclarePredefinedModule a0 a1 a2 = code { @@ -763,9 +763,9 @@ BEDynamicTempTypeSymbol a0 = code {  	ccall BEDynamicTempTypeSymbol ":I:I"  };  // BESymbolP BEDynamicTempTypeSymbol (); -kBEVersionCurrent:==0x02000212; -kBEVersionOldestDefinition:==0x02000212; -kBEVersionOldestImplementation:==0x02000212; +kBEVersionCurrent:==0x02000213; +kBEVersionOldestDefinition:==0x02000213; +kBEVersionOldestImplementation:==0x02000213;  kBEDebug:==1;  kPredefinedModuleIndex:==1;  BENoAnnot:==0; diff --git a/backend/backendconvert.icl b/backend/backendconvert.icl index 17baf60..ad5ec69 100644 --- a/backend/backendconvert.icl +++ b/backend/backendconvert.icl @@ -383,7 +383,7 @@ backEndConvertModules p s main_dcl_module_n var_heap attr_var_heap be  backEndConvertModulesH :: PredefinedSymbols FrontEndSyntaxTree !Int *BackEndState -> *BackEndState  backEndConvertModulesH predefs {fe_icl =  -	fe_icl =: {icl_name, icl_functions, icl_common,icl_imported_objects,icl_used_module_numbers}, +	fe_icl =: {icl_name, icl_modification_time, icl_functions, icl_common,icl_imported_objects,icl_used_module_numbers},  	fe_components, fe_dcls, fe_arrayInstances, fe_dclIclConversions, fe_iclDclConversions,fe_globalFunctions}  	main_dcl_module_n backEnd  	// sanity check ... @@ -448,7 +448,7 @@ backEndConvertModulesH predefs {fe_icl =  		=	defineOtherDclModules fe_dcls main_dcl_module_n icl_used_module_numbers (backEnd -*-> "defineOtherDclModules")  	#! backEnd -		=	appBackEnd (BEDeclareIclModule icl_name.id_name (size icl_functions) (size icl_common.com_type_defs) (size icl_common.com_cons_defs) (size icl_common.com_selector_defs)) (backEnd -*-> "BEDeclareIclModule") +		=	appBackEnd (BEDeclareIclModule icl_name.id_name icl_modification_time (size icl_functions) (size icl_common.com_type_defs) (size icl_common.com_cons_defs) (size icl_common.com_selector_defs)) (backEnd -*-> "BEDeclareIclModule")  	#! backEnd  		=	declareFunctionSymbols icl_functions (getConversions fe_iclDclConversions) functionIndices fe_globalFunctions (backEnd -*-> "declareFunctionSymbols")  		with @@ -522,12 +522,12 @@ isSystem _  declareCurrentDclModule :: IclModule DclModule Int -> BackEnder  declareCurrentDclModule _ {dcl_module_kind=MK_None} _  	=	identity -declareCurrentDclModule {icl_common} {dcl_name, dcl_functions, dcl_module_kind, dcl_common} main_dcl_module_n -	=	appBackEnd (BEDeclareDclModule main_dcl_module_n dcl_name.id_name (isSystem dcl_module_kind) (size dcl_functions) (size icl_common.com_type_defs) (size dcl_common.com_cons_defs) (size dcl_common.com_selector_defs)) +declareCurrentDclModule {icl_common} {dcl_name, dcl_modification_time, dcl_functions, dcl_module_kind, dcl_common} main_dcl_module_n +	=	appBackEnd (BEDeclareDclModule main_dcl_module_n dcl_name.id_name dcl_modification_time  (isSystem dcl_module_kind) (size dcl_functions) (size icl_common.com_type_defs) (size dcl_common.com_cons_defs) (size dcl_common.com_selector_defs))  declareDclModule :: ModuleIndex DclModule -> BackEnder -declareDclModule moduleIndex {dcl_name, dcl_common, dcl_functions, dcl_module_kind} -	=	appBackEnd (BEDeclareDclModule moduleIndex dcl_name.id_name (isSystem dcl_module_kind) (size dcl_functions) (size dcl_common.com_type_defs) (size dcl_common.com_cons_defs) (size dcl_common.com_selector_defs)) +declareDclModule moduleIndex {dcl_name, dcl_modification_time, dcl_common, dcl_functions, dcl_module_kind} +	=	appBackEnd (BEDeclareDclModule moduleIndex dcl_name.id_name dcl_modification_time (isSystem dcl_module_kind) (size dcl_functions) (size dcl_common.com_type_defs) (size dcl_common.com_cons_defs) (size dcl_common.com_selector_defs))  /*  defineCurrentDclModule :: IclModule DclModule {#Int} -> BackEnder  defineCurrentDclModule {icl_common} {dcl_name, dcl_common, dcl_functions, dcl_is_system, dcl_conversions} typeConversions diff --git a/backendC/CleanCompilerSources/backend.c b/backendC/CleanCompilerSources/backend.c index bb09c6f..aef2907 100644 --- a/backendC/CleanCompilerSources/backend.c +++ b/backendC/CleanCompilerSources/backend.c @@ -367,7 +367,7 @@ BESetMainDclModuleN (int main_dcl_module_n_parameter)  }  void -BEDeclareIclModule (CleanString name, int nFunctions, int nTypes, int nConstructors, int nFields) +BEDeclareIclModule (CleanString name, CleanString modificationTime, int nFunctions, int nTypes, int nConstructors, int nFields)  {  	int		i;  	char	*cName; @@ -399,6 +399,7 @@ BEDeclareIclModule (CleanString name, int nFunctions, int nTypes, int nConstruct  	iclModule	= icl->beicl_module;  	iclModule->im_name			= moduleNameSymbol; +	iclModule->im_modification_time	= ConvertCleanString (modificationTime);  	iclModule->im_def_module	= NULL;  	iclModule->im_rules			= NULL;  	iclModule->im_start			= NULL; @@ -431,7 +432,7 @@ BEDeclareIclModule (CleanString name, int nFunctions, int nTypes, int nConstruct  } /* BEDeclareIclModule */  void -BEDeclareDclModule (int moduleIndex, CleanString name, int isSystemModule, int nFunctions, int nTypes, int nConstructors, int nFields) +BEDeclareDclModule (int moduleIndex, CleanString name, CleanString modificationTime, int isSystemModule, int nFunctions, int nTypes, int nConstructors, int nFields)  {  	char	*cName;  	SymbolP	moduleNameSymbol; @@ -453,6 +454,7 @@ BEDeclareDclModule (int moduleIndex, CleanString name, int isSystemModule, int n  	dclModule	= ConvertAllocType (DefRepr);  	dclModule->dm_name			= moduleNameSymbol; +	dclModule->dm_modification_time	= ConvertCleanString (modificationTime);  	dclModule->dm_system_module	= isSystemModule;  	dclModule->dm_symbols		= gBEState.be_allSymbols; /* ??? too many symbols? */ diff --git a/backendC/CleanCompilerSources/backend.h b/backendC/CleanCompilerSources/backend.h index de0e54c..acfcf3e 100644 --- a/backendC/CleanCompilerSources/backend.h +++ b/backendC/CleanCompilerSources/backend.h @@ -1,15 +1,15 @@  /* version info */  // increment this for every release -# define	kBEVersionCurrent				0x02000212 +# define	kBEVersionCurrent				0x02000213  // change this to the same value as kBEVersionCurrent if the new release is not  // upward compatible (for example when a function is added) -# define	kBEVersionOldestDefinition		0x02000212 +# define	kBEVersionOldestDefinition		0x02000213  // change this to the same value as kBEVersionCurrent if the new release is not  // downward compatible (for example when a function is removed) -# define	kBEVersionOldestImplementation	0x02000212 +# define	kBEVersionOldestImplementation	0x02000213  # define	kBEDebug	1 @@ -491,11 +491,11 @@ Clean (BEAbcCodeBlock:: Bool BEStringListP BackEnd -> (BECodeBlockP, BackEnd))  BECodeBlockP BEAnyCodeBlock (BECodeParameterP inParams, BECodeParameterP outParams, BEStringListP instructions);  Clean (BEAnyCodeBlock:: BECodeParameterP BECodeParameterP BEStringListP BackEnd -> (BECodeBlockP, BackEnd)) -void BEDeclareIclModule (CleanString name, int nFunctions, int nTypes, int nConstructors, int nFields); -Clean (BEDeclareIclModule ::  String Int Int Int Int BackEnd -> BackEnd) +void BEDeclareIclModule (CleanString name, CleanString modificationTime, int nFunctions, int nTypes, int nConstructors, int nFields); +Clean (BEDeclareIclModule ::  String String Int Int Int Int BackEnd -> BackEnd) -void BEDeclareDclModule (int moduleIndex, CleanString name, int systemModule, int nFunctions, int nTypes, int nConstructors, int nFields); -Clean (BEDeclareDclModule :: Int String Bool Int Int Int Int BackEnd -> BackEnd) +void BEDeclareDclModule (int moduleIndex, CleanString name, CleanString modificationTime, int systemModule, int nFunctions, int nTypes, int nConstructors, int nFields); +Clean (BEDeclareDclModule :: Int String String Bool Int Int Int Int BackEnd -> BackEnd)  void BEDeclarePredefinedModule (int nTypes, int nConstructors);  Clean (BEDeclarePredefinedModule :: Int Int BackEnd -> BackEnd) diff --git a/backendC/CleanCompilerSources/compiledefines.h b/backendC/CleanCompilerSources/compiledefines.h index 3e89a85..df91918 100644 --- a/backendC/CleanCompilerSources/compiledefines.h +++ b/backendC/CleanCompilerSources/compiledefines.h @@ -1,5 +1,5 @@ -#define CLEAN2 +#define CLEAN2 1  #define SHORT_CLASS_NAMES  #define U_RECORD_SELECTORS 1 diff --git a/backendC/CleanCompilerSources/instructions.c b/backendC/CleanCompilerSources/instructions.c index dafb606..9e29575 100644 --- a/backendC/CleanCompilerSources/instructions.c +++ b/backendC/CleanCompilerSources/instructions.c @@ -3200,7 +3200,7 @@ void GenFieldSelectorDescriptor (SymbDef sdef,int has_gc_apply_entry)  void GenModuleDescriptor (  #if WRITE_DCL_MODIFICATION_TIME -						FileTime file_time +						ModuleFileTime file_time  #else  						void  #endif @@ -3213,7 +3213,11 @@ void GenModuleDescriptor (  	if (WriteModificationTimes){  		FPutC (' ',OutFile);  		FPutC ('\"',OutFile); +# if CLEAN2 +		FPutS (file_time,OutFile); +# else  		FWriteFileTime (file_time,OutFile); +# endif  		FPutC ('\"',OutFile);  	}  #endif @@ -3221,7 +3225,7 @@ void GenModuleDescriptor (  void GenDepend (char *modname  #if WRITE_DCL_MODIFICATION_TIME -				,FileTime file_time +				,ModuleFileTime file_time  #endif  				)  { @@ -3235,7 +3239,11 @@ void GenDepend (char *modname  	if (WriteModificationTimes){  		FPutC (' ',OutFile);  		FPutC ('\"',OutFile); +# if CLEAN2 +		FPutS (file_time,OutFile); +# else  		FWriteFileTime (file_time,OutFile); +# endif  		FPutC ('\"',OutFile);  	}  #endif diff --git a/backendC/CleanCompilerSources/instructions.h b/backendC/CleanCompilerSources/instructions.h index c140d80..532aee7 100644 --- a/backendC/CleanCompilerSources/instructions.h +++ b/backendC/CleanCompilerSources/instructions.h @@ -173,8 +173,8 @@ void GenStrictConstructorDescriptor (SymbDef sdef,StateP constructor_arg_state_p  void GenArrayFunctionDescriptor (SymbDef arr_fun_def, Label desclab, int arity);  #if defined(WRITE_DCL_MODIFICATION_TIME) && WRITE_DCL_MODIFICATION_TIME -void GenModuleDescriptor (FileTime file_time); -void GenDepend (char *modname,FileTime file_time); +void GenModuleDescriptor (ModuleFileTime file_time); +void GenDepend (char *modname,ModuleFileTime file_time);  #else  void GenModuleDescriptor (void);  void GenDepend (char *modname); diff --git a/backendC/CleanCompilerSources/syntaxtr.t b/backendC/CleanCompilerSources/syntaxtr.t index 3b58edb..7ce4b8d 100644 --- a/backendC/CleanCompilerSources/syntaxtr.t +++ b/backendC/CleanCompilerSources/syntaxtr.t @@ -935,6 +935,12 @@ struct string_list {  };  #endif +#if CLEAN2 +typedef char * ModuleFileTime; +#else +typedef FileTime ModuleFileTime; +#endif +  typedef struct {  	Symbol				im_name;  	Symbol				im_symbols; @@ -957,7 +963,7 @@ typedef struct {  	struct string_list *	im_imported_libs;  #endif  #if WRITE_DCL_MODIFICATION_TIME -	FileTime			im_modification_time; +	ModuleFileTime		im_modification_time;  #endif  } *ImpMod, ImpRepr; @@ -979,6 +985,6 @@ struct def_repr {  	struct module_info *	dm_module_info;  #endif  #if WRITE_DCL_MODIFICATION_TIME -	FileTime	dm_modification_time; +	ModuleFileTime	dm_modification_time;  #endif  }; 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] diff --git a/main/compile.icl b/main/compile.icl index 8ec7977..e637c8a 100644 --- a/main/compile.icl +++ b/main/compile.icl @@ -3,7 +3,7 @@ implementation module compile  import StdEnv  import frontend  import backendinterface -import CoclSystemDependent +import filesystem, CoclSystemDependent  import portToNewSyntax  //import RWSDebug @@ -195,7 +195,7 @@ compileModule options commandLineArgs {dcl_modules,functions_and_macros,predef_s  	# ({boxed_ident=moduleIdent}, hash_table) = putIdentInHashTable options.moduleName IC_Module hash_table  	# list_inferred_types = if (isMember "-lt" commandLineArgs) (Yes (not (isMember "-lattr" commandLineArgs))) No  	# (optionalSyntaxTree,cached_functions_and_macros,cached_dcl_mods,n_functions_and_macros_in_dcl_modules,main_dcl_module_n,predef_symbols, hash_table, files, error, io, out,tcl_file,heaps) -		=	frontEndInterface {feo_up_to_phase=FrontEndPhaseAll,feo_generics=False,feo_fusion=options.compile_with_fusion} moduleIdent options.searchPaths dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table files error io out tcl_file heaps  +		=	frontEndInterface {feo_up_to_phase=FrontEndPhaseAll,feo_generics=False,feo_fusion=options.compile_with_fusion} moduleIdent options.searchPaths dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table fmodificationtime files error io out tcl_file heaps   	# unique_copy_of_predef_symbols={predef_symbol\\predef_symbol<-:predef_symbols}  	# (closed, files)  		= closeTclFile tcl_file files  | 
