summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-22 13:27:47 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-22 13:27:47 -0400
commit5ee51dcd83cba0c90328d80376bef612b94f1700 (patch)
treee1a59ca2e292af40304d7c877d60c8df6dbe56ea
parent6bf1ca818a5c360d7ad81a22c40b89606e9b6f3a (diff)
Functions working with interpretation
-rw-r--r--src/c/urweb.c4
-rw-r--r--tests/jscomp.ur7
2 files changed, 8 insertions, 3 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 855841e1..88e9569d 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1292,7 +1292,7 @@ uw_Basis_int uw_Basis_new_client_source(uw_context ctx, uw_Basis_string s) {
strcpy(ctx->script.front, s);
ctx->script.front += s_len;
strcpy(ctx->script.front, "));");
- ctx->script.front += 2;
+ ctx->script.front += 3;
return ctx->source_count++;
}
@@ -1307,7 +1307,7 @@ uw_unit uw_Basis_set_client_source(uw_context ctx, uw_Basis_int n, uw_Basis_stri
strcpy(ctx->script.front, s);
ctx->script.front += s_len;
strcpy(ctx->script.front, "));");
- ctx->script.front += 2;
+ ctx->script.front += 3;
return uw_unit_v;
}
diff --git a/tests/jscomp.ur b/tests/jscomp.ur
index a11c0088..7722166f 100644
--- a/tests/jscomp.ur
+++ b/tests/jscomp.ur
@@ -1,10 +1,15 @@
fun main () =
s <- source "";
+ f <- source (plus 1);
return <xml><body>
- <ctextbox source={s}/><br/>
+ <ctextbox source={s}/><br/><br/>
+
+ Function: <button value="+1" onclick={set f (plus 1)}/>
+ <button value="*3" onclick={set f (times 3)}/><br/><br/>
<button value="Echo" onclick={s <- get s; alert s}/>
<button value="+1" onclick={s <- get s; alert (show (readError s + 1))}/>
<button value="*3" onclick={s <- get s; alert (show ((readError s) * 3))}/>
+ <button value="f" onclick={s <- get s; f <- get f; alert (show (f (readError s)))}/>
</body></xml>