ocaml/stdlib/camlinternalFormat.mli

121 lines
4.6 KiB
OCaml
Raw Normal View History

(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Benoit Vaugon, ENSTA *)
(* *)
(* Copyright 2014 Institut National de Recherche en Informatique et *)
(* en Automatique. *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
(* No comments, OCaml stdlib internal use only. *)
open CamlinternalFormatBasics
val is_in_char_set : char_set -> char -> bool
val rev_char_set : char_set -> char_set
type mutable_char_set = bytes
val create_char_set : unit -> mutable_char_set
val add_in_char_set : mutable_char_set -> char -> unit
val freeze_char_set : mutable_char_set -> char_set
type ('a, 'b, 'c, 'd, 'e, 'f) param_format_ebb = Param_format_EBB :
('x -> 'a, 'b, 'c, 'd, 'e, 'f) fmt ->
('a, 'b, 'c, 'd, 'e, 'f) param_format_ebb
val param_format_of_ignored_format :
('a, 'b, 'c, 'd, 'y, 'x) ignored -> ('x, 'b, 'c, 'y, 'e, 'f) fmt ->
('a, 'b, 'c, 'd, 'e, 'f) param_format_ebb
type ('b, 'c) acc_formatting_gen =
| Acc_open_tag of ('b, 'c) acc
PR#6418: support "@[<hov %d>" in the new format implementation (Benoît Vaugon) The bootstrap procedure, as for commit trunk@14973 (see there for detailed build instructions), requires to first commit a temporary patch: > diff -Naur old/typing/typecore.ml new/typing/typecore.ml > --- old/typing/typecore.ml 2014-06-11 18:16:24.851647309 +0200 > +++ new/typing/typecore.ml 2014-06-11 18:15:50.075646418 +0200 > @@ -2758,16 +2758,9 @@ > let mk_int n = mk_cst (Const_int n) > and mk_string str = mk_cst (Const_string (str, None)) > and mk_char chr = mk_cst (Const_char chr) in > - let mk_block_type bty = match bty with > - | Pp_hbox -> mk_constr "Pp_hbox" [] > - | Pp_vbox -> mk_constr "Pp_vbox" [] > - | Pp_hvbox -> mk_constr "Pp_hvbox" [] > - | Pp_hovbox -> mk_constr "Pp_hovbox" [] > - | Pp_box -> mk_constr "Pp_box" [] > - | Pp_fits -> mk_constr "Pp_fits" [] in > let rec mk_formatting_lit fmting = match fmting with > - | Open_box (org, bty, idt) -> > - mk_constr "Open_box" [ mk_string org; mk_block_type bty; mk_int idt ] > + | Open_box _ -> > + assert false > | Close_box -> > mk_constr "Close_box" [] > | Close_tag -> > @@ -2950,6 +2943,19 @@ > mk_constr "Alpha" [ mk_fmt rest ] > | Theta rest -> > mk_constr "Theta" [ mk_fmt rest ] > + | Formatting_lit (Open_box (org, _bty, _idt), rest) -> > + mk_constr "Formatting_gen" [ > + mk_constr "Open_box" [ > + mk_constr "Format" [ > + mk_constr "String_literal" [ > + mk_string "<>"; > + mk_constr "End_of_format" []; > + ]; > + mk_string "@[<>"; > + ] > + ]; > + mk_fmt rest; > + ] > | Formatting_lit (fmting, rest) -> > mk_constr "Formatting_lit" [ mk_formatting_lit fmting; mk_fmt rest ] > | Formatting_gen (fmting, rest) -> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14984 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-06-14 14:08:50 -07:00
| Acc_open_box of ('b, 'c) acc
and ('b, 'c) acc =
| Acc_formatting_lit of ('b, 'c) acc * formatting_lit
| Acc_formatting_gen of ('b, 'c) acc * ('b, 'c) acc_formatting_gen
| Acc_string_literal of ('b, 'c) acc * string
| Acc_char_literal of ('b, 'c) acc * char
| Acc_data_string of ('b, 'c) acc * string
| Acc_data_char of ('b, 'c) acc * char
| Acc_delay of ('b, 'c) acc * ('b -> 'c)
| Acc_flush of ('b, 'c) acc
| Acc_invalid_arg of ('b, 'c) acc * string
| End_of_acc
type ('a, 'b) heter_list =
| Cons : 'c * ('a, 'b) heter_list -> ('c -> 'a, 'b) heter_list
| Nil : ('b, 'b) heter_list
type ('b, 'c, 'e, 'f) fmt_ebb = Fmt_EBB :
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt ->
('b, 'c, 'e, 'f) fmt_ebb
val make_printf :
(('b, 'c) acc -> 'd) -> ('b, 'c) acc ->
('a, 'b, 'c, 'c, 'c, 'd) CamlinternalFormatBasics.fmt -> 'a
val make_iprintf : ('s -> 'f) -> 's -> ('a, 'b, 'c, 'd, 'e, 'f) fmt -> 'a
val output_acc : out_channel -> (out_channel, unit) acc -> unit
val bufput_acc : Buffer.t -> (Buffer.t, unit) acc -> unit
val strput_acc : Buffer.t -> (unit, string) acc -> unit
val type_format :
('x, 'b, 'c, 't, 'u, 'v) CamlinternalFormatBasics.fmt ->
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmtty ->
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt
val fmt_ebb_of_string :
?legacy_behavior:bool -> string -> ('b, 'c, 'e, 'f) fmt_ebb
(* warning: the optional flag legacy_behavior is EXPERIMENTAL and will
be removed in the next version. You must not set it explicitly. It
is only used by the type-checker implementation.
*)
val format_of_string_fmtty :
string ->
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmtty ->
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6
val format_of_string_format :
string ->
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6 ->
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6
val char_of_iconv : CamlinternalFormatBasics.int_conv -> char
val string_of_formatting_lit : CamlinternalFormatBasics.formatting_lit -> string
val string_of_fmtty :
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmtty -> string
val string_of_fmt :
('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.fmt -> string
PR#6418: support "@[<hov %d>" in the new format implementation (Benoît Vaugon) The bootstrap procedure, as for commit trunk@14973 (see there for detailed build instructions), requires to first commit a temporary patch: > diff -Naur old/typing/typecore.ml new/typing/typecore.ml > --- old/typing/typecore.ml 2014-06-11 18:16:24.851647309 +0200 > +++ new/typing/typecore.ml 2014-06-11 18:15:50.075646418 +0200 > @@ -2758,16 +2758,9 @@ > let mk_int n = mk_cst (Const_int n) > and mk_string str = mk_cst (Const_string (str, None)) > and mk_char chr = mk_cst (Const_char chr) in > - let mk_block_type bty = match bty with > - | Pp_hbox -> mk_constr "Pp_hbox" [] > - | Pp_vbox -> mk_constr "Pp_vbox" [] > - | Pp_hvbox -> mk_constr "Pp_hvbox" [] > - | Pp_hovbox -> mk_constr "Pp_hovbox" [] > - | Pp_box -> mk_constr "Pp_box" [] > - | Pp_fits -> mk_constr "Pp_fits" [] in > let rec mk_formatting_lit fmting = match fmting with > - | Open_box (org, bty, idt) -> > - mk_constr "Open_box" [ mk_string org; mk_block_type bty; mk_int idt ] > + | Open_box _ -> > + assert false > | Close_box -> > mk_constr "Close_box" [] > | Close_tag -> > @@ -2950,6 +2943,19 @@ > mk_constr "Alpha" [ mk_fmt rest ] > | Theta rest -> > mk_constr "Theta" [ mk_fmt rest ] > + | Formatting_lit (Open_box (org, _bty, _idt), rest) -> > + mk_constr "Formatting_gen" [ > + mk_constr "Open_box" [ > + mk_constr "Format" [ > + mk_constr "String_literal" [ > + mk_string "<>"; > + mk_constr "End_of_format" []; > + ]; > + mk_string "@[<>"; > + ] > + ]; > + mk_fmt rest; > + ] > | Formatting_lit (fmting, rest) -> > mk_constr "Formatting_lit" [ mk_formatting_lit fmting; mk_fmt rest ] > | Formatting_gen (fmting, rest) -> git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14984 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-06-14 14:08:50 -07:00
val open_box_of_string : string -> int * block_type
val symm :
('a1, 'b1, 'c1, 'd1, 'e1, 'f1,
'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel
-> ('a2, 'b2, 'c2, 'd2, 'e2, 'f2,
'a1, 'b1, 'c1, 'd1, 'e1, 'f1) fmtty_rel
val trans :
('a1, 'b1, 'c1, 'd1, 'e1, 'f1,
'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel
-> ('a2, 'b2, 'c2, 'd2, 'e2, 'f2,
'a3, 'b3, 'c3, 'd3, 'e3, 'f3) fmtty_rel
-> ('a1, 'b1, 'c1, 'd1, 'e1, 'f1,
'a3, 'b3, 'c3, 'd3, 'e3, 'f3) fmtty_rel
val recast :
('a1, 'b1, 'c1, 'd1, 'e1, 'f1) fmt
-> ('a1, 'b1, 'c1, 'd1, 'e1, 'f1,
'a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmtty_rel
-> ('a2, 'b2, 'c2, 'd2, 'e2, 'f2) fmt