Mercurial > urweb
diff src/c/urweb.c @ 1620:43f22a8f76cc
Allow sources to be returned by RPCs
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 03 Dec 2011 10:00:10 -0500 |
parents | f403e129c276 |
children | 438561303d02 |
line wrap: on
line diff
--- a/src/c/urweb.c Sat Dec 03 09:44:07 2011 -0500 +++ b/src/c/urweb.c Sat Dec 03 10:00:10 2011 -0500 @@ -1762,6 +1762,16 @@ return "1"; } +char *uw_Basis_urlifySource(uw_context ctx, uw_Basis_source src) { + char *r; + int len; + uw_check_heap(ctx, 2 * INTS_MAX + 2); + r = ctx->heap.front; + sprintf(r, "%d/%llu%n", src.context, src.source, &len); + ctx->heap.front += len+1; + return r; +} + static void uw_Basis_urlifyInt_w_unsafe(uw_context ctx, uw_Basis_int n) { int len; @@ -1843,6 +1853,16 @@ return uw_unit_v; } +uw_unit uw_Basis_urlifySource_w(uw_context ctx, uw_Basis_source src) { + int len; + + uw_check(ctx, 2 * INTS_MAX + 2); + sprintf(ctx->page.front, "%d/%llu%n", src.context, src.source, &len); + ctx->page.front += len; + + return uw_unit_v; +} + static char *uw_unurlify_advance(char *s) { char *new_s = strchr(s, '/');