1
(******************************************************************************
4
* Copyright (C) 2005- Jane Street Holding, LLC *
5
* Contact: opensource@janestreet.com *
6
* WWW: http://www.janestreet.com/ocaml *
7
* Author: Markus Mottl *
9
* This library is free software; you can redistribute it and/or *
10
* modify it under the terms of the GNU Lesser General Public *
11
* License as published by the Free Software Foundation; either *
12
* version 2 of the License, or (at your option) any later version. *
14
* This library is distributed in the hope that it will be useful, *
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
17
* Lesser General Public License for more details. *
19
* You should have received a copy of the GNU Lesser General Public *
20
* License along with this library; if not, write to the Free Software *
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
23
******************************************************************************)
25
let printers = [ "Sexplib.Sexp.pp_hum" ]
28
?(print_outcome = false) ?(err_formatter = Format.err_formatter) str =
29
let lexbuf = Lexing.from_string str in
30
let phrase = !Toploop.parse_toplevel_phrase lexbuf in
31
Toploop.execute_phrase print_outcome err_formatter phrase
33
let rec install_printers = function
35
| printer :: printers ->
36
let cmd = Printf.sprintf "#install_printer %s;;" printer in
37
eval_string cmd && install_printers printers
40
if not (install_printers printers) then
41
Format.eprintf "Problem installing Sexplib-printers@."