Commits

Yaron Minsky committed 1d72cb0

added core.top

Comments (0)

Files changed (3)

base/core/oasis.sh

                       unix,
                       threads
 
+Library core_top
+  Path:               top
+  FindlibName:        top
+  FindlibParent:      core
+  Modules:            Install_printers
+  XMETARequires:      core
+  XMETADescription:   Toplevel printers for Core
+
 $(declare_tests_flag)
 
 Executable test_runner

base/core/top/core_top.mllib

+# OASIS_START
+# DO NOT EDIT (digest: c726c3185ff615847530490542668c8b)
+Install_printers
+# OASIS_STOP

base/core/top/install_printers.ml

+open Core.Std
+
+let printers = Pretty_printer.all ()
+
+let eval_string
+      ?(print_outcome = false) ?(err_formatter = Format.err_formatter) str =
+  let lexbuf = Lexing.from_string str in
+  let phrase = !Toploop.parse_toplevel_phrase lexbuf in
+  Toploop.execute_phrase print_outcome err_formatter phrase
+
+let rec install_printers = function
+  | [] -> true
+  | printer :: printers ->
+      let cmd = Printf.sprintf "#install_printer %s;;" printer in
+      eval_string cmd && install_printers printers
+
+let () =
+  if not (install_printers printers) then
+    Format.eprintf "Problem installing Core-printers@."