diff src/cjr_print.sml @ 1073:b2311dfb3158

Initializers and setval
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Dec 2009 14:20:41 -0500
parents 217eb87dde31
children 0657e5adc938
line wrap: on
line diff
--- a/src/cjr_print.sml	Sun Dec 13 13:00:55 2009 -0500
+++ b/src/cjr_print.sml	Sun Dec 13 14:20:41 2009 -0500
@@ -1849,6 +1849,20 @@
              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 @@
                          space,
                          string "*/"]
 
+      | DInitializer _ => box []
+
 datatype 'a search =
          Found of 'a
        | NotFound
@@ -2716,6 +2732,8 @@
                       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 @@
 
                       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 "}",