Mercurial > urweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
1619:15e0c935c91b | 1620:43f22a8f76cc |
---|---|
1760 return "0"; | 1760 return "0"; |
1761 else | 1761 else |
1762 return "1"; | 1762 return "1"; |
1763 } | 1763 } |
1764 | 1764 |
1765 char *uw_Basis_urlifySource(uw_context ctx, uw_Basis_source src) { | |
1766 char *r; | |
1767 int len; | |
1768 uw_check_heap(ctx, 2 * INTS_MAX + 2); | |
1769 r = ctx->heap.front; | |
1770 sprintf(r, "%d/%llu%n", src.context, src.source, &len); | |
1771 ctx->heap.front += len+1; | |
1772 return r; | |
1773 } | |
1774 | |
1765 static void uw_Basis_urlifyInt_w_unsafe(uw_context ctx, uw_Basis_int n) { | 1775 static void uw_Basis_urlifyInt_w_unsafe(uw_context ctx, uw_Basis_int n) { |
1766 int len; | 1776 int len; |
1767 | 1777 |
1768 sprintf(ctx->page.front, "%lld%n", n, &len); | 1778 sprintf(ctx->page.front, "%lld%n", n, &len); |
1769 ctx->page.front += len; | 1779 ctx->page.front += len; |
1838 if (b == uw_Basis_False) | 1848 if (b == uw_Basis_False) |
1839 uw_writec(ctx, '0'); | 1849 uw_writec(ctx, '0'); |
1840 else | 1850 else |
1841 uw_writec(ctx, '1'); | 1851 uw_writec(ctx, '1'); |
1842 | 1852 |
1853 return uw_unit_v; | |
1854 } | |
1855 | |
1856 uw_unit uw_Basis_urlifySource_w(uw_context ctx, uw_Basis_source src) { | |
1857 int len; | |
1858 | |
1859 uw_check(ctx, 2 * INTS_MAX + 2); | |
1860 sprintf(ctx->page.front, "%d/%llu%n", src.context, src.source, &len); | |
1861 ctx->page.front += len; | |
1862 | |
1843 return uw_unit_v; | 1863 return uw_unit_v; |
1844 } | 1864 } |
1845 | 1865 |
1846 | 1866 |
1847 static char *uw_unurlify_advance(char *s) { | 1867 static char *uw_unurlify_advance(char *s) { |