summaryrefslogtreecommitdiff
path: root/src/cjr_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-13 14:20:41 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-13 14:20:41 -0500
commitb225596addee1a3cfd6c3189cff923e7f0e8f7c9 (patch)
tree14b2deefac4e078e2d5e4e5bdd076749de8659d8 /src/cjr_print.sml
parent1063981355a5a041793c095c6fd89b91fa0bd579 (diff)
Initializers and setval
Diffstat (limited to 'src/cjr_print.sml')
-rw-r--r--src/cjr_print.sml23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index a1d5ed2c..6a5116ce 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -1849,6 +1849,20 @@ fun p_exp' par env (e, loc) =
newline,
string "})"]
+ | ESetval {seq, count} =>
+ box [string "({",
+ newline,
+
+ #setval (Settings.currentDbms ()) {loc = loc,
+ seqE = p_exp env seq,
+ count = p_exp env count},
+ newline,
+ newline,
+
+ string "uw_unit_v;",
+ newline,
+ string "})"]
+
| EUnurlify (e, t) =>
let
fun getIt () =
@@ -2085,6 +2099,8 @@ fun p_decl env (dAll as (d, _) : decl) =
space,
string "*/"]
+ | DInitializer _ => box []
+
datatype 'a search =
Found of 'a
| NotFound
@@ -2716,6 +2732,8 @@ fun p_file env (ds, ps) =
newline],
string "}",
newline]
+
+ val initializers = List.mapPartial (fn (DInitializer e, _) => SOME e | _ => NONE) ds
in
box [string "#include <stdio.h>",
newline,
@@ -2849,7 +2867,10 @@ fun p_file env (ds, ps) =
string "void uw_initializer(uw_context ctx) {",
newline,
- box [p_enamed env (!initialize),
+ box [p_list_sep (box []) (fn e => box [p_exp env e,
+ string ";",
+ newline]) initializers,
+ p_enamed env (!initialize),
string "(ctx, uw_unit_v);",
newline],
string "}",