diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-10-06 17:36:45 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-10-06 17:36:45 -0400 |
commit | f0999e0e7b8ae0f3e0ac622d4d70e8a1da61f47e (patch) | |
tree | b83f18305aa8814ca95cf3a7e6a8829f789d8380 /src | |
parent | 82ed38468f5da48ce6e9f6ec336cf5b11ca4bb4d (diff) |
Versioned1 demo working
Diffstat (limited to 'src')
-rw-r--r-- | src/c/urweb.c | 15 | ||||
-rw-r--r-- | src/cjr_print.sml | 17 | ||||
-rw-r--r-- | src/mono_reduce.sml | 4 |
3 files changed, 11 insertions, 25 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c index e49de568..d9ac4c5f 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -2160,6 +2160,7 @@ char *uw_Basis_sqlifyTime(uw_context ctx, uw_Basis_time t) { if (localtime_r(&t, &stm)) { s = uw_malloc(ctx, TIMES_MAX); + --stm.tm_hour; len = strftime(s, TIMES_MAX, TIME_FMT, &stm); r = uw_malloc(ctx, len + 14); sprintf(r, "'%s'::timestamp", s); @@ -2176,7 +2177,6 @@ char *uw_Basis_attrifyTime(uw_context ctx, uw_Basis_time t) { if (localtime_r(&t, &stm)) { uw_check_heap(ctx, TIMES_MAX); r = ctx->heap.front; - --stm.tm_hour; len = strftime(r, TIMES_MAX, TIME_FMT, &stm); ctx->heap.front += len+1; return r; @@ -2429,7 +2429,6 @@ uw_Basis_time uw_Basis_unsqlTime(uw_context ctx, uw_Basis_string s) { *dot = 0; if (strptime(s, TIME_FMT_PG, &stm)) { *dot = '.'; - --stm.tm_hour; return mktime(&stm); } else { @@ -2439,10 +2438,8 @@ uw_Basis_time uw_Basis_unsqlTime(uw_context ctx, uw_Basis_string s) { } else { if (strptime(s, TIME_FMT_PG, &stm) == end) { - --stm.tm_hour; return mktime(&stm); } else if (strptime(s, TIME_FMT, &stm) == end) { - --stm.tm_hour; return mktime(&stm); } else uw_error(ctx, FATAL, "Can't parse time: %s", s); @@ -2602,9 +2599,13 @@ void uw_commit(uw_context ctx) { ctx->transactionals[i].free(ctx->transactionals[i].data); // Splice script data into appropriate part of page - if (ctx->returning_blob || ctx->script_header[0] == 0) - ; - else if (buf_used(&ctx->script) == 0) { + if (ctx->returning_blob || ctx->script_header[0] == 0) { + char *start = strstr(ctx->page.start, "<sc>"); + if (start) { + memmove(start, start + 4, buf_used(&ctx->page) - (start - ctx->page.start) - 4); + ctx->page.front -= 4; + } + } else if (buf_used(&ctx->script) == 0) { size_t len = strlen(ctx->script_header); char *start = strstr(ctx->page.start, "<sc>"); if (start) { diff --git a/src/cjr_print.sml b/src/cjr_print.sml index 9f337b5b..25666d97 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -536,23 +536,6 @@ fun getPargs (e, _) = | _ => raise Fail "CjrPrint: getPargs" -fun p_ensql t e = - case t of - Int => box [string "uw_Basis_attrifyInt(ctx, ", e, string ")"] - | Float => box [string "uw_Basis_attrifyFloat(ctx, ", e, string ")"] - | String => e - | Bool => box [string "(", e, string " ? \"TRUE\" : \"FALSE\")"] - | Time => box [string "uw_Basis_attrifyTime(ctx, ", e, string ")"] - | Blob => box [e, string ".data"] - | Channel => box [string "uw_Basis_attrifyChannel(ctx, ", e, string ")"] - | Client => box [string "uw_Basis_attrifyClient(ctx, ", e, string ")"] - | Nullable String => e - | Nullable t => box [string "(", - e, - string " == NULL ? NULL : ", - p_ensql t (box [string "(*", e, string ")"]), - string ")"] - fun notLeaky env allowHeapAllocated = let fun nl ok (t, _) = diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml index 07e54b4d..b07f81b6 100644 --- a/src/mono_reduce.sml +++ b/src/mono_reduce.sml @@ -380,7 +380,8 @@ fun reduce file = else [Unsure]) | EApp (f, x) => - unravel (#1 f, passed + 1, summarize d x @ ls) + unravel (#1 f, passed + 1, List.revAppend (summarize d x, + ls)) | _ => [Unsure] in unravel (e, 0, []) @@ -584,6 +585,7 @@ fun reduce file = (*val () = Print.prefaces "Try" [(*("e", MonoPrint.p_exp env (e, ErrorMsg.dummySpan)),*) ("e'", MonoPrint.p_exp env e'), + ("b", MonoPrint.p_exp (E.pushERel env x t NONE) b), ("e'_eff", p_events effs_e'), ("b", p_events effs_b)]*) |