Commit 172ea346 authored by John van Groningen's avatar John van Groningen
Browse files

add -tcl option to generate .tcl file

parent 651bde5f
......@@ -122,6 +122,7 @@ int ParseCommandArgs (int argc, char **argv)
OptimizeInstanceCalls=False;
#endif
Dynamics=False;
TclFile=False;
StrictDoAnnots = False;
StrictDepth = 10;/* 8; */
......@@ -185,6 +186,8 @@ int ParseCommandArgs (int argc, char **argv)
AddStrictnessToExportedFunctionTypes=True;
else if (strcmp (argv_i,"-dynamics") == 0)
Dynamics=True;
else if (strcmp (argv_i,"-tcl") == 0)
TclFile=True;
#ifdef NO_OPTIMIZE_INSTANCE_CALLS
else if (strcmp (argv_i,"-oic") == 0)
OptimizeInstanceCalls=True;
......
......@@ -84,9 +84,9 @@ static void error_in_function (char *m)
#define N_Dynamics 11
#define N_DoGenericFusion 12
#define N_DoCallGraphProfiling 13
#define N_TclFile 14
#define MINIMUM_N_OPTIONS 9
#define N_OPTIONS 14
#define N_OPTIONS 15
static void ConvertOptionsToString (char *optstring)
{
......@@ -105,15 +105,14 @@ static void ConvertOptionsToString (char *optstring)
optstring[N_DoWarning] = DoWarning ? '1' : '0';
optstring[N_System] = '0';
if (DoFusion || ObjectSizes[RealObj]!=2 || Dynamics || DoGenericFusion || DoCallGraphProfiling){
optstring[N_DoFusion] = DoFusion ? '1' : '0';
optstring[N_Do64BitArch] = ObjectSizes[RealObj]!=2 ? '1' : '0';
optstring[N_Dynamics] = Dynamics ? '1' : '0';
optstring[N_DoGenericFusion] = DoGenericFusion ? '1' : '0';
optstring[N_DoCallGraphProfiling] = DoCallGraphProfiling ? '1' : '0';
optstring[N_OPTIONS]='\0';
} else
optstring[MINIMUM_N_OPTIONS]='\0';
optstring[N_DoFusion] = DoFusion ? '1' : '0';
optstring[N_Do64BitArch] = ObjectSizes[RealObj]!=2 ? '1' : '0';
optstring[N_Dynamics] = Dynamics ? '1' : '0';
optstring[N_DoGenericFusion] = DoGenericFusion ? '1' : '0';
optstring[N_DoCallGraphProfiling] = DoCallGraphProfiling ? '1' : '0';
optstring[N_TclFile] = TclFile ? '1' : '0';
optstring[N_OPTIONS]='\0';
}
#define D_PREFIX "d"
......
......@@ -27,6 +27,7 @@ Bool DoDescriptors = False;
Bool ExportLocalLabels = False;
Bool AddStrictnessToExportedFunctionTypes = False;
Bool Dynamics = False;
Bool TclFile = False;
Bool DoProfiling=False; /* no longer used by memory profiler */
Bool DoTimeProfiling=False;
......
......@@ -23,6 +23,7 @@ extern Bool ListOptimizations;
extern Bool ExportLocalLabels;
extern Bool AddStrictnessToExportedFunctionTypes;
extern Bool Dynamics;
extern Bool TclFile;
extern Bool DoProfiling;
extern Bool DoTimeProfiling;
......
......@@ -41,5 +41,6 @@ instance == ListTypesKind
defaultFrontEndOptions :: FrontEndOptions // used by sparkle, because FrontEndOptions in trunk and itask branch differ
frontEndInterface :: !(Optional (*File,{#Char},{#Char})) !FrontEndOptions !Ident !SearchPaths !{#DclModule} !*{#*{#FunDef}} !(Optional Bool) !*PredefinedSymbols !*HashTable (ModTimeFunction *Files) !*Files !*File !*File !*File !(Optional *File) !*Heaps
-> ( !Optional *FrontEndSyntaxTree,!*{#*{#FunDef}},!{#DclModule},!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File, !*File, !*File, !Optional *File, !*Heaps)
frontEndInterface :: !(Optional (*File,{#Char},{#Char})) !FrontEndOptions !Ident !SearchPaths !{#DclModule} !*{#*{#FunDef}} !(Optional Bool) !Bool (ModTimeFunction *Files)
!*PredefinedSymbols !*HashTable !*Files !*File !*File !*File !(Optional *File) !*Heaps
-> (!Optional *FrontEndSyntaxTree,!*{#*{#FunDef}},!{#DclModule},!Int,!*PredefinedSymbols,!*HashTable,!*Files,!*File,!*File,!*File, !Optional *File, !*Heaps)
......@@ -25,14 +25,15 @@ defaultFrontEndOptions
= { feo_up_to_phase = FrontEndPhaseAll,
feo_fusion = { compile_with_fusion = False, generic_fusion = False, strip_unused = False } }
frontEndInterface :: !(Optional (*File,{#Char},{#Char})) !FrontEndOptions !Ident !SearchPaths !{#DclModule} !*{#*{#FunDef}} !(Optional Bool) !*PredefinedSymbols !*HashTable (ModTimeFunction *Files) !*Files !*File !*File !*File !(Optional *File) !*Heaps
-> (!Optional *FrontEndSyntaxTree,!*{#*{#FunDef}},!{#DclModule},!Int,!*PredefinedSymbols, !*HashTable, !*Files, !*File, !*File, !*File, !Optional *File, !*Heaps)
frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_modules cached_dcl_macros list_inferred_types predef_symbols hash_table modtimefunction files error io out tcl_file heaps
frontEndInterface :: !(Optional (*File,{#Char},{#Char})) !FrontEndOptions !Ident !SearchPaths !{#DclModule} !*{#*{#FunDef}} !(Optional Bool) !Bool (ModTimeFunction *Files)
!*PredefinedSymbols !*HashTable !*Files !*File !*File !*File !(Optional *File) !*Heaps
-> (!Optional *FrontEndSyntaxTree,!*{#*{#FunDef}},!{#DclModule},!Int,!*PredefinedSymbols,!*HashTable,!*Files,!*File,!*File,!*File, !Optional *File, !*Heaps)
frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_modules cached_dcl_macros list_inferred_types support_dynamics modtimefunction
predef_symbols hash_table files error io out tcl_file heaps
| case opt_file_dir_time of No -> True; _ -> False
# error = moduleCouldNotBeImportedError True mod_ident NoPos error
= (No,{},{},0,predef_symbols, hash_table, files, error, io, out, tcl_file, heaps)
# (Yes (mod_file,mod_dir,mod_time)) = opt_file_dir_time
#! support_dynamics = tcl_file=:Yes _
# (ok,dynamic_type_used,mod,hash_table,error,files)
= wantModule mod_file mod_time cWantIclFile mod_ident NoPos support_dynamics hash_table error files
| not ok
......
......@@ -116,11 +116,11 @@ abc_file_name_in_clean_system_files_folder mod_dir mod_name error files
, listTypes :: ListTypesOption
, fusion_options :: !FusionOptions
, compile_for_dynamics :: !Bool
, dump_core :: !Bool
, generate_tcl_file :: !Bool
}
StdErrPathName :== "_stderr_"
StdOutPathName :== "_stderr_"
StdOutPathName :== "_stdout_"
InitialCoclOptions =
{ moduleName= ""
......@@ -134,7 +134,7 @@ InitialCoclOptions =
, listTypes = {lto_showAttributes = True, lto_listTypesKind = ListTypesNone}
, fusion_options = {compile_with_fusion = False, generic_fusion = False, strip_unused = False}
, compile_for_dynamics = False
, dump_core = False
, generate_tcl_file = False
}
:: DclCache = {
......@@ -196,8 +196,6 @@ parseCommandLine [arg1=:"-fusion":args] options
parseCommandLine [arg1=:"-generic_fusion":args] options
# (args,modules,options) = parseCommandLine args {options & fusion_options.generic_fusion = True}
= ([arg1:args],modules,options)
parseCommandLine [arg1=:"-dump":args] options
= parseCommandLine args {options & dump_core = True}
parseCommandLine [arg1=:"-strip":args] options
= parseCommandLine args {options & fusion_options.strip_unused = True}
parseCommandLine ["-generics":args] options
......@@ -211,6 +209,9 @@ parseCommandLine ["-lset":args] options
= parseCommandLine args {options & listTypes.lto_listTypesKind = ListTypesStrictExports}
parseCommandLine ["-lat":args] options
= parseCommandLine args {options & listTypes.lto_listTypesKind = ListTypesAll}
parseCommandLine [arg1=:"-tcl":args] options
# (args,modules,options) = parseCommandLine args {options & generate_tcl_file = True, compile_for_dynamics = True}
= ([arg1:args],modules,options)
parseCommandLine [arg : args] options
| arg.[0] == '-'
# (args,modules,options)= parseCommandLine args options
......@@ -285,7 +286,7 @@ compileModule options backendArgs cache=:{dcl_modules,functions_and_macros,prede
# (optional_tcl_opened, tcl_file, error, files)
= case mbModPath of
Yes mod_path
| options.compile_for_dynamics
| options.generate_tcl_file
-> openTclFile mod_path options.moduleName error files
_
-> (True,No,error,files)
......@@ -304,10 +305,9 @@ compileModule options backendArgs cache=:{dcl_modules,functions_and_macros,prede
(Yes options.listTypes.lto_showAttributes)
No
# (optionalSyntaxTree,cached_functions_and_macros,cached_dcl_mods,main_dcl_module_n,predef_symbols, hash_table, files, error, io, out,tcl_file,heaps)
= frontEndInterface opt_file_dir_time
{feo_up_to_phase=FrontEndPhaseAll
,feo_fusion=options.fusion_options
} moduleIdent options.searchPaths dcl_modules functions_and_macros list_inferred_types predef_symbols hash_table fmodificationtime files error io out tcl_file heaps
= frontEndInterface opt_file_dir_time {feo_up_to_phase=FrontEndPhaseAll,feo_fusion=options.fusion_options}
moduleIdent options.searchPaths dcl_modules functions_and_macros list_inferred_types options.compile_for_dynamics fmodificationtime
predef_symbols hash_table files error io out tcl_file heaps
# unique_copy_of_predef_symbols={predef_symbol\\predef_symbol<-:predef_symbols}
# (closed, files)
......
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