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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1368 - (view) (download)

1 : blume 495 (*
2 :     * Parsing and executing a pre-loading spec file.
3 :     * This is used during bootstrap.
4 :     *
5 :     * Copyright (c) 1999 by Lucent Bell Laboratories
6 :     *
7 :     * author: Matthias Blume (blume@cs.princeton.edu)
8 :     *)
9 :     structure Preload :> sig
10 :     type loader = string -> bool
11 :     val preload : { make: loader, autoload: loader } -> loader
12 :     end = struct
13 :     type loader = string -> bool
14 :     fun preload { make, autoload } specfile = let
15 :     fun work s = let
16 :     fun loop () = let
17 :     fun load loader f = if loader f then loop () else false
18 :     in
19 :     case TextIO.inputLine s of
20 : mblume 1368 NONE => true
21 :     | SOME line =>
22 :     if String.sub (line, 0) = #"#" then loop ()
23 :     else case String.tokens Char.isSpace line of
24 :     [] => loop () (* ignore empty lines *)
25 :     | ["make", f] => load make f
26 :     | ["autoload", f] => load autoload f
27 :     | _ => (Say.say ["Illegal line in ", specfile,
28 :     ": ", line];
29 :     loop ())
30 : blume 495 end
31 :     in
32 :     loop ()
33 :     end
34 :     in
35 :     SafeIO.perform { openIt = fn () => TextIO.openIn specfile,
36 :     closeIt = TextIO.closeIn,
37 :     work = work,
38 :     cleanup = fn _ => () }
39 :     end
40 :     end

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