# HG changeset patch # User Adam Chlipala # Date 1217775815 14400 # Node ID c7a5c8e0a0e0522f6874df0e57bc277a457fc0e5 # Parent 3bbed533fbd2feb18c644992227af8360d47c886 Cjrize EStrcat diff -r 3bbed533fbd2 -r c7a5c8e0a0e0 include/lacweb.h --- a/include/lacweb.h Sun Aug 03 10:48:36 2008 -0400 +++ b/include/lacweb.h Sun Aug 03 11:03:35 2008 -0400 @@ -48,3 +48,5 @@ 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 -r 3bbed533fbd2 -r c7a5c8e0a0e0 src/c/lacweb.c --- a/src/c/lacweb.c Sun Aug 03 10:48:36 2008 -0400 +++ b/src/c/lacweb.c Sun Aug 03 11:03:35 2008 -0400 @@ -505,3 +505,18 @@ } } } + +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 -r 3bbed533fbd2 -r c7a5c8e0a0e0 src/cjrize.sml --- a/src/cjrize.sml Sun Aug 03 10:48:36 2008 -0400 +++ b/src/cjrize.sml Sun Aug 03 11:03:35 2008 -0400 @@ -155,7 +155,13 @@ | 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