]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql_interpreter/mQIConn.ml
mathql interpreter flags can be now red from helm registry
[helm.git] / helm / ocaml / mathql_interpreter / mQIConn.ml
index 460ef41d088b5bd91481a152a3e32f4cbc2e6b1c..2b1847008178ca8cca09c2f72925b143a72e6375 100644 (file)
@@ -78,16 +78,22 @@ let string_of_flags flags =
 let flags_of_string s =
    string_fold_left (fun l c -> l @ flag_of_char c) [] s
 
-let init myflags mylog =
+let init ?(flags = []) mylog =
+   let flags = 
+      if flags = [] then
+         flags_of_string (Helm_registry.get "mathql_interpreter.flags")
+      else 
+         flags
+   in
    let m, a =
       let g = 
-         if List.mem Galax myflags 
+         if List.mem Galax flags 
            then MQIMap.empty_map else MQIMap.read_map
       in g ()
    in
-   {log = mylog; set = myflags; 
+   {log = mylog; set = flags; 
     pgc =
-     if List.mem Galax myflags then
+     if List.mem Galax flags then
       None
      else
       MQIPostgres.init
@@ -101,7 +107,7 @@ let close handle =
 let connected handle =
    if set handle Galax then false else (pgc handle) <> None  
 
-let init_if_connected myflags mylog =
-   let handle = init myflags mylog in
+let init_if_connected ?(flags = []) mylog =
+   let handle = init ~flags:flags mylog in
    ignore (pgc handle); handle