summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-03 11:03:35 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-03 11:03:35 -0400
commitcf83c3318fb43ebfce468477c9fb6ad64c96e440 (patch)
treeb6f4bdade340a0f1ed24e1ae5b34072e6814ef8e
parentc0b7963e91681045bb4c82a2356776fae54f54c5 (diff)
Cjrize EStrcat
-rw-r--r--include/lacweb.h2
-rw-r--r--src/c/lacweb.c15
-rw-r--r--src/cjrize.sml8
3 files changed, 24 insertions, 1 deletions
diff --git a/include/lacweb.h b/include/lacweb.h
index 13db1f7b..c2853cd7 100644
--- a/include/lacweb.h
+++ b/include/lacweb.h
@@ -48,3 +48,5 @@ void lw_Basis_urlifyString_w(lw_context, lw_Basis_string);
lw_Basis_int lw_unurlifyInt(char **);
lw_Basis_float lw_unurlifyFloat(char **);
lw_Basis_string lw_unurlifyString(lw_context, char **);
+
+lw_Basis_string lw_Basis_strcat(lw_context, lw_Basis_string, lw_Basis_string);
diff --git a/src/c/lacweb.c b/src/c/lacweb.c
index c744271c..7ee6daef 100644
--- a/src/c/lacweb.c
+++ b/src/c/lacweb.c
@@ -505,3 +505,18 @@ void lw_Basis_htmlifyString_w(lw_context ctx, lw_Basis_string s) {
}
}
}
+
+lw_Basis_string lw_Basis_strcat(lw_context ctx, lw_Basis_string s1, lw_Basis_string s2) {
+ int len = strlen(s1) + strlen(s2) + 1;
+ char *s;
+
+ lw_check(ctx, len);
+
+ s = ctx->heap_front;
+
+ strcpy(s, s1);
+ strcat(s, s2);
+ ctx->heap_front += len;
+
+ return s;
+}
diff --git a/src/cjrize.sml b/src/cjrize.sml
index 1e55cfc5..ac3563f0 100644
--- a/src/cjrize.sml
+++ b/src/cjrize.sml
@@ -155,7 +155,13 @@ fun cifyExp ((e, loc), sm) =
| L.ECase _ => raise Fail "Cjrize ECase"
- | L.EStrcat _ => raise Fail "Cjrize EStrcat"
+ | L.EStrcat (e1, e2) =>
+ let
+ val (e1, sm) = cifyExp (e1, sm)
+ val (e2, sm) = cifyExp (e2, sm)
+ in
+ ((L'.EFfiApp ("Basis", "strcat", [e1, e2]), loc), sm)
+ end
| L.EWrite e =>
let