File:  [Research Unix] / researchv10no / cmd / sml / src / boot / makemos.sml
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

(* Copyright 1989 by AT&T Bell Laboratories *)
structure MakeMos = 
struct

fun makeMos modname = 
 let type object = System.Unsafe.object
     val boot : string -> unit ->
	    ((object list -> (object * ByteArray.bytearray array)) * string list)
	  = System.Unsafe.boot

     val dict = ref ["Core"]

     fun lookup s = let fun f (s1::r) = s=s1 orelse f r
		          | f nil = false
		     in f (!dict)
		    end

     fun enter s = dict := s::(!dict)

     fun readfile s =
	let val stream = open_in s
	 in input stream (can_input stream) before close_in stream
	end

     val f = open_out ("runtime/" ^ modname ^ ".mos")
     val say = output f
     fun getstruct s = if lookup s then ()
		else let val s' = "mo/" ^ s ^ ".mo"
			 val _ = (say s'; say "\n")
			val g = readfile s'
		        val (_,sl) = boot g ()
		    in  app getstruct sl;
			enter s
		    end
  in output std_out (modname ^ ".mos\n");
     say "mo/CoreFunc.mo\n";
     app getstruct ["Initial","Loader",modname];
     close_out f
 end

end;(*

app MakeMos.makeMos ["IntNull","IntVax","CompVax","IntM68","CompM68",
    "IntSparc","CompSparc","IntNS32","CompNS32"];
     
*)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.