comparison src/settings.sml @ 2010:403f0cc65b9c

New lessSafeFfi
author Adam Chlipala <adam@chlipala.net>
date Fri, 02 May 2014 19:19:09 -0400
parents 93ff76058825
children 6372a742ab04
comparison
equal deleted inserted replaced
2009:799be3911ce3 2010:403f0cc65b9c
192 "currentUrlHasQueryString", 192 "currentUrlHasQueryString",
193 "currentUrl"] 193 "currentUrl"]
194 194
195 val benign = ref benignBase 195 val benign = ref benignBase
196 fun setBenignEffectful ls = benign := S.addList (benignBase, ls) 196 fun setBenignEffectful ls = benign := S.addList (benignBase, ls)
197 fun addBenignEffectful x = benign := S.add (!benign, x)
197 fun isBenignEffectful x = S.member (!benign, x) 198 fun isBenignEffectful x = S.member (!benign, x)
198 199
199 val clientBase = basis ["get_client_source", 200 val clientBase = basis ["get_client_source",
200 "current", 201 "current",
201 "alert", 202 "alert",
223 "preventDefault", 224 "preventDefault",
224 "stopPropagation", 225 "stopPropagation",
225 "giveFocus"] 226 "giveFocus"]
226 val client = ref clientBase 227 val client = ref clientBase
227 fun setClientOnly ls = client := S.addList (clientBase, ls) 228 fun setClientOnly ls = client := S.addList (clientBase, ls)
229 fun addClientOnly x = client := S.add (!client, x)
228 fun isClientOnly x = S.member (!client, x) 230 fun isClientOnly x = S.member (!client, x)
229 231
230 val serverBase = basis ["requestHeader", 232 val serverBase = basis ["requestHeader",
231 "query", 233 "query",
232 "dml", 234 "dml",
238 "fieldValue", 240 "fieldValue",
239 "remainingFields", 241 "remainingFields",
240 "firstFormField"] 242 "firstFormField"]
241 val server = ref serverBase 243 val server = ref serverBase
242 fun setServerOnly ls = server := S.addList (serverBase, ls) 244 fun setServerOnly ls = server := S.addList (serverBase, ls)
245 fun addServerOnly x = server := S.add (!server, x)
243 fun isServerOnly x = S.member (!server, x) 246 fun isServerOnly x = S.member (!server, x)
244 247
245 val basisM = foldl (fn ((k, v : string), m) => M.insert (m, ("Basis", k), v)) M.empty 248 val basisM = foldl (fn ((k, v : string), m) => M.insert (m, ("Basis", k), v)) M.empty
246 249
247 val jsFuncsBase = basisM [("alert", "alert"), 250 val jsFuncsBase = basisM [("alert", "alert"),
362 ("property", "property"), 365 ("property", "property"),
363 ("giveFocus", "giveFocus")] 366 ("giveFocus", "giveFocus")]
364 val jsFuncs = ref jsFuncsBase 367 val jsFuncs = ref jsFuncsBase
365 fun setJsFuncs ls = jsFuncs := foldl (fn ((k, v), m) => M.insert (m, k, v)) jsFuncsBase ls 368 fun setJsFuncs ls = jsFuncs := foldl (fn ((k, v), m) => M.insert (m, k, v)) jsFuncsBase ls
366 fun jsFunc x = M.find (!jsFuncs, x) 369 fun jsFunc x = M.find (!jsFuncs, x)
370 fun addJsFunc (k, v) = jsFuncs := M.insert (!jsFuncs, k, v)
367 fun allJsFuncs () = M.listItemsi (!jsFuncs) 371 fun allJsFuncs () = M.listItemsi (!jsFuncs)
368 372
369 datatype pattern_kind = Exact | Prefix 373 datatype pattern_kind = Exact | Prefix
370 datatype action = Allow | Deny 374 datatype action = Allow | Deny
371 type rule = { action : action, kind : pattern_kind, pattern : string } 375 type rule = { action : action, kind : pattern_kind, pattern : string }
733 737
734 val html5 = ref false 738 val html5 = ref false
735 fun setIsHtml5 b = html5 := b 739 fun setIsHtml5 b = html5 := b
736 fun getIsHtml5 () = !html5 740 fun getIsHtml5 () = !html5
737 741
742 val less = ref false
743 fun setLessSafeFfi b = less := b
744 fun getLessSafeFfi () = !less
745
738 end 746 end