diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-08-03 11:03:35 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-08-03 11:03:35 -0400 |
commit | cf83c3318fb43ebfce468477c9fb6ad64c96e440 (patch) | |
tree | b6f4bdade340a0f1ed24e1ae5b34072e6814ef8e /src | |
parent | c0b7963e91681045bb4c82a2356776fae54f54c5 (diff) |
Cjrize EStrcat
Diffstat (limited to 'src')
-rw-r--r-- | src/c/lacweb.c | 15 | ||||
-rw-r--r-- | src/cjrize.sml | 8 |
2 files changed, 22 insertions, 1 deletions
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 |