diff src/compiler.sml @ 1307:d2ad997ca157

Interface for setting memory limits
author Adam Chlipala <adam@chlipala.net>
date Thu, 14 Oct 2010 11:06:26 -0400
parents 0d3d9e653829
children e12cef71aa1a
line wrap: on
line diff
--- a/src/compiler.sml	Sun Oct 10 20:33:10 2010 -0400
+++ b/src/compiler.sml	Thu Oct 14 11:06:26 2010 -0400
@@ -698,6 +698,17 @@
                                          m1 :: (fs as _ :: _) =>
                                          onError := SOME (m1, List.take (fs, length fs - 1), List.last fs)
                                        | _ => ErrorMsg.error "invalid 'onError' argument")
+                                  | "limit" =>
+                                    (case String.fields Char.isSpace arg of
+                                         [class, num] =>
+                                         (case Int.fromString num of
+                                              NONE => ErrorMsg.error ("invalid limit number '" ^ num ^ "'")
+                                            | SOME n =>
+                                              if n < 0 then
+                                                  ErrorMsg.error ("invalid limit number '" ^ num ^ "'")
+                                              else
+                                                  Settings.addLimit (class, n))
+                                       | _ => ErrorMsg.error "invalid 'limit' arguments")
 
                                   | _ => ErrorMsg.error ("Unrecognized command '" ^ cmd ^ "'");
                                 read ()