123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081(*
* Batteries_print - Pretty-printers for the toplevel
* Copyright (C) 2009 David Rajchenbach-Teller, LIFO, Universite d'Orleans
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version,
* with the special exception on linking described in file LICENSE.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)letprint_ucharfmtt=Format.fprintffmt"UChar.of_char '%s'" (BatUTF8.init1(fun_->t))letprint_rope fmtt=Format.fprintffmt"r%S" (BatText.to_stringt)letprint_ustringfmtt=Format.fprintffmt"u%S" t(*
let string_of_cap t = BatString.Cap.to_string (BatString.Cap.copy t)
let print_string_cap_rw fmt t =
Format.fprintf fmt "rw%S" (string_of_cap t)
let print_string_cap_ro fmt t =
Format.fprintf fmt "ro%S" (string_of_cap t)
*)letstring_dynarray=BatIO.to_f_printer(BatDynArray.printBatString.print)letint_dynarray =BatIO.to_f_printer (BatDynArray.printBatInt.print)letchar_dynarray =BatIO.to_f_printer(BatDynArray.printBatChar.print)letfloat_dynarray=BatIO.to_f_printer(BatDynArray.printBatFloat.print)letint_set=BatIO.to_f_printer(BatSet.Int.printBatInt.print)letint32_set=BatIO.to_f_printer (BatSet.Int32.printBatInt32.print)letint64_set =BatIO.to_f_printer (BatSet.Int64.printBatInt64.print)letnatint_set =BatIO.to_f_printer (BatSet.Nativeint.printBatNativeint.print)letfloat_set=BatIO.to_f_printer(BatSet.Float.printBatFloat.print)letchar_set=BatIO.to_f_printer (BatSet.Char.printBatChar.print)letstring_set=BatIO.to_f_printer(BatSet.String.printBatString.print)letint_pset=BatIO.to_f_printer(BatSet.printBatInt.print)letstring_pset=BatIO.to_f_printer(BatSet.printBatString.print)letrope_pset =BatIO.to_f_printer (BatSet.printBatText.print)letchar_pset=BatIO.to_f_printer (BatSet.printBatChar.print)let(|>)xf=fxletenum_print_limit=ref20letenum_printpoce=lete=BatEnum.cloneeinfor_i=1to!enum_print_limit-1domatchBatEnum.getewith|None->()|Somex->pocx;BatIO.writeoc' 'done;ifnot(BatEnum.is_emptye)thenBatIO.nwriteoc"..."letint_enum=BatIO.to_f_printer(enum_printBatInt.print)letstring_enum=BatIO.to_f_printer(enum_printBatString.print)letrope_enum=BatIO.to_f_printer(enum_printBatText.print)letchar_enum=BatIO.to_f_printer (enum_print BatChar.print)(*let iset = BatIO.to_f_printer BatISet.print *)letint_int_pmap=BatIO.to_f_printer(BatMap.printBatInt.printBatInt.print)letint_str_pmap=BatIO.to_f_printer(BatMap.printBatInt.printBatString.print)letstr_int_pmap =BatIO.to_f_printer (BatMap.printBatString.printBatInt.print)letstr_str_pmap =BatIO.to_f_printer (BatMap.printBatString.printBatString.print)(*let bitset = BatIO.to_f_printer BatBitSet.print*)