summaryrefslogtreecommitdiff
path: root/src/main.mlton.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-10-14 11:06:26 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2010-10-14 11:06:26 -0400
commit7bf0a0124a6c8a834983a660af53d8789ac0a8ac (patch)
tree628ead017a0f1cf2138f9f9b08088debf81e1ce5 /src/main.mlton.sml
parent4e608544ebe87dd991d53ded5267f14f5df93b8b (diff)
Interface for setting memory limits
Diffstat (limited to 'src/main.mlton.sml')
-rw-r--r--src/main.mlton.sml9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.mlton.sml b/src/main.mlton.sml
index 09b53c58..a434ef12 100644
--- a/src/main.mlton.sml
+++ b/src/main.mlton.sml
@@ -91,6 +91,15 @@ fun doArgs args =
| "-noEmacs" :: rest =>
(Demo.noEmacs := true;
doArgs rest)
+ | "-limit" :: class :: num :: rest =>
+ (case Int.fromString num of
+ NONE => raise Fail ("Invalid limit number '" ^ num ^ "'")
+ | SOME n =>
+ if n < 0 then
+ raise Fail ("Invalid limit number '" ^ num ^ "'")
+ else
+ Settings.addLimit (class, n);
+ doArgs rest)
| arg :: rest =>
(if size arg > 0 andalso String.sub (arg, 0) = #"-" then
raise Fail ("Unknown flag " ^ arg)