Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/cm/main/preload.sml
ViewVC logotype

View of /sml/trunk/src/cm/main/preload.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1368 - (download) (annotate)
Sat Sep 13 04:44:43 2003 UTC (17 years, 1 month ago) by mblume
File size: 1110 byte(s)
type of inputLine changed; minor bugfixes; minor installer improvements
(*
 * Parsing and executing a pre-loading spec file.
 *   This is used during bootstrap.
 *
 *   Copyright (c) 1999 by Lucent Bell Laboratories
 *
 * author: Matthias Blume (blume@cs.princeton.edu)
 *)
structure Preload :> sig
    type loader = string -> bool
    val preload : { make: loader, autoload: loader } -> loader
end = struct
    type loader = string -> bool
    fun preload { make, autoload } specfile = let
	fun work s = let
	    fun loop () = let
		fun load loader f = if loader f then loop () else false
	    in
		case TextIO.inputLine s of
		    NONE => true
		  | SOME line =>
		      if String.sub (line, 0) = #"#" then loop ()
		      else case String.tokens Char.isSpace line of
			       [] => loop () (* ignore empty lines *)
			     | ["make", f] => load make f
			     | ["autoload", f] => load autoload f
			     | _ => (Say.say ["Illegal line in ", specfile,
					      ": ", line];
				     loop ())
	    end
	in
	    loop ()
	end
    in
	SafeIO.perform { openIt = fn () => TextIO.openIn specfile,
			 closeIt = TextIO.closeIn,
			 work = work,
			 cleanup = fn _ => () }
    end
end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0