package integers

  1. Overview
  2. Docs
Various signed and unsigned integer types for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

0.7.0.tar.gz
sha256=8bb517fa9a1818246eb8c4ce34ee1489fbebb4b92defa3a25d13cab8d23ec685
md5=201cf24143d7cb9a3921d572b6e6c42c

doc/src/integers.top/install_integer_printers.ml.html

Source file install_integer_printers.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(* Adapted from Anil Madhavapeddy's ocaml-uri package. *)

let _ = Integer_printers.format_sint

let printers = [ "Integer_printers.format_sint";
                 "Integer_printers.format_long";
                 "Integer_printers.format_llong";
                 "Integer_printers.format_uchar";
                 "Integer_printers.format_uint8";
                 "Integer_printers.format_uint16";
                 "Integer_printers.format_uint32";
                 "Integer_printers.format_uint64";
                 "Integer_printers.format_ushort";
                 "Integer_printers.format_uint";
                 "Integer_printers.format_ulong";
                 "Integer_printers.format_ullong";]

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 integer-printers@."
OCaml

Innovation. Community. Security.