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/system/batchcomp.sml
ViewVC logotype

Annotation of /sml/trunk/src/system/batchcomp.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : blume 515 local
2 :     fun main _ = let
3 :     fun quit () = OS.Process.exit OS.Process.success
4 :     fun one [] = "ok"
5 :     | one ["m"] = Bool.toString (CMB.make ())
6 :     | one ["m", f] = Bool.toString (CMB.make' (SOME f))
7 :     | one ["d"] = Bool.toString (CMB.deliver ())
8 :     | one ["d", f] = Bool.toString (CMB.deliver' (SOME f))
9 :     | one ["r"] = (CMB.reset (); "reset")
10 :     | one ["?", v] =
11 :     getOpt (Option.map Int.toString (#get (CMB.symval v) ()),
12 :     "not set")
13 :     | one ["=", v] = (#set (CMB.symval v) NONE; "done")
14 :     | one ["=", v, n] =
15 :     (case Int.fromString n of
16 :     x as SOME _ => (#set (CMB.symval v) x; "done")
17 :     | NONE => "bad number syntax")
18 :     | one ["q"] = quit ()
19 :     | one _ = "invalid command"
20 :     fun loop () =
21 :     case TextIO.inputLine TextIO.stdIn of
22 :     "" => quit ()
23 :     | line => (TextIO.output (TextIO.stdOut,
24 :     one (String.tokens Char.isSpace line) ^
25 :     "\n");
26 :     loop ())
27 :     in
28 :     SMLofNJ.Internals.resetTimers ();
29 :     Compiler.Stats.reset ();
30 :     loop ()
31 :     handle exn =>
32 :     (TextIO.output (TextIO.stdOut,
33 :     General.exnMessage exn ^ "\n");
34 :     quit ())
35 :     end
36 :     in
37 :     val _ = SMLofNJ.exportFn ("batchcomp", main)
38 :     end

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