forked from thierry-martinez/stdcompat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
stdcompat__format.ml.in
287 lines (227 loc) · 6.75 KB
/
stdcompat__format.ml.in
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
@BEGIN_FROM_4_06_0@
include Format
@END_FROM_4_06_0@
@BEGIN_BEFORE_4_06_0@
@BEGIN_FROM_4_01_0@
include (Format : module type of struct include Format end
with type formatter_out_functions := Format.formatter_out_functions)
@END_FROM_4_01_0@
@BEGIN_BEFORE_4_01_0@
include Format
@END_BEFORE_4_01_0@
type formatter_out_functions =
{
out_string: string -> int -> int -> unit ;
out_flush: unit -> unit ;
out_newline: unit -> unit ;
out_spaces: int -> unit ;
out_indent: int -> unit }
let formatter_of_out_functions functions =
failwith "Not implemented."
@BEGIN_FROM_4_01_0@
let downgrade_formatter_out_functions functions =
let { out_string; out_flush; out_newline; out_spaces; out_indent = _ } =
functions in
{ Format.out_string; out_flush; out_newline; out_spaces }
let upgrade_formatter_out_functions functions =
let { Format.out_string; out_flush; out_newline; out_spaces } =
functions in
let out_indent _ =
failwith "Not implemented." in
{ out_string; out_flush; out_newline; out_spaces; out_indent }
let pp_set_formatter_out_functions fmt functions =
Format.pp_set_formatter_out_functions fmt
(downgrade_formatter_out_functions functions)
let set_formatter_out_functions functions =
Format.set_formatter_out_functions
(downgrade_formatter_out_functions functions)
let pp_get_formatter_out_functions fmt () =
upgrade_formatter_out_functions (Format.pp_get_formatter_out_functions fmt ())
let get_formatter_out_functions () =
upgrade_formatter_out_functions (Format.get_formatter_out_functions ())
@END_FROM_4_01_0@
@BEGIN_BEFORE_4_01_0@
let pp_set_formatter_out_functions _ =
failwith "Not implemented."
let set_formatter_out_functions _ =
failwith "Not implemented."
let pp_get_formatter_out_functions _ =
failwith "Not implemented."
let get_formatter_out_functions _ =
failwith "Not implemented."
@END_BEFORE_4_01_0@
@END_BEFORE_4_06_0@
@BEGIN_BEFORE_4_01_0@
let asprintf _ =
failwith "Not implemented."
@END_BEFORE_4_01_0@
@BEGIN_BEFORE_4_06_0@
type symbolic_output_item =
| Output_flush
| Output_newline
| Output_string of string
| Output_spaces of int
| Output_indent of int
@END_BEFORE_4_06_0@
@BEGIN_BEFORE_4_06_0@
type symbolic_output_buffer
@END_BEFORE_4_06_0@
@BEGIN_BEFORE_4_08_0@
let pp_print_option ?none some formatter value =
match value with
| None ->
begin
match none with
| None -> ()
| Some none -> none formatter ()
end
| Some value -> some formatter value
let pp_print_result ~ok ~error formatter value =
match value with
| Stdcompat__result.Ok v -> ok formatter v
| Stdcompat__result.Error e -> error formatter e
let dprintf _ =
failwith "Not implemented."
let kdprintf _ =
failwith "Not implemented."
let get_formatter_stag_functions _ =
failwith "Not implemented."
let pp_get_formatter_stag_functions _ =
failwith "Not implemented."
let set_formatter_stag_functions _ =
failwith "Not implemented."
let pp_set_formatter_stag_functions _ =
failwith "Not implemented."
let close_stag _ =
failwith "Not implemented."
let pp_close_stag _ =
failwith "Not implemented."
let open_stag _ =
failwith "Not implemented."
let pp_open_stag _ =
failwith "Not implemented."
let get_geometry _ =
failwith "Not implemented."
let pp_get_geometry _ =
failwith "Not implemented."
let set_geometry ~max_indent:_ ~margin:_ =
failwith "Not implemented."
let pp_set_geometry _ ~max_indent:_ ~margin:_ =
failwith "Not implemented."
let safe_set_geometry ~max_indent:_ ~margin:_ =
failwith "Not implemented."
let pp_safe_set_geometry _ ~max_indent:_ ~margin:_ =
failwith "Not implemented."
let check_geometry _ =
failwith "Not implemented."
let pp_safe_set_geometry _ =
failwith "Not implemented."
let pp_print_custom_break _ =
failwith "Not implemented."
@BEGIN_FROM_4_02_0@
type stag = ..
@END_FROM_4_02_0@
@BEGIN_BEFORE_4_02_0@
type stag
@END_BEFORE_4_02_0@
type geometry = {
max_indent: int ;
margin: int }
type formatter_stag_functions =
{
mark_open_stag: stag -> string ;
mark_close_stag: stag -> string ;
print_open_stag: stag -> unit ;
print_close_stag: stag -> unit }
@END_BEFORE_4_08_0@
@BEGIN_BEFORE_4_06_0@
let formatter_of_out_functions _ =
failwith "Not implemented."
let make_symbolic_output_buffer _ =
failwith "Not implemented."
let clear_symbolic_output_buffer _ =
failwith "Not implemented."
let get_symbolic_output_buffer _ =
failwith "Not implemented."
let flush_symbolic_output_buffer _ =
failwith "Not implemented."
let add_symbolic_output_item _ =
failwith "Not implemented."
let formatter_of_symbolic_output_buffer _ =
failwith "Not implemented."
@END_BEFORE_4_06_0@
@BEGIN_BEFORE_4_03_0@
let kasprintf _ =
failwith "Not implemented."
@END_BEFORE_4_03_0@
@BEGIN_BEFORE_4_02_0@
let pp_print_list ?pp_sep pp_item formatter list =
match list with
| [] -> ()
| hd :: tl ->
pp_item formatter hd;
match tl with
| [] -> ()
| _ ->
List.iter (fun item ->
begin
match pp_sep with
| None -> ()
| Some pp_sep -> pp_sep formatter ()
end;
pp_item formatter item) tl
let pp_print_text formatter s =
Stdcompat__string.iter (fun c ->
match c with
| ' ' -> pp_print_space formatter ()
| '\n' -> pp_force_newline formatter ()
| _ -> pp_print_char formatter c) s
@END_BEFORE_4_02_0@
@BEGIN_BEFORE_4_12_0@
let rec pp_print_seq_cont pp_sep pp_item formatter (seq : _ Stdcompat__seq.t) =
match seq () with
| Stdcompat__seq.Nil -> ()
| Stdcompat__seq.Cons (hd, tl) ->
begin match pp_sep with
| None -> ()
| Some pp_sep -> pp_sep formatter ()
end;
pp_item formatter hd;
pp_print_seq_cont pp_sep pp_item formatter tl
let pp_print_seq ?pp_sep pp_item formatter (seq : _ Stdcompat__seq.t) =
match seq () with
| Stdcompat__seq.Nil -> ()
| Stdcompat__seq.Cons (hd, tl) ->
pp_item formatter hd;
pp_print_seq_cont pp_sep pp_item formatter tl
@END_BEFORE_4_12_0@
@BEGIN_BEFORE_3_12_0@
let ikfprintf _ =
failwith "Not implemented."
@END_BEFORE_3_12_0@
@BEGIN_BEFORE_3_10_0@
let ifprintf _ =
failwith "Not implemented."
@END_BEFORE_3_10_0@
@BEGIN_BEFORE_3_08_0@
let kfprintf _ =
failwith "Not implemented."
let ksprintf _ =
failwith "Not implemented."
@END_BEFORE_3_08_0@
@BEGIN_BEFORE_4_11_0@
let update_geometry _ =
failwith "Not implemented."
let pp_update_geometry _ =
failwith "Not implemented."
@END_BEFORE_4_11_0@
@BEGIN_BEFORE_4_13_0@
let pp_print_either ~left ~right fmt e =
match e with
| Stdcompat__either.Left l -> left fmt l
| Stdcompat__either.Right r -> right fmt r
let pp_print_bytes fmt bytes =
pp_print_string fmt (Stdcompat__bytes.unsafe_to_string bytes)
let print_bytes bytes =
pp_print_bytes std_formatter bytes
@END_BEFORE_4_13_0@