diff src/c/urweb.c @ 1556:e1f5d9c4cc20

An abstract type of IDs
author Adam Chlipala <adam@chlipala.net>
date Sat, 03 Sep 2011 12:51:05 -0400
parents c3b5cf5c2f98
children f403e129c276
line wrap: on
line diff
--- a/src/c/urweb.c	Sat Sep 03 11:48:12 2011 -0400
+++ b/src/c/urweb.c	Sat Sep 03 12:51:05 2011 -0400
@@ -463,6 +463,8 @@
   uw_Basis_postBody postBody;
   uw_Basis_string queryString;
 
+  unsigned nextId;
+
   char error_message[ERROR_BUF_LEN];
 };
 
@@ -532,6 +534,8 @@
 
   ctx->queryString = NULL;
 
+  ctx->nextId = 0;
+
   return ctx;
 }
 
@@ -608,6 +612,7 @@
   ctx->used_transactionals = 0;
   ctx->script_header = "";
   ctx->queryString = NULL;
+  ctx->nextId = 0;
 }
 
 void uw_reset_keep_request(uw_context ctx) {
@@ -3947,3 +3952,7 @@
 
   memmove(s, s2+2, strlen(s2+2)+1);
 }
+
+uw_Basis_string uw_Basis_fresh(uw_context ctx) {
+  return uw_Basis_htmlifyInt(ctx, ctx->nextId++);
+}