diff src/settings.sml @ 1307:d2ad997ca157

Interface for setting memory limits
author Adam Chlipala <adam@chlipala.net>
date Thu, 14 Oct 2010 11:06:26 -0400
parents b4480a56cab7
children 714e8b84221b
line wrap: on
line diff
--- a/src/settings.sml	Sun Oct 10 20:33:10 2010 -0400
+++ b/src/settings.sml	Thu Oct 14 11:06:26 2010 -0400
@@ -490,4 +490,16 @@
 fun setOnError x = onError := x
 fun getOnError () = !onError
 
+val limits = ["messages", "clients", "headers", "page", "heap", "script",
+              "inputs", "subinputs", "cleanup", "deltas", "transactionals",
+              "globals", "database"]
+
+val limitsList = ref ([] : (string * int) list)
+fun addLimit (v as (name, _)) =
+    if List.exists (fn name' => name' = name) limits then
+        limitsList := v :: !limitsList
+    else
+        raise Fail ("Unknown limit category '" ^ name ^ "'")
+fun limits () = !limitsList
+
 end