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 879 - (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 :     fun isComment l =
19 :     size l > 0 andalso String.sub (l, 0) = #"#"
20 :     in
21 :     case TextIO.inputLine s of
22 :     "" => true
23 :     | line =>
24 :     if isComment line then loop ()
25 :     else (case String.tokens Char.isSpace line of
26 : blume 879 [] => loop ()(* ignore empty lines *)
27 :     | ["make", f] => load make f
28 : blume 495 | ["autoload", f] => load autoload f
29 :     | _ => (Say.say ["Illegal line in ", specfile,
30 :     ": ", line];
31 :     loop ()))
32 :     end
33 :     in
34 :     loop ()
35 :     end
36 :     in
37 :     SafeIO.perform { openIt = fn () => TextIO.openIn specfile,
38 :     closeIt = TextIO.closeIn,
39 :     work = work,
40 :     cleanup = fn _ => () }
41 :     end
42 :     end

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