|
|
1.1 root 1: (* Copyright 1989 by AT&T Bell Laboratories *)
2: structure MakeMos =
3: struct
4:
5: fun makeMos modname =
6: let type object = System.Unsafe.object
7: val boot : string -> unit ->
8: ((object list -> (object * ByteArray.bytearray array)) * string list)
9: = System.Unsafe.boot
10:
11: val dict = ref ["Core"]
12:
13: fun lookup s = let fun f (s1::r) = s=s1 orelse f r
14: | f nil = false
15: in f (!dict)
16: end
17:
18: fun enter s = dict := s::(!dict)
19:
20: fun readfile s =
21: let val stream = open_in s
22: in input stream (can_input stream) before close_in stream
23: end
24:
25: val f = open_out ("runtime/" ^ modname ^ ".mos")
26: val say = output f
27: fun getstruct s = if lookup s then ()
28: else let val s' = "mo/" ^ s ^ ".mo"
29: val _ = (say s'; say "\n")
30: val g = readfile s'
31: val (_,sl) = boot g ()
32: in app getstruct sl;
33: enter s
34: end
35: in output std_out (modname ^ ".mos\n");
36: say "mo/CoreFunc.mo\n";
37: app getstruct ["Initial","Loader",modname];
38: close_out f
39: end
40:
41: end;(*
42:
43: app MakeMos.makeMos ["IntNull","IntVax","CompVax","IntM68","CompM68",
44: "IntSparc","CompSparc","IntNS32","CompNS32"];
45:
46: *)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.