summaryrefslogtreecommitdiff
path: root/src/c/urweb.c
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-12-03 10:00:10 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-12-03 10:00:10 -0500
commit2286c970ce9d32a630e289df2685dbdff8e18217 (patch)
tree999270929063a6966b6a45583e091ce015e612b3 /src/c/urweb.c
parent7136358c17f8193173e8a0a9469821039212d879 (diff)
Allow sources to be returned by RPCs
Diffstat (limited to 'src/c/urweb.c')
-rw-r--r--src/c/urweb.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 491fb73d..8ebd9a2f 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1762,6 +1762,16 @@ char *uw_Basis_urlifyBool(uw_context ctx, uw_Basis_bool b) {
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 @@ uw_unit uw_Basis_urlifyBool_w(uw_context ctx, uw_Basis_bool b) {
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, '/');