Add external functions called during reduction
[hcoop/domtool2.git] / src / domain.sml
index f2579dd..8020ee4 100644 (file)
@@ -223,8 +223,11 @@ datatype master =
         ExternalMaster of string
        | InternalMaster of string
 
-val ip = fn (EApp ((EVar "ip_of_node", _), e), _) => Option.map nodeIp (Env.string e)
-         | e => Env.string e
+val ip = Env.string
+
+val _ = Env.registerFunction ("ip_of_node",
+                             fn [(EString node, _)] => SOME (EString (nodeIp node), dl)
+                              | _ => NONE)
 
 val master = fn (EApp ((EVar "externalMaster", _), e), _) => Option.map ExternalMaster (ip e)
              | (EApp ((EVar "internalMaster", _), e), _) => Option.map InternalMaster (Env.string e)
@@ -487,7 +490,7 @@ val _ = Env.containerV_one "domain"
                                               "master" => TextIO.output (outf, "\tallow-update { none; };\n")
                                             | _ => (TextIO.output (outf, "\tmasters { ");
                                                     TextIO.output (outf, masterIp);
-                                                    TextIO.output (outf, " };\n"));
+                                                    TextIO.output (outf, "; };\n"));
                                           TextIO.output (outf, "};\n");
                                           TextIO.closeOut outf
                                       end