mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add containers.top, a small library that installs printers
This commit is contained in:
parent
a8c8561a83
commit
e13fcbdad3
3 changed files with 47 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
#directory "_build/src/sexp";;
|
#directory "_build/src/sexp";;
|
||||||
#directory "_build/src/bigarray/";;
|
#directory "_build/src/bigarray/";;
|
||||||
#directory "_build/src/threads";;
|
#directory "_build/src/threads";;
|
||||||
|
#directory "_build/src/top/";;
|
||||||
#directory "_build/tests/";;
|
#directory "_build/tests/";;
|
||||||
#load "containers.cma";;
|
#load "containers.cma";;
|
||||||
#load "containers_iter.cma";;
|
#load "containers_iter.cma";;
|
||||||
|
|
@ -27,6 +28,7 @@
|
||||||
#load "containers_pervasives.cma";;
|
#load "containers_pervasives.cma";;
|
||||||
#load "containers_bigarray.cma";;
|
#load "containers_bigarray.cma";;
|
||||||
#load "containers_misc.cma";;
|
#load "containers_misc.cma";;
|
||||||
|
#load "containers_top.cma";;
|
||||||
#thread;;
|
#thread;;
|
||||||
#load "containers_thread.cma";;
|
#load "containers_thread.cma";;
|
||||||
open Containers_misc;;
|
open Containers_misc;;
|
||||||
|
|
|
||||||
9
_oasis
9
_oasis
|
|
@ -148,6 +148,15 @@ Library "containers_lwt"
|
||||||
Install$: flag(lwt) && flag(misc)
|
Install$: flag(lwt) && flag(misc)
|
||||||
BuildDepends: containers, lwt, containers.misc
|
BuildDepends: containers, lwt, containers.misc
|
||||||
|
|
||||||
|
Library "containers_top"
|
||||||
|
Path: src/top/
|
||||||
|
Modules: Containers_top
|
||||||
|
FindlibName: top
|
||||||
|
FindlibParent: containers
|
||||||
|
BuildDepends: compiler-libs.common, containers, containers.data,
|
||||||
|
containers.misc, containers.bigarray, containers.string,
|
||||||
|
containers.unix, containers.sexp, containers.iter
|
||||||
|
|
||||||
Document containers
|
Document containers
|
||||||
Title: Containers docs
|
Title: Containers docs
|
||||||
Type: ocamlbuild (0.3)
|
Type: ocamlbuild (0.3)
|
||||||
|
|
|
||||||
36
src/top/containers_top.ml
Normal file
36
src/top/containers_top.ml
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
(* This file is free software, part of containers. See file "license" for more details. *)
|
||||||
|
|
||||||
|
type 'a printer = Format.formatter -> 'a -> unit
|
||||||
|
|
||||||
|
let eval_exn str =
|
||||||
|
let lexbuf = Lexing.from_string str in
|
||||||
|
let phrase = !Toploop.parse_toplevel_phrase lexbuf in
|
||||||
|
Toploop.execute_phrase false Format.err_formatter phrase
|
||||||
|
|
||||||
|
let install_printer s =
|
||||||
|
try
|
||||||
|
ignore (eval_exn ("#install_printer " ^ s ^ " ;; "))
|
||||||
|
with _ ->
|
||||||
|
Printexc.print_backtrace stderr;
|
||||||
|
()
|
||||||
|
let install_printers = List.iter install_printer
|
||||||
|
|
||||||
|
let pp_vector pp_x out (v: _ CCVector.vector) = CCVector.print pp_x out v
|
||||||
|
let pp_klist (ppx:Format.formatter -> 'a -> unit) out l = CCKList.print ppx out l
|
||||||
|
|
||||||
|
let () =
|
||||||
|
install_printers
|
||||||
|
[ "CCHashtbl.print"
|
||||||
|
; "Containers_top.pp_vector"
|
||||||
|
; "CCBV.print"
|
||||||
|
; "CCDeque.print"
|
||||||
|
; "CCFQueue.print"
|
||||||
|
; "CCIntMap.print"
|
||||||
|
; "CCPersistentArray.print"
|
||||||
|
; "CCBigstring.print"
|
||||||
|
; "Containers_top.pp_klist"
|
||||||
|
; "CCKTree.print"
|
||||||
|
; "CCSexpM.print"
|
||||||
|
]
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue