Mercurial > urweb
comparison src/main.mlton.sml @ 384:2a7e7bd7b29f
Building combined demo app
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 19 Oct 2008 15:19:41 -0400 |
parents | 168667cdaa95 |
children | 7ef4b2911b09 |
comparison
equal
deleted
inserted
replaced
383:49c95753bf3b | 384:2a7e7bd7b29f |
---|---|
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 * POSSIBILITY OF SUCH DAMAGE. | 25 * POSSIBILITY OF SUCH DAMAGE. |
26 *) | 26 *) |
27 | 27 |
28 fun doArgs (args, (timing, sources)) = | 28 fun doArgs (args, (timing, demo, sources)) = |
29 case args of | 29 case args of |
30 [] => (timing, rev sources) | 30 [] => (timing, demo, rev sources) |
31 | "-demo" :: prefix :: rest => | |
32 doArgs (rest, (timing, SOME prefix, sources)) | |
31 | arg :: rest => | 33 | arg :: rest => |
32 let | 34 let |
33 val acc = | 35 val acc = |
34 if size arg > 0 andalso String.sub (arg, 0) = #"-" then | 36 if size arg > 0 andalso String.sub (arg, 0) = #"-" then |
35 case arg of | 37 case arg of |
36 "-timing" => (true, sources) | 38 "-timing" => (true, demo, sources) |
37 | _ => raise Fail ("Unknown option " ^ arg) | 39 | _ => raise Fail ("Unknown option " ^ arg) |
38 else | 40 else |
39 (timing, arg :: sources) | 41 (timing, demo, arg :: sources) |
40 in | 42 in |
41 doArgs (rest, acc) | 43 doArgs (rest, acc) |
42 end | 44 end |
43 | 45 |
44 val (timing, sources) = doArgs (CommandLine.arguments (), (false, [])) | 46 val (timing, demo, sources) = doArgs (CommandLine.arguments (), (false, NONE, [])) |
45 | 47 |
46 val job = | 48 val job = |
47 case sources of | 49 case sources of |
48 [file] => file | 50 [file] => file |
49 | _ => raise Fail "Zero or multiple job files specified" | 51 | _ => raise Fail "Zero or multiple job files specified" |
50 | 52 |
51 val () = | 53 val () = |
52 if timing then | 54 case demo of |
53 Compiler.time Compiler.toCjrize job | 55 SOME prefix => |
54 else | 56 Demo.make {prefix = prefix, dirname = job} |
55 Compiler.compile job | 57 | NONE => |
58 if timing then | |
59 Compiler.time Compiler.toCjrize job | |
60 else | |
61 Compiler.compile job |