summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-07-18 12:53:26 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-07-18 12:53:26 -0400
commita0f04bf3a961a1da0283397f1f69c3c9bf6c1404 (patch)
tree6b55accc9b388b5a6a51795811f7660a5ff5c682 /src
parentd220a54cca60319831bd618f6cd70245014397cb (diff)
Key events get key code input
Diffstat (limited to 'src')
-rw-r--r--src/jscomp.sml1
-rw-r--r--src/monoize.sml7
-rw-r--r--src/settings.sml9
3 files changed, 12 insertions, 5 deletions
diff --git a/src/jscomp.sml b/src/jscomp.sml
index 79ae814e..63f3d883 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -768,6 +768,7 @@ fun process file =
in
(str name, st)
end
+ | EFfiApp ("Basis", "kc", []) => (str "kc(event)", st)
| EFfiApp (m, x, args) =>
let
val name = case Settings.jsFunc (m, x) of
diff --git a/src/monoize.sml b/src/monoize.sml
index a6e38fd7..488f3b20 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -2505,10 +2505,13 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
result = (L'.TFfi ("Basis", "string"), loc)}), loc),
fm)
end
- | (L'.TFun _, _) =>
+ | (L'.TFun (dom, _), _) =>
let
val s' = " " ^ lowercaseFirst x ^ "='"
- val e = (L'.EApp (e, (L'.ERecord [], loc)), loc)
+ val e = case #1 dom of
+ L'.TRecord [] => (L'.EApp (e, (L'.ERecord [], loc)), loc)
+ | _ => (L'.EApp ((L'.EApp (e, (L'.EFfiApp ("Basis", "kc", []), loc)),
+ loc), (L'.ERecord [], loc)), loc)
in
((L'.EStrcat (s,
(L'.EStrcat (
diff --git a/src/settings.sml b/src/settings.sml
index c7e68960..3b6de173 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -91,7 +91,8 @@ val effectfulBase = basis ["dml",
"onFail",
"onConnectFail",
"onDisconnect",
- "onServerError"]
+ "onServerError",
+ "kc"]
val effectful = ref effectfulBase
fun setEffectful ls = effectful := S.addList (effectfulBase, ls)
@@ -108,7 +109,8 @@ val clientBase = basis ["get",
"onFail",
"onConnectFail",
"onDisconnect",
- "onServerError"]
+ "onServerError",
+ "kc"]
val client = ref clientBase
fun setClientOnly ls = client := S.addList (clientBase, ls)
fun isClientOnly x = S.member (!client, x)
@@ -162,7 +164,8 @@ val jsFuncsBase = basisM [("alert", "alert"),
("strindex", "sidx"),
("strchr", "schr"),
("substring", "ssub"),
- ("strcspn", "sspn")]
+ ("strcspn", "sspn"),
+ ("kc", "kc")]
val jsFuncs = ref jsFuncsBase
fun setJsFuncs ls = jsFuncs := foldl (fn ((k, v), m) => M.insert (m, k, v)) jsFuncsBase ls
fun jsFunc x = M.find (!jsFuncs, x)