PmFiles.icl 21 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
3
4
implementation module PmFiles

//	File I/O routines for the project.

5
6
import StdArray, StdFunc, StdInt, StdChar, StdBool, StdStrictLists, StdOverloadedList
import UtilNewlinesFile, UtilOptions
Diederik van Arkel's avatar
Diederik van Arkel committed
7
8
import PmProject
import UtilDate
9
from PmPath import convert_path_separators,convert_exec_path_separators_and_extension
Diederik van Arkel's avatar
Diederik van Arkel committed
10

11
ProjectFileVersion :== "1.5"
Diederik van Arkel's avatar
Diederik van Arkel committed
12
13

:: ProjectGlobalOptions =
14
	{ pg_codegen			:: CodeGenOptions
Diederik van Arkel's avatar
Diederik van Arkel committed
15
16
17
18
19
20
21
22
	, pg_application		:: ApplicationOptions
	, pg_link				:: LinkOptions
	, pg_projectPaths		:: List Pathname
	, pg_otherModules		:: List ModInfoAndName
	, pg_mainModuleInfo		:: ModInfoAndName
	, pg_staticLibInfo		:: StaticLibInfo
	, pg_target				:: String
	, pg_execpath			:: String
23
	, pg_bytecode_path		:: String
Diederik van Arkel's avatar
Diederik van Arkel committed
24
	, pg_dynamic			:: !ProjectDynamicInfo
25
	, pg_root_directory		:: !String
Diederik van Arkel's avatar
Diederik van Arkel committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	, pg_precompile			:: !Maybe String
	, pg_postlink			:: !Maybe String
	}

:: ProjectDynamicInfo =
	{ dyn_syms				:: !List UndefSymbol
	, dyn_mods				:: !List UndefModule
	, dyn_objs				:: !List Pathname
	, dyn_slibs				:: !List Pathname
	, dyn_dlibs				:: !List Pathname
	, dyn_paths				:: !List Pathname
	}

EmptyDynamicInfo :: ProjectDynamicInfo
EmptyDynamicInfo =
41
42
43
44
45
46
	{ dyn_syms	= [!!]
	, dyn_mods	= [!!]
	, dyn_objs	= [!!]
	, dyn_slibs	= [!!]
	, dyn_dlibs	= [!!]
	, dyn_paths	= [!!]
Diederik van Arkel's avatar
Diederik van Arkel committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
	}

:: UndefSymbol =
	{ symbol_name	:: !String
	, path			:: !String
	}
 
:: UndefModule =
	{ module_name	:: !String
	, path			:: !String
	}

EmptyUndefSymbol	:: UndefSymbol
EmptyUndefSymbol =
	{ symbol_name	= ""
	, path			= ""
	}
 
EmptyUndefModule	:: UndefModule
EmptyUndefModule =
	{ module_name	= ""
	, path			= ""
	}

71
project_root_option = SimpleOption	"ProjectRoot"							(\a->a.pg_root_directory)   (\v a->{a & pg_root_directory = v})
72
73
74
75
76
77
78
79
80
target_option		= SimpleOption	"Target"								(\a->a.pg_target)			(\v a->{a & pg_target=v})
code_gen_option		= GroupedOption	"CodeGen"		CodeGenOptionsTable		(\a->a.pg_codegen)			(\v a->{a & pg_codegen=v})
application_option	= GroupedOption	"Application"	ApplicationOptionsTable	(\a->a.pg_application)		(\v a->{a & pg_application=v})
link_option			= GroupedOption	"Link"			LinkOptionsTable		(\a->a.pg_link)				(\v a->{a & pg_link=v})
paths_option		= ListOption	"Paths"			PathName ""				(\a->a.pg_projectPaths)		(\v a->{a & pg_projectPaths=v})
static_option		= GroupedOption	"Static"		StaticLibsInfoTable		(\a->a.pg_staticLibInfo)	(\v a->{a & pg_staticLibInfo=v})
precompile_option	= SimpleOption	"Precompile"							(\a->unwrap a.pg_precompile)(\v a->{a & pg_precompile = wrap v})
postlink_option		= SimpleOption	"Postlink"								(\a->unwrap a.pg_postlink)	(\v a->{a & pg_postlink = wrap v})

81
82
83
84
85
86
87
88
89
90
91
92
93
94
module_paths_not_in_project :: [!Pathname!] [!ModInfoAndName!]-> [!Pathname!]
module_paths_not_in_project project_paths [!!]
	= [!!]
module_paths_not_in_project project_paths [!{info={dir}}:modules!]
	# module_dirs = [!dir:get_module_dirs dir modules!];
	= RemoveMembers module_dirs project_paths;
where
	get_module_dirs previous_dir [!{info={dir}}:modules!]
		| dir==previous_dir
			= get_module_dirs previous_dir modules;
			= [!dir:get_module_dirs dir modules!];
	get_module_dirs _ [!!]
		= [!!]

95
96
97
98
99
100
// Making Precompile & Postlink 'List' options is probably prettier...
unwrap Nothing = ""
unwrap (Just s) = s
	
wrap "" = Nothing
wrap s = Just s
Diederik van Arkel's avatar
Diederik van Arkel committed
101
102
103

ProjectGlobalOptionsTable :: OptionsTable ProjectGlobalOptions
ProjectGlobalOptionsTable =
104
	{	project_root_option
105
	,	target_option
106
	,	SimpleWithStringConversionOption convert_exec_path_separators_and_extension "Exec" (\a->a.pg_execpath) (\v a->{a & pg_execpath=v})
107
	,	SimpleWithStringConversionOption convert_path_separators "ByteCode" (\a->a.pg_bytecode_path) (\v a->{a & pg_bytecode_path=v})
108
109
110
111
112
113
114
	,	code_gen_option
	,	application_option
	,	link_option
	,	paths_option
	,	static_option
	,	precompile_option
	,	postlink_option
Diederik van Arkel's avatar
Diederik van Arkel committed
115
116
	}

117
118
119
120
121
122
123
124
125
126
127
128
129
project_template_global_options_table :: OptionsTable ProjectGlobalOptions
project_template_global_options_table =
	{	project_root_option
	,	target_option
	,	code_gen_option
	,	application_option
	,	link_option
	,	paths_option
	,	static_option
	,	precompile_option
	,	postlink_option
	}

Diederik van Arkel's avatar
Diederik van Arkel committed
130
131
132
133
134
135
136
instance fromString Bool
where
	fromString "False"
		=	False
	fromString _ 
		=	True

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
ProjectDirSeparator:=='*'

convert_path_to_project_file_path :: !{#Char} -> {#Char}
convert_path_to_project_file_path path
	= get_separator_and_convert_path path
where
	get_separator_and_convert_path path
		# prefix="{Project}"
		# prefix_size=size prefix
		# i=first_not_equal_character_index prefix path
		| i==prefix_size && size path>prefix_size
			= replace_prefix path.[prefix_size] path
		# prefix="{Application}"
		# prefix_size=size prefix
		# i=first_not_equal_character_index prefix path
		| i==prefix_size && size path>prefix_size
			= replace_prefix path.[prefix_size] path
		= path
	where
		replace_prefix separator path
			| separator==ProjectDirSeparator
				= path
				= replace_character_by_ProjectDirSeparator_in_string separator path
	
		replace_character_by_ProjectDirSeparator_in_string :: !Char !{#Char} -> {#Char}
		replace_character_by_ProjectDirSeparator_in_string old_c string
			= {if (c==old_c) ProjectDirSeparator c \\ c<-:string}
	
		first_not_equal_character_index s1 s2
			#! max_index=if (size s1<=size s2) (size s1) (size s2)
			= first_not_equal_character_index 0 max_index s1 s2
			where
				first_not_equal_character_index :: !Int !Int !{#Char} !{#Char} -> Int
				first_not_equal_character_index i n s1 s2
					| i<n && s1.[i]==s2.[i]
						= first_not_equal_character_index (i+1) n s1 s2
						= i

175
name_option = SimpleOption	"Name" (\a->a.name) (\v a->{a & name=v})
176
dir_option = SimpleWithStringConversionsOption convert_path_separators convert_path_to_project_file_path "Dir" (\a->a.info.dir) (\v a->{a & info.dir=v})
177
178
179
180
181
182
183
184
185
186
compiler_option = GroupedOption	"Compiler" CompilerOptionsTable	(\a->a.info.compilerOptions)(\v a->{a & info.compilerOptions=v})
needed_obj_files_option = ListOption "NeededObjFiles" ObjectFile "" (\a->a.info.abcLinkInfo.linkObjFileNames)
																  	(\v a->{a & info.abcLinkInfo.linkObjFileNames=v})
needed_libraries_option = ListOption "NeededLibraries" Library "" (\a->a.info.abcLinkInfo.linkLibraryNames)
																  (\v a->{a & info.abcLinkInfo.linkLibraryNames=v}) 

dcl_option = GroupedOption "Dcl" EditWdOptionsTable (\a->a.info.mod_edit_options.defeo) (\v a->{a & info.mod_edit_options.defeo=v})
dcl_open_option = SimpleOption "DclOpen" (\a->a.info.mod_edit_options.defopen) (\v a->{a & info.mod_edit_options.defopen=v})
icl_option = GroupedOption "Icl" EditWdOptionsTable (\a->a.info.mod_edit_options.impeo) (\v a->{a & info.mod_edit_options.impeo=v})
icl_open_option	= SimpleOption "IclOpen" (\a->a.info.mod_edit_options.impopen) (\v a->{a & info.mod_edit_options.impopen=v})
Diederik van Arkel's avatar
Diederik van Arkel committed
187
188
189

ModInfoAndNameTable :: OptionsTable ModInfoAndName
ModInfoAndNameTable =
190
191
192
193
194
195
196
197
198
	{ name_option
	, dir_option
	, compiler_option
	, dcl_option
	, dcl_open_option
	, icl_option
	, icl_open_option
	, needed_obj_files_option
	, needed_libraries_option
Diederik van Arkel's avatar
Diederik van Arkel committed
199
200
	}

201
202
203
204
205
206
207
208
209
210
211
212
213
ModInfoAndNameEntry = GroupedOption "Module" ModInfoAndNameTable id const

prj_mod_info_and_name_table :: OptionsTable ModInfoAndName
prj_mod_info_and_name_table
	= { name_option, dir_option, compiler_option, needed_obj_files_option, needed_libraries_option }

prj_mod_info_and_name_entry = GroupedOption "Module" prj_mod_info_and_name_table id const

prp_mod_info_and_name_table :: OptionsTable ModInfoAndName
prp_mod_info_and_name_table
	= { name_option, dir_option, dcl_option, dcl_open_option, icl_option, icl_open_option }

prp_mod_info_and_name_entry = GroupedOption "Module" prp_mod_info_and_name_table id const
Diederik van Arkel's avatar
Diederik van Arkel committed
214
215

ProjectTable :: OptionsTable ProjectGlobalOptions
216
217
218
ProjectTable
	# main_module_option = GroupedOption "MainModule" ModInfoAndNameTable (\a->a.pg_mainModuleInfo)	(\v a->{a & pg_mainModuleInfo=v})
	# other_modules_option = ListOption "OtherModules" ModInfoAndNameEntry {info=EmptyModInfo,name=""} (\a->a.pg_otherModules) (\v a->{a & pg_otherModules=v})
219
	= make_project_table_for_reading main_module_option other_modules_option
220
221
222
223

project_table :: OptionsTable ProjectGlobalOptions
project_table
	# main_module_option = GroupedOption "MainModule" prj_mod_info_and_name_table (\a->a.pg_mainModuleInfo)	(\v a->{a & pg_mainModuleInfo=v})
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
	= make_project_table_for_writing main_module_option

project_modules_option
	= ListOption "ProjectModules" prj_dir_list_mods_entry ("",[!!]) get_other_modules set_other_modules
where
	get_other_modules :: ProjectGlobalOptions -> [!(String,[!ModInfoAndName!])!]
	get_other_modules a = group_modules_by_dir a.pg_otherModules

	group_modules_by_dir :: [!ModInfoAndName!] -> [!(String,[!ModInfoAndName!])!]
	group_modules_by_dir [!mod=:{info={dir}}:mods!]
		# (group_mods,mods) = collect_modules_in_dir dir mods
		= [!(dir,[!mod:group_mods!]):group_modules_by_dir mods!]
	group_modules_by_dir [!!]
		= [!!]

	collect_modules_in_dir :: !String ![!ModInfoAndName!] -> (![!ModInfoAndName!],![!ModInfoAndName!])
	collect_modules_in_dir dir [!mod:mods!]
		| mod.info.dir==dir
			# (group_mods,mods) = collect_modules_in_dir dir mods
			= ([!mod:group_mods!],mods)
	collect_modules_in_dir dir mods
		= ([!!],mods)

	set_other_modules :: [!(String,[!ModInfoAndName!])!] ProjectGlobalOptions -> ProjectGlobalOptions
	set_other_modules dir_mods a = {a & pg_otherModules=dir_mods_to_mods dir_mods}
	where
		dir_mods_to_mods :: [!(String,[!ModInfoAndName!])!] -> [!ModInfoAndName!]
		dir_mods_to_mods [!(dir,mods):l!] = [!{mod & info.dir=dir}\\mod<|-mods!]++|dir_mods_to_mods l
		dir_mods_to_mods [!!] = [!!]

	prj_dir_list_mods_entry :: OptionsTableEntry (String,[!ModInfoAndName!])
	prj_dir_list_mods_entry
		= GroupedOption "DirModules" {prj_group_dir_name_entry,prj_list_mod_info_and_name_entry} id const

	prj_group_dir_name_entry :: OptionsTableEntry (String,[!ModInfoAndName!])
	prj_group_dir_name_entry
		= SimpleWithStringConversionsOption convert_path_separators convert_path_to_project_file_path "Dir"
			(\(dir,_)->dir) (\dir (_,mods)->(dir,mods))

	prj_list_mod_info_and_name_entry :: OptionsTableEntry (String,[!ModInfoAndName!])
	prj_list_mod_info_and_name_entry
		= ListOption "Modules" prj_mod_info_and_name_entry {info=EmptyModInfo,name=""}
			(\(_,mods)->mods) (\mods (dir,_)->(dir,mods))

	prj_mod_info_and_name_entry :: OptionsTableEntry ModInfoAndName
	prj_mod_info_and_name_entry = GroupedOption "Module" prj_mod_info_and_name_without_dir_table id const

	prj_mod_info_and_name_without_dir_table :: OptionsTable ModInfoAndName
	prj_mod_info_and_name_without_dir_table
		= { name_option, compiler_option, needed_obj_files_option, needed_libraries_option }
274
275
276
277
278
279
280

edit_options_table :: OptionsTable ProjectGlobalOptions
edit_options_table
	# main_module_option = GroupedOption "MainModule" prp_mod_info_and_name_table (\a->a.pg_mainModuleInfo)	(\v a->{a & pg_mainModuleInfo=v})
	# other_modules_option = ListOption "OtherModules" prp_mod_info_and_name_entry {info=EmptyModInfo,name=""} (\a->a.pg_otherModules) (\v a->{a & pg_otherModules=v})
	= { main_module_option, other_modules_option }

281
282
283
284
285
286
287
288
289
290
291
292
make_project_table_for_reading :: !(OptionsTableEntry ProjectGlobalOptions) !(OptionsTableEntry ProjectGlobalOptions) -> OptionsTable ProjectGlobalOptions
make_project_table_for_reading main_module_option other_modules_option
	=	// +++ order is important here
	{	GroupedOption "Global" ProjectGlobalOptionsTable id const
	,	main_module_option
	,	project_modules_option
	,	other_modules_option	// old projects have OtherModules instead of ProjectModules
	,	GroupedOption	"Dynamic"		DynamicInfoTable			(\a->a.pg_dynamic)			(\v a->{a & pg_dynamic=v})
	}

make_project_table_for_writing :: !(OptionsTableEntry ProjectGlobalOptions) -> OptionsTable ProjectGlobalOptions
make_project_table_for_writing main_module_option
293
294
295
	=	// +++ order is important here
	{	GroupedOption "Global" ProjectGlobalOptionsTable id const
	,	main_module_option
296
	,	project_modules_option
Diederik van Arkel's avatar
Diederik van Arkel committed
297
298
	,	GroupedOption	"Dynamic"		DynamicInfoTable			(\a->a.pg_dynamic)			(\v a->{a & pg_dynamic=v})
	}
299

300
301
302
303
project_template_table :: OptionsTable ProjectGlobalOptions
project_template_table
	= { GroupedOption "Global" project_template_global_options_table id const }

304
305
306
307
308
309
310
311
EmptyModInfo :: ModInfo
EmptyModInfo
	# defaultEditWdOptions = {eo=DefaultEditOptions,pos_size=NoWindowPosAndSize}
	# mod_edit_options = {defeo=defaultEditWdOptions,impeo=defaultEditWdOptions,
						  defopen=False,impopen=False}
	= {	dir		= EmptyPathname,
		compilerOptions = DefaultCompilerOptions,
		mod_edit_options = mod_edit_options,
312
		abcLinkInfo = {linkObjFileNames = [!!], linkLibraryNames = [!!]} }
Diederik van Arkel's avatar
Diederik van Arkel committed
313
314
315
316
317
318
319
320
321
322
323
324
325
326
where
	DefaultEditOptions :: EditOptions;
	DefaultEditOptions =
		{	newlines	= HostNativeNewlineConvention
/*		{	tabs		= 4
		,	fontname	= "Courier"
		,	fontsize	= 9
		,	autoi		= True
		,	newlines	= HostNativeNewlineConvention
		,	showtabs	= False
		,	showlins	= False
		,	showsync	= True
*/		}

327
328
329
330
331
332
333
334
335
336
337
338
instance toString FusionOptions
where
	toString FusionDefault = "False"
	toString FusionOn = "True"
	toString FusionOff = "Off"

instance fromString FusionOptions
where
	fromString "True" = FusionOn
	fromString "Off" = FusionOff
	fromString _ = FusionDefault

Diederik van Arkel's avatar
Diederik van Arkel committed
339
340
341
342
343
344
345
346
347
348
349
CompilerOptionsTable :: OptionsTable CompilerOptions
CompilerOptionsTable =
	{
		SimpleOption "NeverMemoryProfile"	(\a->a.neverMemoryProfile)	(\v a->{a & neverMemoryProfile=v}),
		SimpleOption "NeverTimeProfile"		(\a->a.neverTimeProfile)	(\v a->{a & neverTimeProfile=v}),
		SimpleOption "StrictnessAnalysis"	(\a->a.sa)					(\v a->{a & sa=v}),
		SimpleOption "ListTypes"			(\a->a.listTypes)			(\v a->{a & listTypes=v}),
		SimpleOption "ListAttributes"		(\a->a.attr)				(\v a->{a & attr=v}),
		SimpleOption "Warnings"				(\a->a.gw)					(\v a->{a & gw=v}),
		SimpleOption "Verbose"				(\a->a.bv)					(\v a->{a & bv=v}),
		SimpleOption "ReadableABC"			(\a->a.gc)					(\v a->{a & gc=v}),
350
351
		SimpleOption "ReuseUniqueNodes"		(\a->a.reuseUniqueNodes)	(\v a->{a & reuseUniqueNodes=v}),
		SimpleOption "Fusion"				(\a->a.fusion)				(\v a->{a & fusion=v})
Diederik van Arkel's avatar
Diederik van Arkel committed
352
353
354
355
356
	}

CodeGenOptionsTable :: OptionsTable CodeGenOptions
CodeGenOptionsTable	=
	{
Camil Staps's avatar
Camil Staps committed
357
358
359
360
361
		SimpleOption "CheckStacks"		(\a->a.cs)					(\v a->{a & cs=v}),
		SimpleOption "CheckIndexes" 	(\a->a.ci)					(\v a->{a & ci=v}),
//		SimpleOption "KeepABC" 			(\a->a.kaf)					(\v a->{a & kaf=v}),
//		SimpleOption "TargetProcessor"	(\a->a.tp)					(\v a->{a & tp=v})
		SimpleOption "OptimiseABC"		(\a->a.optimise_abc)		(\v a->{a & optimise_abc=v}),
362
		SimpleOption "GenerateByteCode"	(\a->a.generate_bytecode)	(\v a->{a & generate_bytecode=v})
Diederik van Arkel's avatar
Diederik van Arkel committed
363
364
365
366
367
368
369
	}

instance fromString Int
where
	fromString s
		=	toInt s

370
371
ApplicationProfileOptionsTable :: OptionsTable ApplicationOptions
ApplicationProfileOptionsTable	=
Diederik van Arkel's avatar
Diederik van Arkel committed
372
373
374
375
	{
		SimpleOption "Memory"					(\a->a.memoryProfiling)					(\v a->{a & memoryProfiling=v}),
		SimpleOption "MemoryMinimumHeapSize"	(\a->a.memoryProfilingMinimumHeapSize)	(\v a->{a & memoryProfilingMinimumHeapSize=v}),
		SimpleOption "Time"						(\a->a.profiling)						(\v a->{a & profiling=v}),
376
377
		SimpleOption "Stack"					(\a->a.stack_traces)					(\v a->{a & stack_traces=v}),
		SimpleOption "Dynamics"					(\a->a.dynamics)						(\v a->{a & dynamics=v}),
378
		SimpleOption "GenericFusion"			(\a->a.generic_fusion)					(\v a->{a & generic_fusion=v}),
379
		SimpleOption "DescExL"					(\a->a.desc_exl)						(\v a->{a & desc_exl=v})
Diederik van Arkel's avatar
Diederik van Arkel committed
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
	}

ApplicationOutputOptionsTable :: OptionsTable ApplicationOptions
ApplicationOutputOptionsTable	=
	{
		SimpleOption "Output"		(\a->a.o)						(\v a->{a & o=v}),
		SimpleOption "Font"			(\a->a.fn)						(\v a->{a & fn=v}),
		SimpleOption "FontSize"		(\a->a.fs)						(\v a->{a & fs=v}),
		SimpleOption "WriteStdErr"	(\a->a.write_stderr_to_file)	(\v a->{a & write_stderr_to_file=v})
	}

ApplicationOptionsTable :: OptionsTable ApplicationOptions
ApplicationOptionsTable	=
	{
		SimpleOption "HeapSize"						(\a->a.hs)					(\v a->{a & hs=v}),
		SimpleOption "StackSize"					(\a->a.ss)					(\v a->{a & ss=v}),
		SimpleOption "ExtraMemory"					(\a->a.em)					(\v a->{a & em=v}),
		SimpleOption "IntialHeapSize"				(\a->a.initial_heap_size)	(\v a->{a & initial_heap_size=v}),
		SimpleOption "HeapSizeMultiplier"			(\a->a.heap_size_multiple)	(\v a->{a & heap_size_multiple=v}),
		SimpleOption "ShowExecutionTime"			(\a->a.set)					(\v a->{a & set=v}),
		SimpleOption "ShowGC"						(\a->a.sgc)					(\v a->{a & sgc=v}),
		SimpleOption "ShowStackSize"				(\a->a.pss)					(\v a->{a & pss=v}),
		SimpleOption "MarkingCollector"				(\a->a.marking_collection)	(\v a->{a & marking_collection=v}),
403
		SimpleOption "DisableRTSFlags"				(\a->a.disable_rts_flags)	(\v a->{a & disable_rts_flags=v}),		
Diederik van Arkel's avatar
Diederik van Arkel committed
404
		SimpleOption "StandardRuntimeEnv"			(\a->a.standard_rte)		(\v a->{a & standard_rte=v}),
405
		GroupedOption "Profile"	ApplicationProfileOptionsTable	id				const,
Diederik van Arkel's avatar
Diederik van Arkel committed
406
407
		GroupedOption "Output"	ApplicationOutputOptionsTable	id				const
	}
408

Diederik van Arkel's avatar
Diederik van Arkel committed
409
410
PathName :: OptionsTableEntry {#Char}
PathName
411
	=	SimpleWithStringConversionsOption convert_path_separators convert_path_to_project_file_path "Path" id const
Diederik van Arkel's avatar
Diederik van Arkel committed
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437

ModuleName :: OptionsTableEntry {#Char}
ModuleName
	=	SimpleOption "Module" id const

ObjectFile :: OptionsTableEntry {#Char}
ObjectFile
	=	SimpleOption "ObjectFile" id const

Library :: OptionsTableEntry {#Char}
Library
	=	SimpleOption "Library" id const

StaticLibsInfoTable :: OptionsTable StaticLibInfo
StaticLibsInfoTable =
	{ ListOption	"StaticLibs"			PathName ""		(\a->SL_Libs a)				(\v a->SL_SetLibs v a)
	, ListOption	"StaticDcls"			ModuleName ""	(\a->SL_Dcls a)				(\v a->SL_SetDcls v a)
	, ListOption	"StaticDeps"			ModuleName ""	(\a->SL_Deps a)				(\v a->SL_SetDeps v a)
	}

LinkOptionsTable :: OptionsTable LinkOptions
LinkOptionsTable	=
	{ ListOption	"ExtraObjects"			PathName ""	(\a->a.extraObjectModules)		(\v a->{a & extraObjectModules=v})
	, ListOption	"ExtraLibraries"		PathName ""	(\a->a.libraries)				(\v a->{a & libraries=v})
	, SimpleOption	"LinkMethod"						(\a->a.method)					(\v a->{a & method = v})
	, SimpleOption	"GenerateRelocations"				(\a->a.generate_relocations)	(\v a->{a & generate_relocations = v})
438
	, SimpleOption	"GenerateSymbolTable"				(\a->a.generate_symbol_table)	(\v a->{a & generate_symbol_table = v})
Diederik van Arkel's avatar
Diederik van Arkel committed
439
440
441
442
443
	, SimpleOption	"GenerateLinkMap"					(\a->a.generate_link_map)		(\v a->{a & generate_link_map = v})
	, SimpleOption	"LinkResources"						(\a->a.link_resources)			(\v a->{a & link_resources = v})
	, SimpleOption	"ResourceSource"					(\a->a.resource_source)			(\v a->{a & resource_source = v})
	, SimpleOption	"GenerateDLL"						(\a->a.generate_dll)			(\v a->{a & generate_dll = v})
	, SimpleOption	"ExportedNames"						(\a->a.dll_export_list_name)	(\v a->{a & dll_export_list_name = v})
Diederik van Arkel's avatar
Diederik van Arkel committed
444
//	, SimpleOption	"AddCarbResource"					(\a->a.add_carb_resource)		(\v a->{a & add_carb_resource = v})
445
	, SimpleOption	"StripByteCode"						(\a->a.strip_bytecode)			(\v a->{a & strip_bytecode=v})
446
	, SimpleOption	"PrelinkByteCode"					(\a->a.prelink_bytecode)		(\v a->{a & prelink_bytecode=v})
Diederik van Arkel's avatar
Diederik van Arkel committed
447
448
449
450
451
452
	}

EditWdOptionsTable :: OptionsTable EditWdOptions
EditWdOptionsTable	=
	{
		GroupedOption "Editor"			EditOptionsTable	(\a->a.eo)			(\v a->{a & eo=v}),
453
		OptionalGroupedOption "WindowPosition" is_no_position_and_size WindowPositionTable (\a->a.pos_size) (\v a->{a & pos_size=v})
Diederik van Arkel's avatar
Diederik van Arkel committed
454
455
	}

456
457
458
459
460
is_no_position_and_size NoWindowPosAndSize
	= True
is_no_position_and_size _
	= False

Diederik van Arkel's avatar
Diederik van Arkel committed
461
462
463
464
465
466
467
468
469
470
471
EditOptionsTable :: OptionsTable EditOptions
EditOptionsTable	=
	{}
/*	{ SimpleOption "TabSize"		(\a->a.EditOptions.tabs)		(\v a->{EditOptions | a & tabs=v})
	, SimpleOption "Font"			(\a->a.EditOptions.fontname)	(\v a->{EditOptions | a & fontname=v})
	, SimpleOption "FontSize"		(\a->a.EditOptions.fontsize)	(\v a->{EditOptions | a & fontsize=v})
	, SimpleOption "AutoIndent"	(\a->a.EditOptions.autoi)		(\v a->{EditOptions | a & autoi=v})
	, SimpleOption "ShowTabs"	(\a->a.EditOptions.showtabs)		(\v a->{EditOptions | a & showtabs=v})
	, SimpleOption "ShowLins"	(\a->a.EditOptions.showlins)		(\v a->{EditOptions | a & showlins=v})
	}
*/
472
WindowPositionTable :: OptionsTable OptionalWindowPosAndSize
Diederik van Arkel's avatar
Diederik van Arkel committed
473
474
WindowPositionTable	=
	{
475
476
477
478
		SimpleOption "X"		(\a->(getWindowPosAndSize a).posx)	(\v a->WindowPosAndSize {getWindowPosAndSize a & posx=v}),
		SimpleOption "Y"		(\a->(getWindowPosAndSize a).posy)	(\v a->WindowPosAndSize {getWindowPosAndSize a & posy=v}),
		SimpleOption "SizeX"	(\a->(getWindowPosAndSize a).sizex)	(\v a->WindowPosAndSize {getWindowPosAndSize a & sizex=v}),
		SimpleOption "SizeY"	(\a->(getWindowPosAndSize a).sizey)	(\v a->WindowPosAndSize {getWindowPosAndSize a & sizey=v})
Diederik van Arkel's avatar
Diederik van Arkel committed
479
480
	}

481
482
483
getWindowPosAndSize (WindowPosAndSize wps) = wps
getWindowPosAndSize NoWindowPosAndSize = DefWindowPos_and_Size

Diederik van Arkel's avatar
Diederik van Arkel committed
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
DynamicInfoTable =
	{ ListOption	"Syms"	Usym esym	(\a->a.dyn_syms)	(\v a->{a & dyn_syms=v})
	, ListOption	"Mods"	Umod emod	(\a->a.dyn_mods)	(\v a->{a & dyn_mods=v})
	, ListOption	"Objs"	PathName ""	(\a->a.dyn_objs)	(\v a->{a & dyn_objs=v})
	, ListOption	"Slib"	PathName ""	(\a->a.dyn_slibs)	(\v a->{a & dyn_slibs=v})
	, ListOption	"Dlib"	PathName ""	(\a->a.dyn_dlibs)	(\v a->{a & dyn_dlibs=v})
	, ListOption	"Pths"	PathName ""	(\a->a.dyn_paths)	(\v a->{a & dyn_paths=v})
	}

esym = {symbol_name = "", path = ""}
emod = {module_name = "", path = ""}

Usym = GroupedOption "usym" USTable id const
Umod = GroupedOption "umod" UMTable id const

USTable =
	{ SimpleOption "name" (\a->a.symbol_name)		(\v a -> {a & symbol_name = v})
	, SimpleOption "path" (\a->a.UndefSymbol.path)	(\v a -> {UndefSymbol | a & path = v})
	}
 
UMTable =
	{ SimpleOption "name" (\a->a.module_name)		(\v a -> {a & module_name = v})
	, SimpleOption "path" (\a->a.UndefModule.path)	(\v a -> {UndefModule | a & path = v})
	}