Skip to content
Newer
Older
100644 209 lines (194 sloc) 7.38 KB
fccc685 Initial open-source release
MLstate authored Jun 21, 2011
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (** original signature (minus a few things) *)
19 val open_box : int -> unit
20 val close_box : unit -> unit
21 val print_string : string -> unit
22 val print_as : int -> string -> unit
23 val print_int : int -> unit
24 val print_float : float -> unit
25 val print_char : char -> unit
26 val print_bool : bool -> unit
27 val print_space : unit -> unit
28 val print_cut : unit -> unit
29 val print_break : int -> int -> unit
30 val print_flush : unit -> unit
31 val print_newline : unit -> unit
32 val force_newline : unit -> unit
33 val print_if_newline : unit -> unit
34 val set_margin : int -> unit
35 val get_margin : unit -> int
36 val set_max_indent : int -> unit
37 val get_max_indent : unit -> int
38 val set_max_boxes : int -> unit
39 val get_max_boxes : unit -> int
40 val over_max_boxes : unit -> bool
41 val open_hbox : unit -> unit
42 val open_vbox : int -> unit
43 val open_hvbox : int -> unit
44 val open_hovbox : int -> unit
45 val open_tbox : unit -> unit
46 val close_tbox : unit -> unit
47 val print_tbreak : int -> int -> unit
48 val set_tab : unit -> unit
49 val print_tab : unit -> unit
50 val set_ellipsis_text : string -> unit
51 val get_ellipsis_text : unit -> string
52 type tag = string
53 val open_tag : tag -> unit
54 val close_tag : unit -> unit
55 val set_tags : bool -> unit
56 val set_print_tags : bool -> unit
57 val set_mark_tags : bool -> unit
58 val get_print_tags : unit -> bool
59 val get_mark_tags : unit -> bool
60 val set_formatter_out_channel : out_channel -> unit
61 val set_formatter_output_functions :
62 (string -> int -> int -> unit) -> (unit -> unit) -> unit
63 val get_formatter_output_functions :
64 unit -> (string -> int -> int -> unit) * (unit -> unit)
65 type formatter_tag_functions = Format.formatter_tag_functions = {
66 mark_open_tag : tag -> string;
67 mark_close_tag : tag -> string;
68 print_open_tag : tag -> unit;
69 print_close_tag : tag -> unit;
70 }
71 val set_formatter_tag_functions :
72 formatter_tag_functions -> unit
73 val get_formatter_tag_functions :
74 unit -> formatter_tag_functions
75 val set_all_formatter_output_functions :
76 out:(string -> int -> int -> unit) ->
77 flush:(unit -> unit) ->
78 newline:(unit -> unit) ->
79 spaces:(int -> unit) ->
80 unit
81 val get_all_formatter_output_functions :
82 unit ->
83 (string -> int -> int -> unit) *
84 (unit -> unit) *
85 (unit -> unit) *
86 (int -> unit)
87 type formatter = Format.formatter
88 val formatter_of_out_channel : out_channel -> formatter
89 val std_formatter : formatter
90 val err_formatter : formatter
91 val formatter_of_buffer : Buffer.t -> formatter
92 val stdbuf : Buffer.t
93 val str_formatter : formatter
94 val flush_str_formatter : unit -> string
95 val make_formatter :
96 (string -> int -> int -> unit) -> (unit -> unit) -> formatter
97 val pp_open_hbox : formatter -> unit -> unit
98 val pp_open_vbox : formatter -> int -> unit
99 val pp_open_hvbox : formatter -> int -> unit
100 val pp_open_hovbox : formatter -> int -> unit
101 val pp_open_box : formatter -> int -> unit
102 val pp_close_box : formatter -> unit -> unit
103 val pp_open_tag : formatter -> string -> unit
104 val pp_close_tag : formatter -> unit -> unit
105 val pp_print_string : formatter -> string -> unit
106 val pp_print_as : formatter -> int -> string -> unit
107 val pp_print_int : formatter -> int -> unit
108 val pp_print_float : formatter -> float -> unit
109 val pp_print_char : formatter -> char -> unit
110 val pp_print_bool : formatter -> bool -> unit
111 val pp_print_break : formatter -> int -> int -> unit
112 val pp_print_cut : formatter -> unit -> unit
113 val pp_print_space : formatter -> unit -> unit
114 val pp_force_newline : formatter -> unit -> unit
115 val pp_print_flush : formatter -> unit -> unit
116 val pp_print_newline : formatter -> unit -> unit
117 val pp_print_if_newline : formatter -> unit -> unit
118 val pp_open_tbox : formatter -> unit -> unit
119 val pp_close_tbox : formatter -> unit -> unit
120 val pp_print_tbreak : formatter -> int -> int -> unit
121 val pp_set_tab : formatter -> unit -> unit
122 val pp_print_tab : formatter -> unit -> unit
123 val pp_set_tags : formatter -> bool -> unit
124 val pp_set_print_tags : formatter -> bool -> unit
125 val pp_set_mark_tags : formatter -> bool -> unit
126 val pp_get_print_tags : formatter -> unit -> bool
127 val pp_get_mark_tags : formatter -> unit -> bool
128 val pp_set_margin : formatter -> int -> unit
129 val pp_get_margin : formatter -> unit -> int
130 val pp_set_max_indent : formatter -> int -> unit
131 val pp_get_max_indent : formatter -> unit -> int
132 val pp_set_max_boxes : formatter -> int -> unit
133 val pp_get_max_boxes : formatter -> unit -> int
134 val pp_over_max_boxes : formatter -> unit -> bool
135 val pp_set_ellipsis_text : formatter -> string -> unit
136 val pp_get_ellipsis_text : formatter -> unit -> string
137 val pp_set_formatter_out_channel : formatter -> out_channel -> unit
138 val pp_set_formatter_output_functions :
139 formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> unit
140 val pp_get_formatter_output_functions :
141 formatter -> unit -> (string -> int -> int -> unit) * (unit -> unit)
142 val pp_set_all_formatter_output_functions :
143 formatter -> out:(string -> int -> int -> unit) -> flush:(unit -> unit) ->
144 newline:(unit -> unit) -> spaces:(int -> unit) -> unit
145 val pp_get_all_formatter_output_functions :
146 formatter -> unit ->
147 (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) *
148 (int -> unit)
149 val pp_set_formatter_tag_functions :
150 formatter -> formatter_tag_functions -> unit
151 val pp_get_formatter_tag_functions :
152 formatter -> unit -> formatter_tag_functions
153 val fprintf : formatter -> ('a, formatter, unit) format -> 'a
154 val printf : ('a, formatter, unit) format -> 'a
155 val eprintf : ('a, formatter, unit) format -> 'a
156 val bprintf : Buffer.t -> ('a, formatter, unit) format -> 'a
157 val kfprintf : (formatter -> 'a) -> formatter ->
158 ('b, formatter, unit, 'a) format4 -> 'b
159 val ifprintf : formatter -> ('a, formatter, unit) format -> 'a
160
161 (** new things *)
162 type 'a pprinter = Format.formatter -> 'a -> unit
163
164 val pp_fmt : ('a, Format.formatter, unit) format -> Format.formatter -> 'a
165
166 val pp_fst : 'a pprinter -> ('a * 'b) pprinter
167 val pp_snd : 'b pprinter -> ('a * 'b) pprinter
168
169 (**
170 [pp_list sep pp_a a_list]
171 A exemple of use, via Format
172 {[
173 Format.fprintf fmt "[ %a ]" (LangPrint.pp_list ";@ " pp_a) a_list
174 ]}
175 *)
176 val pp_list :
177 (unit, formatter, unit) format ->
178 ?singleton:('b pprinter) ->
179 'b pprinter ->
180 'b list pprinter
181
182 (**
183 Because [Format.sprintf] is no good.
184
185 This function build a string from pp_printer.
186
187 <!> use for small string.
188 There is also a implementation using [FBfufer] for large strings.
189
190 <!> beware, in the majority of cases, you are not supposed to produce
191 strings during the compilation (rather generate the string directly in
192 the correct channel)
193 *)
194 val sprintf :
195 ('a, Format.formatter, unit, string) format4 -> 'a
196
197 (**
198 Because [Format.ksprintf] is no good at least as much as [Format.sprintf]
199 *)
200 val ksprintf :
201 (string -> 'result) ->
202 ('a, Format.formatter, unit, 'result) format4 -> 'a
203
204 (**
205 For backward compatibility.
206 Should be removed one day. :)
207 *)
208 val to_string : 'a pprinter -> 'a -> string
Something went wrong with that request. Please try again.