forked from ocaml/Zarith
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add package zarith.top with REPL printer
Fix ocaml#17
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
open Printf | ||
|
||
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 () = | ||
let printers = ["Z.pp_print"; "Q.pp_print"] in | ||
let ok = List.fold_left (fun b p -> | ||
b && eval_string(sprintf "#install_printer %s;;" p)) | ||
true printers in | ||
if not ok then Format.eprintf "Problem installing ZArith-printers@." |