PmCleanSystem.dcl 6.44 KB
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1
2
3
4
5
6
7
8
9
10
11
12
13
definition module PmCleanSystem

/* OS dependent module for windows */

/* Interface module for calling the CLEAN compiler, code generator and linker */

import StdFile, StdPSt
import StdPathname
import UtilStrictLists
import PmCompilerOptions
import PmTypes

//ifWindows w o :== o
Diederik van Arkel's avatar
Diederik van Arkel committed
14
standardStaticLibraries :: !Processor !LinkMethod -> List String
Diederik van Arkel's avatar
Diederik van Arkel committed
15
standardObjectFiles :: !Bool !Bool !Processor -> List String
Diederik van Arkel's avatar
Diederik van Arkel committed
16
17
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)

18
19
20
21
:: CompilerProcessIds

NoCompilerProcessIds :: CompilerProcessIds

Diederik van Arkel's avatar
Diederik van Arkel committed
22
ClearCompilerCache :: !String !String !.a -> (!Int,!.a)
23
24
ClearCompilerCaches :: !CompilerProcessIds !.a -> (!Int,!.a)
QuitCleanCompiler :: !Bool !CompilerProcessIds !*(IOSt .l) -> *(IOSt .l)
Diederik van Arkel's avatar
Diederik van Arkel committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

::	CompileClearCache	= ClearCache | Don`tClearCache
instance == CompileClearCache

::	CompileOrCheckSyntax	= SyntaxCheck | Compilation
instance == CompileOrCheckSyntax

::	CodeGenerateAsmOrCode	= AsmGeneration | CodeGeneration
instance == CodeGenerateAsmOrCode

::	CompilerMsg
	= 	CompilerOK
	| 	SyntaxError
	| 	Patherror Pathname
instance == CompilerMsg

Diederik van Arkel's avatar
Diederik van Arkel committed
41
::	WindowFun env :== ([String]) -> env -> env
Diederik van Arkel's avatar
Diederik van Arkel committed
42
43
44
45
46

Compile ::						// Compiles the given file:
	!String						// compiler exe name and options
								// !! should be full path so that cocl generates diagnostics in logical place...
								// should be quoted if required
47
	!Bool						// use_compiler_process_psn
Diederik van Arkel's avatar
Diederik van Arkel committed
48
49
50
51
52
53
54
55
56
57
58
	!Bool						// send -wmt flag to compiler (write_module_times)
	!(WindowFun *env)			// error display fun
	!(WindowFun *env)			// types display fun
	!CompileOrCheckSyntax		// check syntax only?
	!Pathname					// full .icl pathname of module to be compiled
	!(List Pathname)			// list of paths where compiler can find imported .dcl files
	!Bool						// project memory profiling?
	!Bool						// project time profiling?
	!Bool						// project eager or dynamic linking?
	!CompilerOptions			// compiler options
	!Pathname					// startup directory
59
	!CompilerProcessIds
Diederik van Arkel's avatar
Diederik van Arkel committed
60
61
	!*env						// state
	->
62
	(!Pathname					// .abc pathname of generated code
Diederik van Arkel's avatar
Diederik van Arkel committed
63
64
65
66
//					Note: on the macintosh the .abc file is generated in the standard Clean System
//					Files Folder. On Unix, however, the location of the .abc depends on the user
//					settings.
	,!CompilerMsg				// indication whether compilation was successfull
67
68
	,!CompilerProcessIds
	,!*env						// state
Diederik van Arkel's avatar
Diederik van Arkel committed
69
70
71
72
73
74
	) | FileEnv env

CodeGen	::						// Generates code for the given file:
	!String						// generator exe name and options
								// !! should be full path so that cg generates diagnostics in logical place...
								// should be quoted if required
75
	!Bool						// use_compiler_process_psn
Diederik van Arkel's avatar
Diederik van Arkel committed
76
77
78
79
80
	!(WindowFun *(PSt .l))		// error display fun
	!CodeGenerateAsmOrCode		// generate assembly only?
	!Pathname					// full .abc pathname of module to be compiled
	!Bool						// timeprofiling option
	!CodeGenOptions				// code generator options
81
	!Processor					// target processor
Diederik van Arkel's avatar
Diederik van Arkel committed
82
83
	!ApplicationOptions			// application options
	!Pathname					// startup directory
84
	!CompilerProcessIds
Diederik van Arkel's avatar
Diederik van Arkel committed
85
86
	!*(PSt .l)					// state
	->
87
	(!Pathname					// full pathname of generated object file
Diederik van Arkel's avatar
Diederik van Arkel committed
88
89
90
//					Note: on the macintosh the .o file is generated in the standard Clean System
//					Files Folder. On Unix, however, the location of the .o depends on the user
//					settings.
91
92
93
	,!Bool							// success status
	,!CompilerProcessIds
	,!*(PSt .l)				// state
Diederik van Arkel's avatar
Diederik van Arkel committed
94
95
	)

96
97
98
StartCodeGenerator	::	!String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !Processor !ApplicationOptions !Pathname
						!CompilerProcessIds !*(PSt .l)
	-> (!Bool,!Pathname,!CompilerProcessIds,!*(PSt .l))
Diederik van Arkel's avatar
Diederik van Arkel committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

Link ::							// Links the given file:
	!String						// linker exe name
								// !! should be full path so that linker generates diagnostics in logical place...
								// this is quoted by the Link function because it first needs to decompose it...
	!(WindowFun *(PSt .l))		// error display fun
	!Pathname					// full pathname of the executable
	!ApplicationOptions			// application options
	!Pathname					// options pathname
	!(List Pathname)			// dynamic library file names
	!(List Pathname)			// object file names
	!(List Pathname)			// static library file names
	!Bool						// link statically?
	!Bool						// generate relocations?
	!Bool						// generate link map?
	!Bool						// link in resources?
	!String						// source of resources to link in
	!Bool						// generate dll?
	!String						// name of file containing symbols to be exported from dll
	!Pathname					// startup directory
119
	!String						// dynamic linker name
Diederik van Arkel's avatar
Diederik van Arkel committed
120
121
//	!Bool						// add 'carb' 0 resource?
	!Processor					// target processor
122
	!Bool						// use_64_bit_processor
Diederik van Arkel's avatar
Diederik van Arkel committed
123
124
125
126
127
128
129
130
131
132
133
134
	!*(PSt .l)					// state
	->
	( !*(PSt .l)				// state
	, !Bool						// success status
	)

DynLink :: !String !String !String !*(PSt .l) -> (Bool,*PSt .l)

Execute	::						// Executes the given application
	!(WindowFun *env)			// error display fun
	!Pathname					// full pathname of the application
	!ApplicationOptions			// application options (only need the console flag)
135
	!*env						// state
Diederik van Arkel's avatar
Diederik van Arkel committed
136
	->
137
	( !*env						// state
Diederik van Arkel's avatar
Diederik van Arkel committed
138
139
140
	, !Bool						// success status
	)

Diederik van Arkel's avatar
Diederik van Arkel committed
141
Launch :: !{#Char} !.a -> (!Int, !.a)
Diederik van Arkel's avatar
Diederik van Arkel committed
142
Execute`	::	!String !*env -> (!Bool,!Int,!*env)
Diederik van Arkel's avatar
Diederik van Arkel committed
143
144
145
146
147
148

import StdMaybe

:: ThreadId
	:==	Int

149
150
151
CompileStartCommand :: !String !Bool !(WindowFun *env) !CompileOrCheckSyntax !Pathname !(List Pathname) !Int !Bool !Bool !Bool
				!CompilerOptions !Pathname !CompilerProcessIds !*env
								-> (!Bool, !CompilerProcessIds,!*env) | FileEnv env
Diederik van Arkel's avatar
Diederik van Arkel committed
152
CompileHandleExitCode :: !Int !String !String !Int !(WindowFun *env) !(WindowFun *env) !Pathname
153
				!ListTypes !*env -> (!Pathname,!CompilerMsg,!*env) | FileEnv env
Diederik van Arkel's avatar
Diederik van Arkel committed
154
155
156
157
158
159
160

:: CompilePollCompletedResult = NoFinishedCompiler | UnknownFinishedCompiler | FinishedCompiler !Int !Int

CompilePollCompleted :: !*env -> (!CompilePollCompletedResult, !*env) | FileEnv env

:: CompilingInfo

Diederik van Arkel's avatar
Diederik van Arkel committed
161
InitCompilingInfo :: *CompilingInfo
Diederik van Arkel's avatar
Diederik van Arkel committed
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

ExitCleanCompiler :: !*(!*CompilingInfo,*env) -> *(!*CompilingInfo,*env)

CompilePersistent ::
	!String					// cocl
	!Bool					// send -wmt flag to compiler (write_module_times)
	!(WindowFun *env)		// errwin
	!(WindowFun *env)		// typewin
	!CompileOrCheckSyntax	// compileOrCheckSyntax
	!Pathname				// path
	!(List Pathname)		// paths
	!Bool					// projectHeapProfiling
	!Bool					// projectTimeProfiling
	!Bool					// projectEagerOrDynamic
	!CompilerOptions		// compileroptions
	!Pathname				// startupdir
	!*CompilingInfo			// compiler state
	!*env					// env
	-> (!*CompilingInfo,!(!*env, !Pathname, !CompilerMsg))
	| FileEnv env

SendRepeatResult :: !Int !.a -> (!Int,!.a)

185
DelayEventLoop :: !.ps -> .ps;