aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-12-18 14:17:45 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-12-18 14:17:45 -0500
commit4d07c227812b49e71de49b3e64ec6da1fbc30aed (patch)
treea234fad234187fc2eb74166ebdcd4e810bf60d30 /src/cjr_print.sml
parentc71de1db0cf31466bfc5fe7e96021e5d3cba6979 (diff)
Change tasks to support parametric code; add clientLeaves
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml72
1 files changed, 50 insertions, 22 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index fbbbc548..2bb5775e 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -2794,7 +2794,8 @@ fun p_file env (ds, ps) =
string "}",
newline]
- val initializers = List.mapPartial (fn (DTask (Initialize, e), _) => SOME e | _ => NONE) ds
+ val initializers = List.mapPartial (fn (DTask (Initialize, x1, x2, e), _) => SOME (x1, x2, e) | _ => NONE) ds
+ val expungers = List.mapPartial (fn (DTask (ClientLeaves, x1, x2, e), _) => SOME (x1, x2, e) | _ => NONE) ds
val onError = ListUtil.search (fn (DOnError n, _) => SOME n | _ => NONE) ds
@@ -2968,31 +2969,58 @@ fun p_file env (ds, ps) =
newline,
newline,
- if hasDb then
- box [string "static void uw_expunger(uw_context ctx, uw_Basis_client cli) {",
- newline,
+ box [string "static void uw_expunger(uw_context ctx, uw_Basis_client cli) {",
+ newline,
+
+ p_list_sep (box []) (fn (x1, x2, e) => box [string "({",
+ newline,
+ string "uw_Basis_client __uwr_",
+ string x1,
+ string "_0 = cli;",
+ newline,
+ string "uw_unit __uwr_",
+ string x2,
+ string "_1 = uw_unit_v;",
+ newline,
+ p_exp (E.pushERel (E.pushERel env x1 (TFfi ("Basis", "client"), ErrorMsg.dummySpan))
+ x2 dummyt) e,
+ string ";",
+ newline,
+ string "});",
+ newline]) expungers,
+
+ if hasDb then
box [p_enamed env (!expunge),
string "(ctx, cli);",
- newline],
- string "}",
- newline,
- newline,
+ newline]
+ else
+ box [],
+ string "}"],
- string "static void uw_initializer(uw_context ctx) {",
- newline,
- box [p_list_sep (box []) (fn e => box [p_exp env e,
- string ";",
- newline]) initializers,
- p_enamed env (!initialize),
+ newline,
+ string "static void uw_initializer(uw_context ctx) {",
+ newline,
+ box [p_list_sep (box []) (fn (x1, x2, e) => box [string "({",
+ newline,
+ string "uw_unit __uwr_",
+ string x1,
+ string "_0 = uw_unit_v, __uwr_",
+ string x2,
+ string "_1 = uw_unit_v;",
+ newline,
+ p_exp (E.pushERel (E.pushERel env x1 dummyt) x2 dummyt) e,
+ string ";",
+ newline,
+ string "});",
+ newline]) initializers,
+ if hasDb then
+ box [p_enamed env (!initialize),
string "(ctx, uw_unit_v);",
- newline],
- string "}",
- newline]
- else
- box [string "static void uw_expunger(uw_context ctx, uw_Basis_client cli) { };",
- newline,
- string "static void uw_initializer(uw_context ctx) { };",
- newline],
+ newline]
+ else
+ box []],
+ string "}",
+ newline,
case onError of
NONE => box []