diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-10-19 15:19:41 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-10-19 15:19:41 -0400 |
commit | 0a1e81c5811d640c00d5b5984d2254e0d8521743 (patch) | |
tree | 7af5a35748f3b5dca4efc5eced2e1a842b719a30 /src/main.mlton.sml | |
parent | 6b4491e84c22056a9d97c34abc9c3561108f2497 (diff) |
Building combined demo app
Diffstat (limited to 'src/main.mlton.sml')
-rw-r--r-- | src/main.mlton.sml | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/main.mlton.sml b/src/main.mlton.sml index 94d0f2ac..eb92e39d 100644 --- a/src/main.mlton.sml +++ b/src/main.mlton.sml @@ -25,23 +25,25 @@ * POSSIBILITY OF SUCH DAMAGE. *) -fun doArgs (args, (timing, sources)) = +fun doArgs (args, (timing, demo, sources)) = case args of - [] => (timing, rev sources) + [] => (timing, demo, rev sources) + | "-demo" :: prefix :: rest => + doArgs (rest, (timing, SOME prefix, sources)) | arg :: rest => let val acc = if size arg > 0 andalso String.sub (arg, 0) = #"-" then case arg of - "-timing" => (true, sources) + "-timing" => (true, demo, sources) | _ => raise Fail ("Unknown option " ^ arg) else - (timing, arg :: sources) + (timing, demo, arg :: sources) in doArgs (rest, acc) end -val (timing, sources) = doArgs (CommandLine.arguments (), (false, [])) +val (timing, demo, sources) = doArgs (CommandLine.arguments (), (false, NONE, [])) val job = case sources of @@ -49,7 +51,11 @@ val job = | _ => raise Fail "Zero or multiple job files specified" val () = - if timing then - Compiler.time Compiler.toCjrize job - else - Compiler.compile job + case demo of + SOME prefix => + Demo.make {prefix = prefix, dirname = job} + | NONE => + if timing then + Compiler.time Compiler.toCjrize job + else + Compiler.compile job |