13 |
{ dirbase: string, |
{ dirbase: string, |
14 |
pcmodespec: string, |
pcmodespec: string, |
15 |
initgspec: string, |
initgspec: string, |
16 |
maingspec: string, |
maingspec: string } |
|
stabilize: bool } |
|
17 |
-> bool |
-> bool |
18 |
|
|
19 |
end = struct |
end = struct |
51 |
(* ... and Parse *) |
(* ... and Parse *) |
52 |
structure Parse = ParseFn (structure Stabilize = Stabilize) |
structure Parse = ParseFn (structure Stabilize = Stabilize) |
53 |
|
|
54 |
fun compile { dirbase, pcmodespec, initgspec, maingspec, stabilize } = let |
fun listName p = |
55 |
|
case OS.Path.fromString p of |
56 |
|
{ vol = "", isAbs = false, arcs = _ :: arc1 :: arcn } => let |
57 |
|
fun win32name () = |
58 |
|
concat (arc1 :: |
59 |
|
foldr (fn (a, r) => "\\" :: a :: r) [] arcn) |
60 |
|
in |
61 |
|
case os of |
62 |
|
SMLofNJ.SysInfo.WIN32 => win32name () |
63 |
|
| _ => OS.Path.toString { isAbs = false, vol = "", |
64 |
|
arcs = arc1 :: arcn } |
65 |
|
end |
66 |
|
| _ => raise Fail "BootstrapCompile:listName: bad name" |
67 |
|
|
68 |
|
fun compile { dirbase, pcmodespec, initgspec, maingspec } = let |
69 |
|
|
70 |
val arch = MachDepVC.architecture |
val arch = MachDepVC.architecture |
71 |
val osname = FilenamePolicy.kind2name os |
val osname = FilenamePolicy.kind2name os |
165 |
|
|
166 |
(* here we build a new gp -- the one that uses the freshly |
(* here we build a new gp -- the one that uses the freshly |
167 |
* brewed pervasive env, core env, and primitives *) |
* brewed pervasive env, core env, and primitives *) |
168 |
val core = valOf (RT.snode ginfo_nocore core) |
val core = valOf (RT.sbnode ginfo_nocore core) |
169 |
val corenv = CoerceEnv.es2bs (#1 (#stat core)) |
val corenv = CoerceEnv.es2bs (#1 (#stat core)) |
170 |
val core_sym = #1 (#sym core) |
val core_sym = #1 (#sym core) |
171 |
|
|
177 |
val ginfo_justcore = { param = param_justcore, groupreg = groupreg, |
val ginfo_justcore = { param = param_justcore, groupreg = groupreg, |
178 |
errcons = errcons } |
errcons = errcons } |
179 |
|
|
180 |
fun rt n = valOf (RT.snode ginfo_justcore n) |
fun rt n = valOf (RT.sbnode ginfo_justcore n) |
181 |
val rts = rt rts |
val rts = rt rts |
182 |
val pervasive = rt pervasive |
val pervasive = rt pervasive |
183 |
|
|
211 |
#2 (#stat core)]), |
#2 (#stat core)]), |
212 |
fnpolicy = mainfnpolicy } |
fnpolicy = mainfnpolicy } |
213 |
{ corenv = corenv } |
{ corenv = corenv } |
|
val stableflag = if stabilize then SOME true else NONE |
|
214 |
in |
in |
215 |
case Parse.parse NONE param stableflag maingspec of |
case Parse.parse NONE param (SOME true) maingspec of |
216 |
NONE => false |
NONE => false |
217 |
| SOME (g, gp) => |
| SOME (g, gp) => |
218 |
if recomp gp g then let |
if recomp gp g then let |
224 |
fun offset NONE = ["\n"] |
fun offset NONE = ["\n"] |
225 |
| offset (SOME i) = ["@", Int.toString i, "\n"] |
| offset (SOME i) = ["@", Int.toString i, "\n"] |
226 |
fun showBootFile (p, off) = |
fun showBootFile (p, off) = |
227 |
TextIO.output (s, concat (p :: offset off)) |
TextIO.output (s, concat (listName p :: |
228 |
|
offset off)) |
229 |
in |
in |
230 |
app showBootFile bootfiles |
app showBootFile bootfiles |
231 |
end |
end |