File: Format.html

package info (click to toggle)
ocaml-doc 4.11-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 20,580 kB
  • sloc: sh: 37; makefile: 11
file content (1795 lines) | stat: -rw-r--r-- 117,984 bytes parent folder | download
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="Float.html">
<link rel="next" href="Fun.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of extensions" rel=Appendix href="index_extensions.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Bool" rel="Chapter" href="Bool.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Ephemeron" rel="Chapter" href="Ephemeron.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Float" rel="Chapter" href="Float.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Fun" rel="Chapter" href="Fun.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int" rel="Chapter" href="Int.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Ocaml_operators" rel="Chapter" href="Ocaml_operators.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Result" rel="Chapter" href="Result.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Seq" rel="Chapter" href="Seq.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Spacetime" rel="Chapter" href="Spacetime.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Stdlib" rel="Chapter" href="Stdlib.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Uchar" rel="Chapter" href="Uchar.html">
<link title="Unit" rel="Chapter" href="Unit.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Introduction" rel="Section" href="#1_Introduction">
<link title="Pretty-printing boxes" rel="Section" href="#boxes">
<link title="Formatting functions" rel="Section" href="#1_Formattingfunctions">
<link title="Break hints" rel="Section" href="#breaks">
<link title="Pretty-printing termination" rel="Section" href="#1_Prettyprintingtermination">
<link title="Margin" rel="Section" href="#1_Margin">
<link title="Maximum indentation limit" rel="Section" href="#maxindent">
<link title="Geometry " rel="Section" href="#1_Geometry">
<link title="Maximum formatting depth" rel="Section" href="#1_Maximumformattingdepth">
<link title="Tabulation boxes" rel="Section" href="#1_Tabulationboxes">
<link title="Ellipsis" rel="Section" href="#1_Ellipsis">
<link title="Semantic tags" rel="Section" href="#tags">
<link title="Redefining formatter output" rel="Section" href="#meaning">
<link title="Redefining semantic tag operations" rel="Section" href="#tagsmeaning">
<link title="Defining formatters" rel="Section" href="#formatter">
<link title="Convenience formatting functions." rel="Section" href="#1_Convenienceformattingfunctions">
<link title="Formatted pretty-printing" rel="Section" href="#fpp">
<link title="Deprecated" rel="Section" href="#1_Deprecated">
<link title="Redefining output functions" rel="Subsection" href="#2_Redefiningoutputfunctions">
<link title="Symbolic pretty-printing" rel="Subsection" href="#symbolic">
<link title="String tags" rel="Subsection" href="#2_Stringtags">
<title>Format</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Float.html" title="Float">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Fun.html" title="Fun">Next</a>
</div>
<h1>Module <a href="type_Format.html">Format</a></h1>

<pre><span id="MODULEFormat"><span class="keyword">module</span> Format</span>: <code class="code"><span class="keyword">sig</span></code> <a href="Format.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
<div class="info-desc">
<p>Pretty-printing.</p>

<p>This module implements a pretty-printing facility to format values
   within <a href="Format.html#boxes">'pretty-printing boxes'</a> and <a href="Format.html#tags">'semantic tags'</a>
   combined with a set of <a href="Format.html#fpp">printf-like functions</a>.
   The pretty-printer splits lines at specified <a href="Format.html#breaks">break hints</a>,
   and indents lines according to the box structure.
   Similarly, <a href="Format.html#tags">semantic tags</a> can be used to decouple text
   presentation from its contents.</p>

<p>This pretty-printing facility is implemented as an overlay on top of
   abstract <a href="Format.html#formatter">formatters</a> which provide basic output
   functions.
   Some formatters are predefined, notably:</p>
<ul>
<li><a href="Format.html#VALstd_formatter"><code class="code"><span class="constructor">Format</span>.std_formatter</code></a> outputs to <a href="Stdlib.html#VALstdout">stdout</a></li>
<li><a href="Format.html#VALerr_formatter"><code class="code"><span class="constructor">Format</span>.err_formatter</code></a> outputs to <a href="Stdlib.html#VALstderr">stderr</a></li>
</ul>
<p>Most functions in the <a href="Format.html"><code class="code"><span class="constructor">Format</span></code></a> module come in two variants:
   a short version that operates on <a href="Format.html#VALstd_formatter"><code class="code"><span class="constructor">Format</span>.std_formatter</code></a> and the
   generic version prefixed by <code class="code">pp_</code> that takes a formatter
   as its first argument.</p>

<p>More formatters can be created with <a href="Format.html#VALformatter_of_out_channel"><code class="code"><span class="constructor">Format</span>.formatter_of_out_channel</code></a>,
   <a href="Format.html#VALformatter_of_buffer"><code class="code"><span class="constructor">Format</span>.formatter_of_buffer</code></a>, <a href="Format.html#VALformatter_of_symbolic_output_buffer"><code class="code"><span class="constructor">Format</span>.formatter_of_symbolic_output_buffer</code></a>
   or using <a href="Format.html#formatter">custom formatters</a>.</p>
</div>
</div>
<hr width="100%">
<h2 id="1_Introduction">Introduction</h2><p>For a gentle introduction to the basics of pretty-printing using
   <code class="code"><span class="constructor">Format</span></code>, read
   <a href="http://caml.inria.fr/resources/doc/guides/format.en.html">
    http://caml.inria.fr/resources/doc/guides/format.en.html</a>.</p>

<p>You may consider this module as providing an extension to the
   <code class="code">printf</code> facility to provide automatic line splitting. The addition of
   pretty-printing annotations to your regular <code class="code">printf</code> format strings gives
   you fancy indentation and line breaks.
   Pretty-printing annotations are described below in the documentation of
   the function <a href="Format.html#VALfprintf"><code class="code"><span class="constructor">Format</span>.fprintf</code></a>.</p>

<p>You may also use the explicit pretty-printing box management and printing
   functions provided by this module. This style is more basic but more
   verbose than the concise <code class="code">fprintf</code> format strings.</p>

<p>For instance, the sequence
   <code class="code">open_box&nbsp;0;&nbsp;print_string&nbsp;<span class="string">"x&nbsp;="</span>;&nbsp;print_space&nbsp;();<br>
&nbsp;&nbsp;&nbsp;&nbsp;print_int&nbsp;1;&nbsp;close_box&nbsp;();&nbsp;print_newline&nbsp;()</code>
   that prints <code class="code">x&nbsp;=&nbsp;1</code> within a pretty-printing box, can be
   abbreviated as <code class="code">printf&nbsp;<span class="string">"@[%s@&nbsp;%i@]@."</span>&nbsp;<span class="string">"x&nbsp;="</span>&nbsp;1</code>, or even shorter
   <code class="code">printf&nbsp;<span class="string">"@[x&nbsp;=@&nbsp;%i@]@."</span>&nbsp;1</code>.</p>

<p>Rule of thumb for casual users of this library:</p>
<ul>
<li>use simple pretty-printing boxes (as obtained by <code class="code">open_box&nbsp;0</code>);</li>
<li>use simple break hints as obtained by <code class="code">print_cut&nbsp;()</code> that outputs a
   simple break hint, or by <code class="code">print_space&nbsp;()</code> that outputs a space
   indicating a break hint;</li>
<li>once a pretty-printing box is open, display its material with basic
   printing functions (e. g. <code class="code">print_int</code> and <code class="code">print_string</code>);</li>
<li>when the material for a pretty-printing box has been printed, call
   <code class="code">close_box&nbsp;()</code> to close the box;</li>
<li>at the end of pretty-printing, flush the pretty-printer to display all
   the remaining material, e.g. evaluate <code class="code">print_newline&nbsp;()</code>.</li>
</ul>
<p>The behavior of pretty-printing commands is unspecified
   if there is no open pretty-printing box. Each box opened by
   one of the <code class="code">open_</code> functions below must be closed using <code class="code">close_box</code>
   for proper formatting. Otherwise, some of the material printed in the
   boxes may not be output, or may be formatted incorrectly.</p>

<p>In case of interactive use, each phrase is executed in the initial state
   of the standard pretty-printer: after each phrase execution, the
   interactive system closes all open pretty-printing boxes, flushes all
   pending text, and resets the standard pretty-printer.</p>

<p>Warning: mixing calls to pretty-printing functions of this module with
   calls to <a href="Stdlib.html"><code class="code"><span class="constructor">Stdlib</span></code></a> low level output functions is error prone.</p>

<p>The pretty-printing functions output material that is delayed in the
   pretty-printer queue and stacks in order to compute proper line
   splitting. In contrast, basic I/O output functions write directly in
   their output device. As a consequence, the output of a basic I/O function
   may appear before the output of a pretty-printing function that has been
   called before. For instance,
   <code class="code"><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="constructor">Stdlib</span>.print_string&nbsp;<span class="string">"&lt;"</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="constructor">Format</span>.print_string&nbsp;<span class="string">"PRETTY"</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="constructor">Stdlib</span>.print_string&nbsp;<span class="string">"&gt;"</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="constructor">Format</span>.print_string&nbsp;<span class="string">"TEXT"</span>;<br>
&nbsp;&nbsp;&nbsp;</code>
   leads to output <code class="code">&lt;&gt;<span class="constructor">PRETTYTEXT</span></code>.</p>

<pre><span id="TYPEformatter"><span class="keyword">type</span> <code class="type"></code>formatter</span> </pre>
<div class="info ">
<div class="info-desc">
<p>Abstract data corresponding to a pretty-printer (also called a
    formatter) and all its machinery. See also <a href="Format.html#formatter"><i>Defining formatters</i></a>.</p>
</div>
</div>

<h2 id="boxes">Pretty-printing boxes</h2><p>The pretty-printing engine uses the concepts of pretty-printing box and
  break hint to drive indentation and line splitting behavior of the
  pretty-printer.</p>

<p>Each different pretty-printing box kind introduces a specific line splitting
  policy:</p>

<ul>
<li>within an <em>horizontal</em> box, break hints never split the line (but the
    line may be split in a box nested deeper),</li>
<li>within a <em>vertical</em> box, break hints always split the line,</li>
<li>within an <em>horizontal/vertical</em> box, if the box fits on the current line
    then break hints never split the line, otherwise break hint always split
    the line,</li>
<li>within a <em>compacting</em> box, a break hint never splits the line,
    unless there is no more room on the current line.</li>
</ul>
<p>Note that line splitting policy is box specific: the policy of a box does
  not rule the policy of inner boxes. For instance, if a vertical box is
  nested in an horizontal box, all break hints within the vertical box will
  split the line.</p>

<p>Moreover, opening a box after the <a href="Format.html#maxindent">maximum indentation limit</a>
  splits the line whether or not the box would end up fitting on the line.</p>

<pre><span id="VALpp_open_box"><span class="keyword">val</span> pp_open_box</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALopen_box"><span class="keyword">val</span> open_box</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_open_box&nbsp;ppf&nbsp;d</code> opens a new compacting pretty-printing box with
    offset <code class="code">d</code> in the formatter <code class="code">ppf</code>.</p>

<p>Within this box, the pretty-printer prints as much as possible material on
   every line.</p>

<p>A break hint splits the line if there is no more room on the line to
   print the remainder of the box.</p>

<p>Within this box, the pretty-printer emphasizes the box structure:
   if a structural box does not fit fully on a simple line, a break
   hint also splits the line if the splitting ``moves to the left''
   (i.e. the new line gets an indentation smaller than the one of the current
   line).</p>

<p>This box is the general purpose pretty-printing box.</p>

<p>If the pretty-printer splits the line in the box, offset <code class="code">d</code> is added to
   the current indentation.</p>
</div>
</div>

<pre><span id="VALpp_close_box"><span class="keyword">val</span> pp_close_box</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALclose_box"><span class="keyword">val</span> close_box</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Closes the most recently open pretty-printing box.</p>
</div>
</div>

<pre><span id="VALpp_open_hbox"><span class="keyword">val</span> pp_open_hbox</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALopen_hbox"><span class="keyword">val</span> open_hbox</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_open_hbox&nbsp;ppf&nbsp;()</code> opens a new 'horizontal' pretty-printing box.</p>

<p>This box prints material on a single line.</p>

<p>Break hints in a horizontal box never split the line.
  (Line splitting may still occur inside boxes nested deeper).</p>
</div>
</div>

<pre><span id="VALpp_open_vbox"><span class="keyword">val</span> pp_open_vbox</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALopen_vbox"><span class="keyword">val</span> open_vbox</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_open_vbox&nbsp;ppf&nbsp;d</code> opens a new 'vertical' pretty-printing box
  with offset <code class="code">d</code>.</p>

<p>This box prints material on as many lines as break hints in the box.</p>

<p>Every break hint in a vertical box splits the line.</p>

<p>If the pretty-printer splits the line in the box, <code class="code">d</code> is added to the
  current indentation.</p>
</div>
</div>

<pre><span id="VALpp_open_hvbox"><span class="keyword">val</span> pp_open_hvbox</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALopen_hvbox"><span class="keyword">val</span> open_hvbox</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_open_hvbox&nbsp;ppf&nbsp;d</code> opens a new 'horizontal/vertical' pretty-printing box
  with offset <code class="code">d</code>.</p>

<p>This box behaves as an horizontal box if it fits on a single line,
  otherwise it behaves as a vertical box.</p>

<p>If the pretty-printer splits the line in the box, <code class="code">d</code> is added to the
  current indentation.</p>
</div>
</div>

<pre><span id="VALpp_open_hovbox"><span class="keyword">val</span> pp_open_hovbox</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALopen_hovbox"><span class="keyword">val</span> open_hovbox</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_open_hovbox&nbsp;ppf&nbsp;d</code> opens a new 'horizontal-or-vertical'
  pretty-printing box with offset <code class="code">d</code>.</p>

<p>This box prints material as much as possible on every line.</p>

<p>A break hint splits the line if there is no more room on the line to
  print the remainder of the box.</p>

<p>If the pretty-printer splits the line in the box, <code class="code">d</code> is added to the
  current indentation.</p>
</div>
</div>
<h2 id="1_Formattingfunctions">Formatting functions</h2>
<pre><span id="VALpp_print_string"><span class="keyword">val</span> pp_print_string</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> string -> unit</code></pre>
<pre><span id="VALprint_string"><span class="keyword">val</span> print_string</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_string&nbsp;ppf&nbsp;s</code> prints <code class="code">s</code> in the current pretty-printing box.</p>
</div>
</div>

<pre><span id="VALpp_print_as"><span class="keyword">val</span> pp_print_as</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> string -> unit</code></pre>
<pre><span id="VALprint_as"><span class="keyword">val</span> print_as</span> : <code class="type">int -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_as&nbsp;ppf&nbsp;len&nbsp;s</code> prints <code class="code">s</code> in the current pretty-printing box.
  The pretty-printer formats <code class="code">s</code> as if it were of length <code class="code">len</code>.</p>
</div>
</div>

<pre><span id="VALpp_print_int"><span class="keyword">val</span> pp_print_int</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALprint_int"><span class="keyword">val</span> print_int</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print an integer in the current pretty-printing box.</p>
</div>
</div>

<pre><span id="VALpp_print_float"><span class="keyword">val</span> pp_print_float</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> float -> unit</code></pre>
<pre><span id="VALprint_float"><span class="keyword">val</span> print_float</span> : <code class="type">float -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a floating point number in the current pretty-printing box.</p>
</div>
</div>

<pre><span id="VALpp_print_char"><span class="keyword">val</span> pp_print_char</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> char -> unit</code></pre>
<pre><span id="VALprint_char"><span class="keyword">val</span> print_char</span> : <code class="type">char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a character in the current pretty-printing box.</p>
</div>
</div>

<pre><span id="VALpp_print_bool"><span class="keyword">val</span> pp_print_bool</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> bool -> unit</code></pre>
<pre><span id="VALprint_bool"><span class="keyword">val</span> print_bool</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Print a boolean in the current pretty-printing box.</p>
</div>
</div>
<h2 id="breaks">Break hints</h2><p>A 'break hint' tells the pretty-printer to output some space or split the
  line whichever way is more appropriate to the current pretty-printing box
  splitting rules.</p>

<p>Break hints are used to separate printing items and are mandatory to let
  the pretty-printer correctly split lines and indent items.</p>

<p>Simple break hints are:</p>
<ul>
<li>the 'space': output a space or split the line if appropriate,</li>
<li>the 'cut': split the line if appropriate.</li>
</ul>
<p>Note: the notions of space and line splitting are abstract for the
  pretty-printing engine, since those notions can be completely redefined
  by the programmer.
  However, in the pretty-printer default setting, ``output a space'' simply
  means printing a space character (ASCII code 32) and ``split the line''
  means printing a newline character (ASCII code 10).</p>

<pre><span id="VALpp_print_space"><span class="keyword">val</span> pp_print_space</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALprint_space"><span class="keyword">val</span> print_space</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_space&nbsp;ppf&nbsp;()</code> emits a 'space' break hint:
  the pretty-printer may split the line at this point,
  otherwise it prints one space.</p>

<p><code class="code">pp_print_space&nbsp;ppf&nbsp;()</code> is equivalent to <code class="code">pp_print_break&nbsp;ppf&nbsp;1&nbsp;0</code>.</p>
</div>
</div>

<pre><span id="VALpp_print_cut"><span class="keyword">val</span> pp_print_cut</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALprint_cut"><span class="keyword">val</span> print_cut</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_cut&nbsp;ppf&nbsp;()</code> emits a 'cut' break hint:
  the pretty-printer may split the line at this point,
  otherwise it prints nothing.</p>

<p><code class="code">pp_print_cut&nbsp;ppf&nbsp;()</code> is equivalent to <code class="code">pp_print_break&nbsp;ppf&nbsp;0&nbsp;0</code>.</p>
</div>
</div>

<pre><span id="VALpp_print_break"><span class="keyword">val</span> pp_print_break</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> int -> unit</code></pre>
<pre><span id="VALprint_break"><span class="keyword">val</span> print_break</span> : <code class="type">int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_break&nbsp;ppf&nbsp;nspaces&nbsp;offset</code> emits a 'full' break hint:
  the pretty-printer may split the line at this point,
  otherwise it prints <code class="code">nspaces</code> spaces.</p>

<p>If the pretty-printer splits the line, <code class="code">offset</code> is added to
  the current indentation.</p>
</div>
</div>

<pre><span id="VALpp_print_custom_break"><span class="keyword">val</span> pp_print_custom_break</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -><br>       fits:string * int * string -> breaks:string * int * string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_custom_break&nbsp;ppf&nbsp;~fits:(s1,&nbsp;n,&nbsp;s2)&nbsp;~breaks:(s3,&nbsp;m,&nbsp;s4)</code> emits a
   custom break hint: the pretty-printer may split the line at this point.</p>

<p>If it does not split the line, then the <code class="code">s1</code> is emitted, then <code class="code">n</code> spaces,
   then <code class="code">s2</code>.</p>

<p>If it splits the line, then it emits the <code class="code">s3</code> string, then an indent
   (according to the box rules), then an offset of <code class="code">m</code> spaces, then the <code class="code">s4</code>
   string.</p>

<p>While <code class="code">n</code> and <code class="code">m</code> are handled by <code class="code">formatter_out_functions.out_indent</code>, the
   strings will be handled by <code class="code">formatter_out_functions.out_string</code>. This allows
   for a custom formatter that handles indentation distinctly, for example,
   outputs <code class="code">&lt;br/&gt;</code> tags or <code class="code"><span class="keywordsign">&amp;</span>nbsp;</code> entities.</p>

<p>The custom break is useful if you want to change which visible
   (non-whitespace) characters are printed in case of break or no break. For
   example, when printing a list</p>
<pre class="codepre"><code class="code"> [a; b; c] </code></pre><p>, you might want to add a
   trailing semicolon when it is printed vertically:</p>

<pre class="codepre"><code class="code">[
  a;
  b;
  c;
]
   </code></pre>
<p>You can do this as follows:</p>
<pre class="codepre"><code class="code">printf <span class="string">"@[&lt;v 0&gt;[@;&lt;0 2&gt;@[&lt;v 0&gt;a;@,b;@,c@]%t]@]@\n"</span>
  (pp_print_custom_break ~fits:(<span class="string">""</span>, 0, <span class="string">""</span>) ~breaks:(<span class="string">";"</span>, 0, <span class="string">""</span>))
   </code></pre></div>
<ul class="info-attributes">
<li><b>Since</b> 4.08.0</li>
</ul>
</div>

<pre><span id="VALpp_force_newline"><span class="keyword">val</span> pp_force_newline</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALforce_newline"><span class="keyword">val</span> force_newline</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Force a new line in the current pretty-printing box.</p>

<p>The pretty-printer must split the line at this point,</p>

<p>Not the normal way of pretty-printing, since imperative line splitting may
  interfere with current line counters and box size calculation.
  Using break hints within an enclosing vertical box is a better
  alternative.</p>
</div>
</div>

<pre><span id="VALpp_print_if_newline"><span class="keyword">val</span> pp_print_if_newline</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALprint_if_newline"><span class="keyword">val</span> print_if_newline</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Execute the next formatting command if the preceding line
  has just been split. Otherwise, ignore the next formatting
  command.</p>
</div>
</div>
<h2 id="1_Prettyprintingtermination">Pretty-printing termination</h2>
<pre><span id="VALpp_print_flush"><span class="keyword">val</span> pp_print_flush</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALprint_flush"><span class="keyword">val</span> print_flush</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>End of pretty-printing: resets the pretty-printer to initial state.</p>

<p>All open pretty-printing boxes are closed, all pending text is printed.
  In addition, the pretty-printer low level output device is flushed to
  ensure that all pending text is really displayed.</p>

<p>Note: never use <code class="code">print_flush</code> in the normal course of a pretty-printing
  routine, since the pretty-printer uses a complex buffering machinery to
  properly indent the output; manually flushing those buffers at random
  would conflict with the pretty-printer strategy and result to poor
  rendering.</p>

<p>Only consider using <code class="code">print_flush</code> when displaying all pending material is
  mandatory (for instance in case of interactive use when you want the user
  to read some text) and when resetting the pretty-printer state will not
  disturb further pretty-printing.</p>

<p>Warning: If the output device of the pretty-printer is an output channel,
  repeated calls to <code class="code">print_flush</code> means repeated calls to <a href="Stdlib.html#VALflush"><code class="code">flush</code></a>
  to flush the out channel; these explicit flush calls could foil the
  buffering strategy of output channels and could dramatically impact
  efficiency.</p>
</div>
</div>

<pre><span id="VALpp_print_newline"><span class="keyword">val</span> pp_print_newline</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALprint_newline"><span class="keyword">val</span> print_newline</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>End of pretty-printing: resets the pretty-printer to initial state.</p>

<p>All open pretty-printing boxes are closed, all pending text is printed.</p>

<p>Equivalent to <a href="Format.html#VALprint_flush"><code class="code"><span class="constructor">Format</span>.print_flush</code></a> followed by a new line.
  See corresponding words of caution for <a href="Format.html#VALprint_flush"><code class="code"><span class="constructor">Format</span>.print_flush</code></a>.</p>

<p>Note: this is not the normal way to output a new line;
  the preferred method is using break hints within a vertical pretty-printing
  box.</p>
</div>
</div>
<h2 id="1_Margin">Margin</h2>
<pre><span id="VALpp_set_margin"><span class="keyword">val</span> pp_set_margin</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALset_margin"><span class="keyword">val</span> set_margin</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_margin&nbsp;ppf&nbsp;d</code> sets the right margin to <code class="code">d</code> (in characters):
  the pretty-printer splits lines that overflow the right margin according to
  the break hints given.
  Setting the margin to <code class="code">d</code> means that the formatting engine aims at
  printing at most <code class="code">d-1</code> characters per line.
  Nothing happens if <code class="code">d</code> is smaller than 2.
  If <code class="code">d</code> is too large, the right margin is set to the maximum
  admissible value (which is greater than <code class="code">10&nbsp;^&nbsp;9</code>).
  If <code class="code">d</code> is less than the current maximum indentation limit, the
  maximum indentation limit is decreased while trying to preserve
  a minimal ratio <code class="code">max_indent/margin&gt;=50%</code> and if possible
  the current difference <code class="code">margin&nbsp;-&nbsp;max_indent</code>.</p>

<p>See also <a href="Format.html#VALpp_set_geometry"><code class="code"><span class="constructor">Format</span>.pp_set_geometry</code></a>.</p>
</div>
</div>

<pre><span id="VALpp_get_margin"><span class="keyword">val</span> pp_get_margin</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> int</code></pre>
<pre><span id="VALget_margin"><span class="keyword">val</span> get_margin</span> : <code class="type">unit -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the position of the right margin.</p>
</div>
</div>
<h2 id="maxindent">Maximum indentation limit</h2>
<pre><span id="VALpp_set_max_indent"><span class="keyword">val</span> pp_set_max_indent</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALset_max_indent"><span class="keyword">val</span> set_max_indent</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_max_indent&nbsp;ppf&nbsp;d</code> sets the maximum indentation limit of lines
  to <code class="code">d</code> (in characters):
  once this limit is reached, new pretty-printing boxes are rejected to the
  left, unless the enclosing box fully fits on the current line.
  As an illustration,</p>
<pre class="codepre"><code class="code"> set_margin 10; set_max_indent 5; printf <span class="string">"@[123456@[7@]89A@]@."</span> </code></pre><p>yields</p>
<pre class="codepre"><code class="code">    123456
    789<span class="constructor">A</span>
  </code></pre><p>because the nested box <code class="code"><span class="string">"@[7@]"</span></code> is opened after the maximum indentation
  limit (<code class="code">7&gt;5</code>) and its parent box does not fit on the current line.
  Either decreasing the length of the parent box to make it fit on a line:</p>
<pre class="codepre"><code class="code"> printf <span class="string">"@[123456@[7@]89@]@."</span> </code></pre><p>or opening an intermediary box before the maximum indentation limit which
  fits on the current line</p>
<pre class="codepre"><code class="code"> printf <span class="string">"@[123@[456@[7@]89@]A@]@."</span> </code></pre><p>avoids the rejection to the left of the inner boxes and print respectively
  <code class="code"><span class="string">"123456789"</span></code> and <code class="code"><span class="string">"123456789A"</span></code> .
  Note also that vertical boxes never fit on a line whereas horizontal boxes
  always fully fit on the current line.
  Opening a box may split a line whereas the contents may have fit.
  If this behavior is problematic, it can be curtailed by setting the maximum
  indentation limit to <code class="code">margin&nbsp;-&nbsp;1</code>. Note that setting the maximum indentation
  limit to <code class="code">margin</code> is invalid.</p>

<p>Nothing happens if <code class="code">d</code> is smaller than 2.</p>

<p>If <code class="code">d</code> is too large, the limit is set to the maximum
  admissible value (which is greater than <code class="code">10&nbsp;^&nbsp;9</code>).</p>

<p>If <code class="code">d</code> is greater or equal than the current margin, it is ignored,
  and the current maximum indentation limit is kept.</p>

<p>See also <a href="Format.html#VALpp_set_geometry"><code class="code"><span class="constructor">Format</span>.pp_set_geometry</code></a>.</p>
</div>
</div>

<pre><span id="VALpp_get_max_indent"><span class="keyword">val</span> pp_get_max_indent</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> int</code></pre>
<pre><span id="VALget_max_indent"><span class="keyword">val</span> get_max_indent</span> : <code class="type">unit -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the maximum indentation limit (in characters).</p>
</div>
</div>
<h2 id="1_Geometry">Geometry </h2>
<p>Geometric functions can be used to manipulate simultaneously the
coupled variables, margin and maxixum indentation limit.</p>

<pre><code><span id="TYPEgeometry"><span class="keyword">type</span> <code class="type"></code>geometry</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgeometry.max_indent">max_indent</span>&nbsp;: <code class="type">int</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTgeometry.margin">margin</span>&nbsp;: <code class="type">int</code>;</code></td>

</tr></table>
<code>}</code>



<pre><span id="VALcheck_geometry"><span class="keyword">val</span> check_geometry</span> : <code class="type"><a href="Format.html#TYPEgeometry">geometry</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Check if the formatter geometry is valid: <code class="code">1&nbsp;&lt;&nbsp;max_indent&nbsp;&lt;&nbsp;margin</code></p>
</div>
</div>

<pre><span id="VALpp_set_geometry"><span class="keyword">val</span> pp_set_geometry</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> max_indent:int -> margin:int -> unit</code></pre>
<pre><span id="VALset_geometry"><span class="keyword">val</span> set_geometry</span> : <code class="type">max_indent:int -> margin:int -> unit</code></pre>
<pre><span id="VALpp_safe_set_geometry"><span class="keyword">val</span> pp_safe_set_geometry</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> max_indent:int -> margin:int -> unit</code></pre>
<pre><span id="VALsafe_set_geometry"><span class="keyword">val</span> safe_set_geometry</span> : <code class="type">max_indent:int -> margin:int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_geometry&nbsp;ppf&nbsp;~max_indent&nbsp;~margin</code> sets both the margin
   and maximum indentation limit for <code class="code">ppf</code>.</p>

<p>When <code class="code">1&nbsp;&lt;&nbsp;max_indent&nbsp;&lt;&nbsp;margin</code>,
   <code class="code">pp_set_geometry&nbsp;ppf&nbsp;~max_indent&nbsp;~margin</code>
   is equivalent to
   <code class="code">pp_set_margin&nbsp;ppf&nbsp;margin;&nbsp;pp_set_max_indent&nbsp;ppf&nbsp;max_indent</code>;
   and avoids the subtly incorrect
   <code class="code">pp_set_max_indent&nbsp;ppf&nbsp;max_indent;&nbsp;pp_set_margin&nbsp;ppf&nbsp;margin</code>;</p>

<p>Outside of this domain, <code class="code">pp_set_geometry</code> raises an invalid argument
   exception whereas <code class="code">pp_safe_set_geometry</code> does nothing.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08.0</li>
</ul>
</div>

<pre><span id="VALpp_update_geometry"><span class="keyword">val</span> pp_update_geometry</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> (<a href="Format.html#TYPEgeometry">geometry</a> -> <a href="Format.html#TYPEgeometry">geometry</a>) -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_update_geometry&nbsp;ppf&nbsp;(<span class="keyword">fun</span>&nbsp;geo&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;{&nbsp;geo&nbsp;<span class="keyword">with</span>&nbsp;...&nbsp;})</code> lets you
   update a formatter's geometry in a way that is robust to extension
   of the <code class="code">geometry</code> record with new fields.</p>

<p>Raises an invalid argument exception if the returned geometry
   does not satisfy <a href="Format.html#VALcheck_geometry"><code class="code"><span class="constructor">Format</span>.check_geometry</code></a>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.11.0</li>
</ul>
</div>

<pre><span id="VALupdate_geometry"><span class="keyword">val</span> update_geometry</span> : <code class="type">(<a href="Format.html#TYPEgeometry">geometry</a> -> <a href="Format.html#TYPEgeometry">geometry</a>) -> unit</code></pre>
<pre><span id="VALpp_get_geometry"><span class="keyword">val</span> pp_get_geometry</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> <a href="Format.html#TYPEgeometry">geometry</a></code></pre>
<pre><span id="VALget_geometry"><span class="keyword">val</span> get_geometry</span> : <code class="type">unit -> <a href="Format.html#TYPEgeometry">geometry</a></code></pre><div class="info ">
<div class="info-desc">
<p>Return the current geometry of the formatter</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08.0</li>
</ul>
</div>
<h2 id="1_Maximumformattingdepth">Maximum formatting depth</h2><p>The maximum formatting depth is the maximum number of pretty-printing
  boxes simultaneously open.</p>

<p>Material inside boxes nested deeper is printed as an ellipsis (more
  precisely as the text returned by <a href="Format.html#VALget_ellipsis_text"><code class="code"><span class="constructor">Format</span>.get_ellipsis_text</code></a> <code class="code">()</code>).</p>

<pre><span id="VALpp_set_max_boxes"><span class="keyword">val</span> pp_set_max_boxes</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> unit</code></pre>
<pre><span id="VALset_max_boxes"><span class="keyword">val</span> set_max_boxes</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_max_boxes&nbsp;ppf&nbsp;max</code> sets the maximum number of pretty-printing
    boxes simultaneously open.</p>

<p>Material inside boxes nested deeper is printed as an ellipsis (more
  precisely as the text returned by <a href="Format.html#VALget_ellipsis_text"><code class="code"><span class="constructor">Format</span>.get_ellipsis_text</code></a> <code class="code">()</code>).</p>

<p>Nothing happens if <code class="code">max</code> is smaller than 2.</p>
</div>
</div>

<pre><span id="VALpp_get_max_boxes"><span class="keyword">val</span> pp_get_max_boxes</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> int</code></pre>
<pre><span id="VALget_max_boxes"><span class="keyword">val</span> get_max_boxes</span> : <code class="type">unit -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the maximum number of pretty-printing boxes allowed before
  ellipsis.</p>
</div>
</div>

<pre><span id="VALpp_over_max_boxes"><span class="keyword">val</span> pp_over_max_boxes</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> bool</code></pre>
<pre><span id="VALover_max_boxes"><span class="keyword">val</span> over_max_boxes</span> : <code class="type">unit -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Tests if the maximum number of pretty-printing boxes allowed have already
  been opened.</p>
</div>
</div>
<h2 id="1_Tabulationboxes">Tabulation boxes</h2><p>A <em>tabulation box</em> prints material on lines divided into cells of fixed
  length. A tabulation box provides a simple way to display vertical columns
  of left adjusted text.</p>

<p>This box features command <code class="code">set_tab</code> to define cell boundaries, and command
  <code class="code">print_tab</code> to move from cell to cell and split the line when there is no
  more cells to print on the line.</p>

<p>Note: printing within tabulation box is line directed, so arbitrary line
  splitting inside a tabulation box leads to poor rendering. Yet, controlled
  use of tabulation boxes allows simple printing of columns within
  module <a href="Format.html"><code class="code"><span class="constructor">Format</span></code></a>.</p>

<pre><span id="VALpp_open_tbox"><span class="keyword">val</span> pp_open_tbox</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALopen_tbox"><span class="keyword">val</span> open_tbox</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">open_tbox&nbsp;()</code> opens a new tabulation box.</p>

<p>This box prints lines separated into cells of fixed width.</p>

<p>Inside a tabulation box, special <em>tabulation markers</em> defines points of
  interest on the line (for instance to delimit cell boundaries).
  Function <a href="Format.html#VALset_tab"><code class="code"><span class="constructor">Format</span>.set_tab</code></a> sets a tabulation marker at insertion point.</p>

<p>A tabulation box features specific <em>tabulation breaks</em> to move to next
  tabulation marker or split the line. Function <a href="Format.html#VALprint_tbreak"><code class="code"><span class="constructor">Format</span>.print_tbreak</code></a> prints
  a tabulation break.</p>
</div>
</div>

<pre><span id="VALpp_close_tbox"><span class="keyword">val</span> pp_close_tbox</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALclose_tbox"><span class="keyword">val</span> close_tbox</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Closes the most recently opened tabulation box.</p>
</div>
</div>

<pre><span id="VALpp_set_tab"><span class="keyword">val</span> pp_set_tab</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALset_tab"><span class="keyword">val</span> set_tab</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets a tabulation marker at current insertion point.</p>
</div>
</div>

<pre><span id="VALpp_print_tab"><span class="keyword">val</span> pp_print_tab</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALprint_tab"><span class="keyword">val</span> print_tab</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">print_tab&nbsp;()</code> emits a 'next' tabulation break hint: if not already set on
  a tabulation marker, the insertion point moves to the first tabulation
  marker on the right, or the pretty-printer splits the line and insertion
  point moves to the leftmost tabulation marker.</p>

<p>It is equivalent to <code class="code">print_tbreak&nbsp;0&nbsp;0</code>.</p>
</div>
</div>

<pre><span id="VALpp_print_tbreak"><span class="keyword">val</span> pp_print_tbreak</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> int -> int -> unit</code></pre>
<pre><span id="VALprint_tbreak"><span class="keyword">val</span> print_tbreak</span> : <code class="type">int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">print_tbreak&nbsp;nspaces&nbsp;offset</code> emits a 'full' tabulation break hint.</p>

<p>If not already set on a tabulation marker, the insertion point moves to the
  first tabulation marker on the right and the pretty-printer prints
  <code class="code">nspaces</code> spaces.</p>

<p>If there is no next tabulation marker on the right, the pretty-printer
  splits the line at this point, then insertion point moves to the leftmost
  tabulation marker of the box.</p>

<p>If the pretty-printer splits the line, <code class="code">offset</code> is added to
  the current indentation.</p>
</div>
</div>
<h2 id="1_Ellipsis">Ellipsis</h2>
<pre><span id="VALpp_set_ellipsis_text"><span class="keyword">val</span> pp_set_ellipsis_text</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> string -> unit</code></pre>
<pre><span id="VALset_ellipsis_text"><span class="keyword">val</span> set_ellipsis_text</span> : <code class="type">string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Set the text of the ellipsis printed when too many pretty-printing boxes
  are open (a single dot, <code class="code">.</code>, by default).</p>
</div>
</div>

<pre><span id="VALpp_get_ellipsis_text"><span class="keyword">val</span> pp_get_ellipsis_text</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> string</code></pre>
<pre><span id="VALget_ellipsis_text"><span class="keyword">val</span> get_ellipsis_text</span> : <code class="type">unit -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return the text of the ellipsis.</p>
</div>
</div>
<h2 id="tags">Semantic tags</h2>
<pre><span id="TYPEstag"><span class="keyword">type</span> <code class="type"></code>stag</span> = ..</pre>
<div class="info ">
<div class="info-desc">
<p><i>Semantic tags</i> (or simply <em>tags</em>) are user's defined annotations
  to associate user's specific operations to printed entities.</p>

<p>Common usage of semantic tags is text decoration to get specific font or
  text size rendering for a display device, or marking delimitation of
  entities (e.g. HTML or TeX elements or terminal escape sequences).
  More sophisticated usage of semantic tags could handle dynamic
  modification of the pretty-printer behavior to properly print the material
  within some specific tags.
  For instance, we can define an RGB tag like so:</p>
<pre class="codepre"><code class="code"><span class="keyword">type</span> stag += <span class="constructor">RGB</span> <span class="keyword">of</span> {r:int;g:int;b:int}
</code></pre>
<p>In order to properly delimit printed entities, a semantic tag must be
  opened before and closed after the entity. Semantic tags must be properly
  nested like parentheses using <a href="Format.html#VALpp_open_stag"><code class="code"><span class="constructor">Format</span>.pp_open_stag</code></a> and <a href="Format.html#VALpp_close_stag"><code class="code"><span class="constructor">Format</span>.pp_close_stag</code></a>.</p>

<p>Tag specific operations occur any time a tag is opened or closed, At each
  occurrence, two kinds of operations are performed <em>tag-marking</em> and
  <em>tag-printing</em>:</p>
<ul>
<li>The tag-marking operation is the simpler tag specific operation: it simply
  writes a tag specific string into the output device of the
  formatter. Tag-marking does not interfere with line-splitting computation.</li>
<li>The tag-printing operation is the more involved tag specific operation: it
  can print arbitrary material to the formatter. Tag-printing is tightly
  linked to the current pretty-printer operations.</li>
</ul>
<p>Roughly speaking, tag-marking is commonly used to get a better rendering of
  texts in the rendering device, while tag-printing allows fine tuning of
  printing routines to print the same entity differently according to the
  semantic tags (i.e. print additional material or even omit parts of the
  output).</p>

<p>More precisely: when a semantic tag is opened or closed then both and
  successive 'tag-printing' and 'tag-marking' operations occur:</p>
<ul>
<li>Tag-printing a semantic tag means calling the formatter specific function
  <code class="code">print_open_stag</code> (resp. <code class="code">print_close_stag</code>) with the name of the tag as
  argument: that tag-printing function can then print any regular material
  to the formatter (so that this material is enqueued as usual in the
  formatter queue for further line splitting computation).</li>
<li>Tag-marking a semantic tag means calling the formatter specific function
  <code class="code">mark_open_stag</code> (resp. <code class="code">mark_close_stag</code>) with the name of the tag as
  argument: that tag-marking function can then return the 'tag-opening
  marker' (resp. `tag-closing marker') for direct output into the output
  device of the formatter.</li>
</ul>
<p>Being written directly into the output device of the formatter, semantic
  tag marker strings are not considered as part of the printing material that
  drives line splitting (in other words, the length of the strings
  corresponding to tag markers is considered as zero for line splitting).</p>

<p>Thus, semantic tag handling is in some sense transparent to pretty-printing
  and does not interfere with usual indentation. Hence, a single
  pretty-printing routine can output both simple 'verbatim' material or
  richer decorated output depending on the treatment of tags. By default,
  tags are not active, hence the output is not decorated with tag
  information. Once <code class="code">set_tags</code> is set to <code class="code"><span class="keyword">true</span></code>, the pretty-printer engine
  honors tags and decorates the output accordingly.</p>

<p>Default tag-marking functions behave the HTML way: <a href="Format.html#TYPEtag">string tags</a> are
  enclosed in "&lt;" and "&gt;" while other tags are ignored;
  hence, opening marker for tag string <code class="code"><span class="string">"t"</span></code> is <code class="code"><span class="string">"&lt;t&gt;"</span></code> and closing marker
  is <code class="code"><span class="string">"&lt;/t&gt;"</span></code>.</p>

<p>Default tag-printing functions just do nothing.</p>

<p>Tag-marking and tag-printing functions are user definable and can
  be set by calling <a href="Format.html#VALset_formatter_stag_functions"><code class="code"><span class="constructor">Format</span>.set_formatter_stag_functions</code></a>.</p>

<p>Semantic tag operations may be set on or off with <a href="Format.html#VALset_tags"><code class="code"><span class="constructor">Format</span>.set_tags</code></a>.
  Tag-marking operations may be set on or off with <a href="Format.html#VALset_mark_tags"><code class="code"><span class="constructor">Format</span>.set_mark_tags</code></a>.
  Tag-printing operations may be set on or off with <a href="Format.html#VALset_print_tags"><code class="code"><span class="constructor">Format</span>.set_print_tags</code></a>.</p>
</div>
</div>


<pre><span id="TYPEtag"><span class="keyword">type</span> <code class="type"></code>tag</span> = <code class="type">string</code> </pre>

<pre><code><span class="keyword">type</span> <code class="type"></code><a href="Format.html#TYPEstag">stag</a> += </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="EXTENSIONString_tag">String_tag</span> <span class="keyword">of</span> <code class="type"><a href="Format.html#TYPEtag">tag</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">String_tag</span>&nbsp;s</code> is a string tag <code class="code">s</code>. String tags can be inserted either
    by explicitly using the constructor <code class="code"><span class="constructor">String_tag</span></code> or by using the dedicated
    format syntax <code class="code"><span class="string">"@{&lt;s&gt;&nbsp;...&nbsp;@}"</span></code>.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>



<pre><span id="VALpp_open_stag"><span class="keyword">val</span> pp_open_stag</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> <a href="Format.html#TYPEstag">stag</a> -> unit</code></pre>
<pre><span id="VALopen_stag"><span class="keyword">val</span> open_stag</span> : <code class="type"><a href="Format.html#TYPEstag">stag</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_open_stag&nbsp;ppf&nbsp;t</code> opens the semantic tag named <code class="code">t</code>.</p>

<p>The <code class="code">print_open_stag</code> tag-printing function of the formatter is called with
  <code class="code">t</code> as argument; then the opening tag marker for <code class="code">t</code>, as given by
  <code class="code">mark_open_stag&nbsp;t</code>, is written into the output device of the formatter.</p>
</div>
</div>

<pre><span id="VALpp_close_stag"><span class="keyword">val</span> pp_close_stag</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre>
<pre><span id="VALclose_stag"><span class="keyword">val</span> close_stag</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_close_stag&nbsp;ppf&nbsp;()</code> closes the most recently opened semantic tag <code class="code">t</code>.</p>

<p>The closing tag marker, as given by <code class="code">mark_close_stag&nbsp;t</code>, is written into the
  output device of the formatter; then the <code class="code">print_close_stag</code> tag-printing
  function of the formatter is called with <code class="code">t</code> as argument.</p>
</div>
</div>

<pre><span id="VALpp_set_tags"><span class="keyword">val</span> pp_set_tags</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> bool -> unit</code></pre>
<pre><span id="VALset_tags"><span class="keyword">val</span> set_tags</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_tags&nbsp;ppf&nbsp;b</code> turns on or off the treatment of semantic tags
  (default is off).</p>
</div>
</div>

<pre><span id="VALpp_set_print_tags"><span class="keyword">val</span> pp_set_print_tags</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> bool -> unit</code></pre>
<pre><span id="VALset_print_tags"><span class="keyword">val</span> set_print_tags</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_print_tags&nbsp;ppf&nbsp;b</code> turns on or off the tag-printing operations.</p>
</div>
</div>

<pre><span id="VALpp_set_mark_tags"><span class="keyword">val</span> pp_set_mark_tags</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> bool -> unit</code></pre>
<pre><span id="VALset_mark_tags"><span class="keyword">val</span> set_mark_tags</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_mark_tags&nbsp;ppf&nbsp;b</code> turns on or off the tag-marking operations.</p>
</div>
</div>

<pre><span id="VALpp_get_print_tags"><span class="keyword">val</span> pp_get_print_tags</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> bool</code></pre>
<pre><span id="VALget_print_tags"><span class="keyword">val</span> get_print_tags</span> : <code class="type">unit -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current status of tag-printing operations.</p>
</div>
</div>

<pre><span id="VALpp_get_mark_tags"><span class="keyword">val</span> pp_get_mark_tags</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> bool</code></pre>
<pre><span id="VALget_mark_tags"><span class="keyword">val</span> get_mark_tags</span> : <code class="type">unit -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current status of tag-marking operations.</p>
</div>
</div>

<pre><span id="VALpp_set_formatter_out_channel"><span class="keyword">val</span> pp_set_formatter_out_channel</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> <a href="Stdlib.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<h2 id="1_Redirectingthestandardformatteroutput">Redirecting the standard formatter output</h2></div>
</div>

<pre><span id="VALset_formatter_out_channel"><span class="keyword">val</span> set_formatter_out_channel</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Redirect the standard pretty-printer output to the given channel.
  (All the output functions of the standard formatter are set to the
   default output functions printing to the given channel.)</p>

<p><code class="code">set_formatter_out_channel</code> is equivalent to
  <a href="Format.html#VALpp_set_formatter_out_channel"><code class="code"><span class="constructor">Format</span>.pp_set_formatter_out_channel</code></a> <code class="code">std_formatter</code>.</p>
</div>
</div>

<pre><span id="VALpp_set_formatter_output_functions"><span class="keyword">val</span> pp_set_formatter_output_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> (string -> int -> int -> unit) -> (unit -> unit) -> unit</code></pre>
<pre><span id="VALset_formatter_output_functions"><span class="keyword">val</span> set_formatter_output_functions</span> : <code class="type">(string -> int -> int -> unit) -> (unit -> unit) -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_formatter_output_functions&nbsp;ppf&nbsp;out&nbsp;flush</code> redirects the
  standard pretty-printer output functions to the functions <code class="code">out</code> and
  <code class="code">flush</code>.</p>

<p>The <code class="code">out</code> function performs all the pretty-printer string output.
  It is called with a string <code class="code">s</code>, a start position <code class="code">p</code>, and a number of
  characters <code class="code">n</code>; it is supposed to output characters <code class="code">p</code> to <code class="code">p&nbsp;+&nbsp;n&nbsp;-&nbsp;1</code> of
  <code class="code">s</code>.</p>

<p>The <code class="code">flush</code> function is called whenever the pretty-printer is flushed
  (via conversion <code class="code">%!</code>, or pretty-printing indications <code class="code">@?</code> or <code class="code">@.</code>, or
  using low level functions <code class="code">print_flush</code> or <code class="code">print_newline</code>).</p>
</div>
</div>

<pre><span id="VALpp_get_formatter_output_functions"><span class="keyword">val</span> pp_get_formatter_output_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> (string -> int -> int -> unit) * (unit -> unit)</code></pre>
<pre><span id="VALget_formatter_output_functions"><span class="keyword">val</span> get_formatter_output_functions</span> : <code class="type">unit -> (string -> int -> int -> unit) * (unit -> unit)</code></pre><div class="info ">
<div class="info-desc">
<p>Return the current output functions of the standard pretty-printer.</p>
</div>
</div>
<h2 id="meaning">Redefining formatter output</h2><p>The <code class="code"><span class="constructor">Format</span></code> module is versatile enough to let you completely redefine
  the meaning of pretty-printing output: you may provide your own functions
  to define how to handle indentation, line splitting, and even printing of
  all the characters that have to be printed!</p>
<h3 id="2_Redefiningoutputfunctions">Redefining output functions</h3>
<pre><code><span id="TYPEformatter_out_functions"><span class="keyword">type</span> <code class="type"></code>formatter_out_functions</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_out_functions.out_string">out_string</span>&nbsp;: <code class="type">string -> int -> int -> unit</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_out_functions.out_flush">out_flush</span>&nbsp;: <code class="type">unit -> unit</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_out_functions.out_newline">out_newline</span>&nbsp;: <code class="type">unit -> unit</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_out_functions.out_spaces">out_spaces</span>&nbsp;: <code class="type">int -> unit</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_out_functions.out_indent">out_indent</span>&nbsp;: <code class="type">int -> unit</code>;</code></td>

</tr></table>
<code>}</code>

<div class="info ">
<div class="info-desc">
<p>The set of output functions specific to a formatter:</p>
<ul>
<li>the <code class="code">out_string</code> function performs all the pretty-printer string output.
  It is called with a string <code class="code">s</code>, a start position <code class="code">p</code>, and a number of
  characters <code class="code">n</code>; it is supposed to output characters <code class="code">p</code> to <code class="code">p&nbsp;+&nbsp;n&nbsp;-&nbsp;1</code> of
  <code class="code">s</code>.</li>
<li>the <code class="code">out_flush</code> function flushes the pretty-printer output device.</li>
<li><code class="code">out_newline</code> is called to open a new line when the pretty-printer splits
  the line.</li>
<li>the <code class="code">out_spaces</code> function outputs spaces when a break hint leads to spaces
  instead of a line split. It is called with the number of spaces to output.</li>
<li>the <code class="code">out_indent</code> function performs new line indentation when the
  pretty-printer splits the line. It is called with the indentation value of
  the new line.</li>
</ul>
<p>By default:</p>
<ul>
<li>fields <code class="code">out_string</code> and <code class="code">out_flush</code> are output device specific;
  (e.g. <a href="Stdlib.html#VALoutput_string"><code class="code">output_string</code></a> and <a href="Stdlib.html#VALflush"><code class="code">flush</code></a> for a
   <a href="Stdlib.html#TYPEout_channel"><code class="code">out_channel</code></a> device, or <code class="code"><span class="constructor">Buffer</span>.add_substring</code> and
   <a href="Stdlib.html#VALignore"><code class="code">ignore</code></a> for a <code class="code"><span class="constructor">Buffer</span>.t</code> output device),</li>
<li>field <code class="code">out_newline</code> is equivalent to <code class="code">out_string&nbsp;<span class="string">"\n"</span>&nbsp;0&nbsp;1</code>;</li>
<li>fields <code class="code">out_spaces</code> and <code class="code">out_indent</code> are equivalent to
  <code class="code">out_string&nbsp;(<span class="constructor">String</span>.make&nbsp;n&nbsp;<span class="string">'&nbsp;'</span>)&nbsp;0&nbsp;n</code>.</li>
</ul>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>


<pre><span id="VALpp_set_formatter_out_functions"><span class="keyword">val</span> pp_set_formatter_out_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> <a href="Format.html#TYPEformatter_out_functions">formatter_out_functions</a> -> unit</code></pre>
<pre><span id="VALset_formatter_out_functions"><span class="keyword">val</span> set_formatter_out_functions</span> : <code class="type"><a href="Format.html#TYPEformatter_out_functions">formatter_out_functions</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_formatter_out_functions&nbsp;ppf&nbsp;out_funs</code>
  Set all the pretty-printer output functions of <code class="code">ppf</code> to those of
  argument <code class="code">out_funs</code>,</p>

<p>This way, you can change the meaning of indentation (which can be
  something else than just printing space characters) and the meaning of new
  lines opening (which can be connected to any other action needed by the
  application at hand).</p>

<p>Reasonable defaults for functions <code class="code">out_spaces</code> and <code class="code">out_newline</code> are
  respectively <code class="code">out_funs.out_string&nbsp;(<span class="constructor">String</span>.make&nbsp;n&nbsp;<span class="string">'&nbsp;'</span>)&nbsp;0&nbsp;n</code> and
  <code class="code">out_funs.out_string&nbsp;<span class="string">"\n"</span>&nbsp;0&nbsp;1</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>

<pre><span id="VALpp_get_formatter_out_functions"><span class="keyword">val</span> pp_get_formatter_out_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> <a href="Format.html#TYPEformatter_out_functions">formatter_out_functions</a></code></pre>
<pre><span id="VALget_formatter_out_functions"><span class="keyword">val</span> get_formatter_out_functions</span> : <code class="type">unit -> <a href="Format.html#TYPEformatter_out_functions">formatter_out_functions</a></code></pre><div class="info ">
<div class="info-desc">
<p>Return the current output functions of the pretty-printer,
  including line splitting and indentation functions. Useful to record the
  current setting and restore it afterwards.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>
<h2 id="tagsmeaning">Redefining semantic tag operations</h2>
<pre><code><span id="TYPEformatter_stag_functions"><span class="keyword">type</span> <code class="type"></code>formatter_stag_functions</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_stag_functions.mark_open_stag">mark_open_stag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEstag">stag</a> -> string</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_stag_functions.mark_close_stag">mark_close_stag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEstag">stag</a> -> string</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_stag_functions.print_open_stag">print_open_stag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEstag">stag</a> -> unit</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_stag_functions.print_close_stag">print_close_stag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEstag">stag</a> -> unit</code>;</code></td>

</tr></table>
<code>}</code>

<div class="info ">
<div class="info-desc">
<p>The semantic tag handling functions specific to a formatter:
  <code class="code">mark</code> versions are the 'tag-marking' functions that associate a string
  marker to a tag in order for the pretty-printing engine to write
  those markers as 0 length tokens in the output device of the formatter.
  <code class="code">print</code> versions are the 'tag-printing' functions that can perform
  regular printing when a tag is closed or opened.</p>
</div>
</div>


<pre><span id="VALpp_set_formatter_stag_functions"><span class="keyword">val</span> pp_set_formatter_stag_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> <a href="Format.html#TYPEformatter_stag_functions">formatter_stag_functions</a> -> unit</code></pre>
<pre><span id="VALset_formatter_stag_functions"><span class="keyword">val</span> set_formatter_stag_functions</span> : <code class="type"><a href="Format.html#TYPEformatter_stag_functions">formatter_stag_functions</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_set_formatter_stag_functions&nbsp;ppf&nbsp;tag_funs</code> changes the meaning of
  opening and closing semantic tag operations to use the functions in
  <code class="code">tag_funs</code> when printing on <code class="code">ppf</code>.</p>

<p>When opening a semantic tag with name <code class="code">t</code>, the string <code class="code">t</code> is passed to the
  opening tag-marking function (the <code class="code">mark_open_stag</code> field of the
  record <code class="code">tag_funs</code>), that must return the opening tag marker for
  that name. When the next call to <code class="code">close_stag&nbsp;()</code> happens, the semantic tag
  name <code class="code">t</code> is sent back to the closing tag-marking function (the
  <code class="code">mark_close_stag</code> field of record <code class="code">tag_funs</code>), that must return a
  closing tag marker for that name.</p>

<p>The <code class="code">print_</code> field of the record contains the tag-printing functions that
  are called at tag opening and tag closing time, to output regular material
  in the pretty-printer queue.</p>
</div>
</div>

<pre><span id="VALpp_get_formatter_stag_functions"><span class="keyword">val</span> pp_get_formatter_stag_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> <a href="Format.html#TYPEformatter_stag_functions">formatter_stag_functions</a></code></pre>
<pre><span id="VALget_formatter_stag_functions"><span class="keyword">val</span> get_formatter_stag_functions</span> : <code class="type">unit -> <a href="Format.html#TYPEformatter_stag_functions">formatter_stag_functions</a></code></pre><div class="info ">
<div class="info-desc">
<p>Return the current semantic tag operation functions of the standard
  pretty-printer.</p>
</div>
</div>
<h2 id="formatter">Defining formatters</h2>
<p>Defining new formatters permits unrelated output of material in
  parallel on several output devices.
  All the parameters of a formatter are local to the formatter:
  right margin, maximum indentation limit, maximum number of pretty-printing
  boxes simultaneously open, ellipsis, and so on, are specific to
  each formatter and may be fixed independently.</p>

<p>For instance, given a <a href="Buffer.html#TYPEt"><code class="code"><span class="constructor">Buffer</span>.t</code></a> buffer <code class="code">b</code>, <a href="Format.html#VALformatter_of_buffer"><code class="code"><span class="constructor">Format</span>.formatter_of_buffer</code></a> <code class="code">b</code>
  returns a new formatter using buffer <code class="code">b</code> as its output device.
  Similarly, given a <a href="Stdlib.html#TYPEout_channel"><code class="code">out_channel</code></a> output channel <code class="code">oc</code>,
  <a href="Format.html#VALformatter_of_out_channel"><code class="code"><span class="constructor">Format</span>.formatter_of_out_channel</code></a> <code class="code">oc</code> returns a new formatter using
  channel <code class="code">oc</code> as its output device.</p>

<p>Alternatively, given <code class="code">out_funs</code>, a complete set of output functions for a
  formatter, then <a href="Format.html#VALformatter_of_out_functions"><code class="code"><span class="constructor">Format</span>.formatter_of_out_functions</code></a> <code class="code">out_funs</code> computes a new
  formatter using those functions for output.</p>

<pre><span id="VALformatter_of_out_channel"><span class="keyword">val</span> formatter_of_out_channel</span> : <code class="type"><a href="Stdlib.html#TYPEout_channel">out_channel</a> -> <a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">formatter_of_out_channel&nbsp;oc</code> returns a new formatter writing
  to the corresponding output channel <code class="code">oc</code>.</p>
</div>
</div>

<pre><span id="VALstd_formatter"><span class="keyword">val</span> std_formatter</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p>The standard formatter to write to standard output.</p>

<p>It is defined as <a href="Format.html#VALformatter_of_out_channel"><code class="code"><span class="constructor">Format</span>.formatter_of_out_channel</code></a> <a href="Stdlib.html#VALstdout"><code class="code">stdout</code></a>.</p>
</div>
</div>

<pre><span id="VALerr_formatter"><span class="keyword">val</span> err_formatter</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p>A formatter to write to standard error.</p>

<p>It is defined as <a href="Format.html#VALformatter_of_out_channel"><code class="code"><span class="constructor">Format</span>.formatter_of_out_channel</code></a> <a href="Stdlib.html#VALstderr"><code class="code">stderr</code></a>.</p>
</div>
</div>

<pre><span id="VALformatter_of_buffer"><span class="keyword">val</span> formatter_of_buffer</span> : <code class="type"><a href="Buffer.html#TYPEt">Buffer.t</a> -> <a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">formatter_of_buffer&nbsp;b</code> returns a new formatter writing to
  buffer <code class="code">b</code>. At the end of pretty-printing, the formatter must be flushed
  using <a href="Format.html#VALpp_print_flush"><code class="code"><span class="constructor">Format</span>.pp_print_flush</code></a> or <a href="Format.html#VALpp_print_newline"><code class="code"><span class="constructor">Format</span>.pp_print_newline</code></a>, to print all the
  pending material into the buffer.</p>
</div>
</div>

<pre><span id="VALstdbuf"><span class="keyword">val</span> stdbuf</span> : <code class="type"><a href="Buffer.html#TYPEt">Buffer.t</a></code></pre><div class="info ">
<div class="info-desc">
<p>The string buffer in which <code class="code">str_formatter</code> writes.</p>
</div>
</div>

<pre><span id="VALstr_formatter"><span class="keyword">val</span> str_formatter</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p>A formatter to output to the <a href="Format.html#VALstdbuf"><code class="code"><span class="constructor">Format</span>.stdbuf</code></a> string buffer.</p>

<p><code class="code">str_formatter</code> is defined as <a href="Format.html#VALformatter_of_buffer"><code class="code"><span class="constructor">Format</span>.formatter_of_buffer</code></a> <a href="Format.html#VALstdbuf"><code class="code"><span class="constructor">Format</span>.stdbuf</code></a>.</p>
</div>
</div>

<pre><span id="VALflush_str_formatter"><span class="keyword">val</span> flush_str_formatter</span> : <code class="type">unit -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the material printed with <code class="code">str_formatter</code>, flushes
  the formatter and resets the corresponding buffer.</p>
</div>
</div>

<pre><span id="VALmake_formatter"><span class="keyword">val</span> make_formatter</span> : <code class="type">(string -> int -> int -> unit) -> (unit -> unit) -> <a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">make_formatter&nbsp;out&nbsp;flush</code> returns a new formatter that outputs with
  function <code class="code">out</code>, and flushes with function <code class="code">flush</code>.</p>

<p>For instance,</p>
<pre class="codepre"><code class="code">    make_formatter
      (<span class="constructor">Stdlib</span>.output oc)
      (<span class="keyword">fun</span> () <span class="keywordsign">-&gt;</span> <span class="constructor">Stdlib</span>.flush oc) </code></pre><p>returns a formatter to the <a href="Stdlib.html#TYPEout_channel"><code class="code">out_channel</code></a> <code class="code">oc</code>.</p>
</div>
</div>

<pre><span id="VALformatter_of_out_functions"><span class="keyword">val</span> formatter_of_out_functions</span> : <code class="type"><a href="Format.html#TYPEformatter_out_functions">formatter_out_functions</a> -> <a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">formatter_of_out_functions&nbsp;out_funs</code> returns a new formatter that writes
  with the set of output functions <code class="code">out_funs</code>.</p>

<p>See definition of type <a href="Format.html#TYPEformatter_out_functions"><code class="code"><span class="constructor">Format</span>.formatter_out_functions</code></a> for the meaning of argument
  <code class="code">out_funs</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>
<h3 id="symbolic">Symbolic pretty-printing</h3><p>Symbolic pretty-printing is pretty-printing using a symbolic formatter,
  i.e. a formatter that outputs symbolic pretty-printing items.</p>

<p>When using a symbolic formatter, all regular pretty-printing activities
  occur but output material is symbolic and stored in a buffer of output items.
  At the end of pretty-printing, flushing the output buffer allows
  post-processing of symbolic output before performing low level output
  operations.</p>

<p>In practice, first define a symbolic output buffer <code class="code">b</code> using:</p>
<ul>
<li><code class="code"><span class="keyword">let</span>&nbsp;sob&nbsp;=&nbsp;make_symbolic_output_buffer&nbsp;()</code>.
  Then define a symbolic formatter with:</li>
<li><code class="code"><span class="keyword">let</span>&nbsp;ppf&nbsp;=&nbsp;formatter_of_symbolic_output_buffer&nbsp;sob</code></li>
</ul>
<p>Use symbolic formatter <code class="code">ppf</code> as usual, and retrieve symbolic items at end
  of pretty-printing by flushing symbolic output buffer <code class="code">sob</code> with:</p>
<ul>
<li><code class="code">flush_symbolic_output_buffer&nbsp;sob</code>.</li>
</ul>

<pre><code><span id="TYPEsymbolic_output_item"><span class="keyword">type</span> <code class="type"></code>symbolic_output_item</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsymbolic_output_item.Output_flush"><span class="constructor">Output_flush</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>symbolic flush command</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsymbolic_output_item.Output_newline"><span class="constructor">Output_newline</span></span></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>symbolic newline command</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsymbolic_output_item.Output_string"><span class="constructor">Output_string</span></span> <span class="keyword">of</span> <code class="type">string</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Output_string</span>&nbsp;s</code>: symbolic output for string <code class="code">s</code></p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsymbolic_output_item.Output_spaces"><span class="constructor">Output_spaces</span></span> <span class="keyword">of</span> <code class="type">int</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Output_spaces</span>&nbsp;n</code>: symbolic command to output <code class="code">n</code> spaces</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTsymbolic_output_item.Output_indent"><span class="constructor">Output_indent</span></span> <span class="keyword">of</span> <code class="type">int</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Output_indent</span>&nbsp;i</code>: symbolic indentation of size <code class="code">i</code></p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>Items produced by symbolic pretty-printers</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>


<pre><span id="TYPEsymbolic_output_buffer"><span class="keyword">type</span> <code class="type"></code>symbolic_output_buffer</span> </pre>
<div class="info ">
<div class="info-desc">
<p>The output buffer of a symbolic pretty-printer.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>


<pre><span id="VALmake_symbolic_output_buffer"><span class="keyword">val</span> make_symbolic_output_buffer</span> : <code class="type">unit -> <a href="Format.html#TYPEsymbolic_output_buffer">symbolic_output_buffer</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">make_symbolic_output_buffer&nbsp;()</code> returns a fresh buffer for
  symbolic output.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>

<pre><span id="VALclear_symbolic_output_buffer"><span class="keyword">val</span> clear_symbolic_output_buffer</span> : <code class="type"><a href="Format.html#TYPEsymbolic_output_buffer">symbolic_output_buffer</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">clear_symbolic_output_buffer&nbsp;sob</code> resets buffer <code class="code">sob</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>

<pre><span id="VALget_symbolic_output_buffer"><span class="keyword">val</span> get_symbolic_output_buffer</span> : <code class="type"><a href="Format.html#TYPEsymbolic_output_buffer">symbolic_output_buffer</a> -> <a href="Format.html#TYPEsymbolic_output_item">symbolic_output_item</a> list</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_symbolic_output_buffer&nbsp;sob</code> returns the contents of buffer <code class="code">sob</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>

<pre><span id="VALflush_symbolic_output_buffer"><span class="keyword">val</span> flush_symbolic_output_buffer</span> : <code class="type"><a href="Format.html#TYPEsymbolic_output_buffer">symbolic_output_buffer</a> -> <a href="Format.html#TYPEsymbolic_output_item">symbolic_output_item</a> list</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">flush_symbolic_output_buffer&nbsp;sob</code> returns the contents of buffer
  <code class="code">sob</code> and resets buffer <code class="code">sob</code>.
  <code class="code">flush_symbolic_output_buffer&nbsp;sob</code> is equivalent to
  <code class="code"><span class="keyword">let</span>&nbsp;items&nbsp;=&nbsp;get_symbolic_output_buffer&nbsp;sob&nbsp;<span class="keyword">in</span><br>
&nbsp;&nbsp;&nbsp;clear_symbolic_output_buffer&nbsp;sob;&nbsp;items</code></p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>

<pre><span id="VALadd_symbolic_output_item"><span class="keyword">val</span> add_symbolic_output_item</span> : <code class="type"><a href="Format.html#TYPEsymbolic_output_buffer">symbolic_output_buffer</a> -> <a href="Format.html#TYPEsymbolic_output_item">symbolic_output_item</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">add_symbolic_output_item&nbsp;sob&nbsp;itm</code> adds item <code class="code">itm</code> to buffer <code class="code">sob</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>

<pre><span id="VALformatter_of_symbolic_output_buffer"><span class="keyword">val</span> formatter_of_symbolic_output_buffer</span> : <code class="type"><a href="Format.html#TYPEsymbolic_output_buffer">symbolic_output_buffer</a> -> <a href="Format.html#TYPEformatter">formatter</a></code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">formatter_of_symbolic_output_buffer&nbsp;sob</code> returns a symbolic formatter
  that outputs to <code class="code">symbolic_output_buffer</code> <code class="code">sob</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.06.0</li>
</ul>
</div>
<h2 id="1_Convenienceformattingfunctions">Convenience formatting functions.</h2>
<pre><span id="VALpp_print_list"><span class="keyword">val</span> pp_print_list</span> : <code class="type">?pp_sep:(<a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit) -><br>       (<a href="Format.html#TYPEformatter">formatter</a> -> 'a -> unit) -> <a href="Format.html#TYPEformatter">formatter</a> -> 'a list -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_list&nbsp;?pp_sep&nbsp;pp_v&nbsp;ppf&nbsp;l</code> prints items of list <code class="code">l</code>,
  using <code class="code">pp_v</code> to print each item, and calling <code class="code">pp_sep</code>
  between items (<code class="code">pp_sep</code> defaults to <a href="Format.html#VALpp_print_cut"><code class="code"><span class="constructor">Format</span>.pp_print_cut</code></a>.
  Does nothing on empty lists.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALpp_print_text"><span class="keyword">val</span> pp_print_text</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_text&nbsp;ppf&nbsp;s</code> prints <code class="code">s</code> with spaces and newlines respectively
  printed using <a href="Format.html#VALpp_print_space"><code class="code"><span class="constructor">Format</span>.pp_print_space</code></a> and <a href="Format.html#VALpp_force_newline"><code class="code"><span class="constructor">Format</span>.pp_force_newline</code></a>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.02.0</li>
</ul>
</div>

<pre><span id="VALpp_print_option"><span class="keyword">val</span> pp_print_option</span> : <code class="type">?none:(<a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit) -><br>       (<a href="Format.html#TYPEformatter">formatter</a> -> 'a -> unit) -> <a href="Format.html#TYPEformatter">formatter</a> -> 'a option -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_option&nbsp;?none&nbsp;pp_v&nbsp;ppf&nbsp;o</code> prints <code class="code">o</code> on <code class="code">ppf</code>
    using <code class="code">pp_v</code> if <code class="code">o</code> is <code class="code"><span class="constructor">Some</span>&nbsp;v</code> and <code class="code">none</code> if it is <code class="code"><span class="constructor">None</span></code>. <code class="code">none</code>
    prints nothing by default.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>

<pre><span id="VALpp_print_result"><span class="keyword">val</span> pp_print_result</span> : <code class="type">ok:(<a href="Format.html#TYPEformatter">formatter</a> -> 'a -> unit) -><br>       error:(<a href="Format.html#TYPEformatter">formatter</a> -> 'e -> unit) -><br>       <a href="Format.html#TYPEformatter">formatter</a> -> ('a, 'e) <a href="Stdlib.html#TYPEresult">result</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">pp_print_result&nbsp;~ok&nbsp;~error&nbsp;ppf&nbsp;r</code> prints <code class="code">r</code> on <code class="code">ppf</code> using
    <code class="code">ok</code> if <code class="code">r</code> is <code class="code"><span class="constructor">Ok</span>&nbsp;_</code> and <code class="code">error</code> if <code class="code">r</code> is <code class="code"><span class="constructor">Error</span>&nbsp;_</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<h2 id="fpp">Formatted pretty-printing</h2><p>Module <code class="code"><span class="constructor">Format</span></code> provides a complete set of <code class="code">printf</code> like functions for
  pretty-printing using format string specifications.</p>

<p>Specific annotations may be added in the format strings to give
  pretty-printing commands to the pretty-printing engine.</p>

<p>Those annotations are introduced in the format strings using the <code class="code">@</code>
  character. For instance, <code class="code">@&nbsp;</code> means a space break, <code class="code">@,</code> means a cut,
  <code class="code">@[</code> opens a new box, and <code class="code">@]</code> closes the last open box.</p>

<pre><span id="VALfprintf"><span class="keyword">val</span> fprintf</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> ('a, <a href="Format.html#TYPEformatter">formatter</a>, unit) <a href="Stdlib.html#TYPEformat">format</a> -> 'a</code></pre><p><code class="code">fprintf&nbsp;ff&nbsp;fmt&nbsp;arg1&nbsp;...&nbsp;argN</code> formats the arguments <code class="code">arg1</code> to <code class="code">argN</code>
  according to the format string <code class="code">fmt</code>, and outputs the resulting string on
  the formatter <code class="code">ff</code>.</p>

<p>The format string <code class="code">fmt</code> is a character string which contains three types of
  objects: plain characters and conversion specifications as specified in
  the <a href="Printf.html"><code class="code"><span class="constructor">Printf</span></code></a> module, and pretty-printing indications specific to the
  <code class="code"><span class="constructor">Format</span></code> module.</p>

<p>The pretty-printing indication characters are introduced by
  a <code class="code">@</code> character, and their meanings are:</p>
<ul>
<li><code class="code">@[</code>: open a pretty-printing box. The type and offset of the
    box may be optionally specified with the following syntax:
    the <code class="code">&lt;</code> character, followed by an optional box type indication,
    then an optional integer offset, and the closing <code class="code">&gt;</code> character.
    Pretty-printing box type is one of <code class="code">h</code>, <code class="code">v</code>, <code class="code">hv</code>, <code class="code">b</code>, or <code class="code">hov</code>.
    '<code class="code">h</code>' stands for an 'horizontal' pretty-printing box,
    '<code class="code">v</code>' stands for a 'vertical' pretty-printing box,
    '<code class="code">hv</code>' stands for an 'horizontal/vertical' pretty-printing box,
    '<code class="code">b</code>' stands for an 'horizontal-or-vertical' pretty-printing box
    demonstrating indentation,
    '<code class="code">hov</code>' stands a simple 'horizontal-or-vertical' pretty-printing box.
    For instance, <code class="code">@[&lt;hov&nbsp;2&gt;</code> opens an 'horizontal-or-vertical'
    pretty-printing box with indentation 2 as obtained with <code class="code">open_hovbox&nbsp;2</code>.
    For more details about pretty-printing boxes, see the various box opening
    functions <code class="code">open_*box</code>.</li>
<li><code class="code">@]</code>: close the most recently opened pretty-printing box.</li>
<li><code class="code">@,</code>: output a 'cut' break hint, as with <code class="code">print_cut&nbsp;()</code>.</li>
<li><code class="code">@&nbsp;</code>: output a 'space' break hint, as with <code class="code">print_space&nbsp;()</code>.</li>
<li><code class="code">@;</code>: output a 'full' break hint as with <code class="code">print_break</code>. The
    <code class="code">nspaces</code> and <code class="code">offset</code> parameters of the break hint may be
    optionally specified with the following syntax:
    the <code class="code">&lt;</code> character, followed by an integer <code class="code">nspaces</code> value,
    then an integer <code class="code">offset</code>, and a closing <code class="code">&gt;</code> character.
    If no parameters are provided, the good break defaults to a
    'space' break hint.</li>
<li><code class="code">@.</code>: flush the pretty-printer and split the line, as with
    <code class="code">print_newline&nbsp;()</code>.</li>
<li><code class="code">@&lt;n&gt;</code>: print the following item as if it were of length <code class="code">n</code>.
    Hence, <code class="code">printf&nbsp;<span class="string">"@&lt;0&gt;%s"</span>&nbsp;arg</code> prints <code class="code">arg</code> as a zero length string.
    If <code class="code">@&lt;n&gt;</code> is not followed by a conversion specification,
    then the following character of the format is printed as if
    it were of length <code class="code">n</code>.</li>
<li><code class="code">@{</code>: open a semantic tag. The name of the tag may be optionally
    specified with the following syntax:
    the <code class="code">&lt;</code> character, followed by an optional string
    specification, and the closing <code class="code">&gt;</code> character. The string
    specification is any character string that does not contain the
    closing character <code class="code"><span class="string">'&gt;'</span></code>. If omitted, the tag name defaults to the
    empty string.
    For more details about semantic tags, see the functions <a href="Format.html#VALopen_stag"><code class="code"><span class="constructor">Format</span>.open_stag</code></a> and
    <a href="Format.html#VALclose_stag"><code class="code"><span class="constructor">Format</span>.close_stag</code></a>.</li>
<li><code class="code">@}</code>: close the most recently opened semantic tag.</li>
<li><code class="code">@?</code>: flush the pretty-printer as with <code class="code">print_flush&nbsp;()</code>.
    This is equivalent to the conversion <code class="code">%!</code>.</li>
<li><code class="code">@\n</code>: force a newline, as with <code class="code">force_newline&nbsp;()</code>, not the normal way
    of pretty-printing, you should prefer using break hints inside a vertical
    pretty-printing box.</li>
</ul>
<p>Note: To prevent the interpretation of a <code class="code">@</code> character as a
  pretty-printing indication, escape it with a <code class="code">%</code> character.
  Old quotation mode <code class="code">@@</code> is deprecated since it is not compatible with
  formatted input interpretation of character <code class="code"><span class="string">'@'</span></code>.</p>

<p>Example: <code class="code">printf&nbsp;<span class="string">"@[%s@&nbsp;%d@]@."</span>&nbsp;<span class="string">"x&nbsp;="</span>&nbsp;1</code> is equivalent to
  <code class="code">open_box&nbsp;();&nbsp;print_string&nbsp;<span class="string">"x&nbsp;="</span>;&nbsp;print_space&nbsp;();<br>
&nbsp;&nbsp;&nbsp;print_int&nbsp;1;&nbsp;close_box&nbsp;();&nbsp;print_newline&nbsp;()</code>.
  It prints <code class="code">x&nbsp;=&nbsp;1</code> within a pretty-printing 'horizontal-or-vertical' box.</p>

<pre><span id="VALprintf"><span class="keyword">val</span> printf</span> : <code class="type">('a, <a href="Format.html#TYPEformatter">formatter</a>, unit) <a href="Stdlib.html#TYPEformat">format</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">fprintf</code> above, but output on <code class="code">std_formatter</code>.</p>
</div>
</div>

<pre><span id="VALeprintf"><span class="keyword">val</span> eprintf</span> : <code class="type">('a, <a href="Format.html#TYPEformatter">formatter</a>, unit) <a href="Stdlib.html#TYPEformat">format</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">fprintf</code> above, but output on <code class="code">err_formatter</code>.</p>
</div>
</div>

<pre><span id="VALsprintf"><span class="keyword">val</span> sprintf</span> : <code class="type">('a, unit, string) <a href="Stdlib.html#TYPEformat">format</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">printf</code> above, but instead of printing on a formatter,
  returns a string containing the result of formatting the arguments.
  Note that the pretty-printer queue is flushed at the end of <em>each
  call</em> to <code class="code">sprintf</code>.</p>

<p>In case of multiple and related calls to <code class="code">sprintf</code> to output
  material on a single string, you should consider using <code class="code">fprintf</code>
  with the predefined formatter <code class="code">str_formatter</code> and call
  <code class="code">flush_str_formatter&nbsp;()</code> to get the final result.</p>

<p>Alternatively, you can use <code class="code"><span class="constructor">Format</span>.fprintf</code> with a formatter writing to a
  buffer of your own: flushing the formatter and the buffer at the end of
  pretty-printing returns the desired string.</p>
</div>
</div>

<pre><span id="VALasprintf"><span class="keyword">val</span> asprintf</span> : <code class="type">('a, <a href="Format.html#TYPEformatter">formatter</a>, unit, string) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">printf</code> above, but instead of printing on a formatter,
  returns a string containing the result of formatting the arguments.
  The type of <code class="code">asprintf</code> is general enough to interact nicely with <code class="code">%a</code>
  conversions.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>

<pre><span id="VALdprintf"><span class="keyword">val</span> dprintf</span> : <code class="type">('a, <a href="Format.html#TYPEformatter">formatter</a>, unit, <a href="Format.html#TYPEformatter">formatter</a> -> unit) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Format.html#VALfprintf"><code class="code"><span class="constructor">Format</span>.fprintf</code></a>, except the formatter is the last argument.
  <code class="code">dprintf&nbsp;<span class="string">"..."</span>&nbsp;a&nbsp;b&nbsp;c</code> is a function of type
  <code class="code">formatter&nbsp;<span class="keywordsign">-&gt;</span>&nbsp;unit</code> which can be given to a format specifier <code class="code">%t</code>.</p>

<p>This can be used as a replacement for <a href="Format.html#VALasprintf"><code class="code"><span class="constructor">Format</span>.asprintf</code></a> to delay
  formatting decisions. Using the string returned by <a href="Format.html#VALasprintf"><code class="code"><span class="constructor">Format</span>.asprintf</code></a> in a
  formatting context forces formatting decisions to be taken in
  isolation, and the final string may be created
  prematurely. <a href="Format.html#VALdprintf"><code class="code"><span class="constructor">Format</span>.dprintf</code></a> allows delay of formatting decisions until
  the final formatting context is known.
  For example:</p>
<pre class="codepre"><code class="code">  <span class="keyword">let</span> t = <span class="constructor">Format</span>.dprintf <span class="string">"%i@ %i@ %i"</span> 1 2 3 <span class="keyword">in</span>
  ...
  <span class="constructor">Format</span>.printf <span class="string">"@[&lt;v&gt;%t@]"</span> t
</code></pre></div>
<ul class="info-attributes">
<li><b>Since</b> 4.08.0</li>
</ul>
</div>

<pre><span id="VALifprintf"><span class="keyword">val</span> ifprintf</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> ('a, <a href="Format.html#TYPEformatter">formatter</a>, unit) <a href="Stdlib.html#TYPEformat">format</a> -> 'a</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">fprintf</code> above, but does not print anything.
  Useful to ignore some material when conditionally printing.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.10.0</li>
</ul>
</div>
<p>Formatted Pretty-Printing with continuations.</p>

<pre><span id="VALkfprintf"><span class="keyword">val</span> kfprintf</span> : <code class="type">(<a href="Format.html#TYPEformatter">formatter</a> -> 'a) -><br>       <a href="Format.html#TYPEformatter">formatter</a> -> ('b, <a href="Format.html#TYPEformatter">formatter</a>, unit, 'a) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">fprintf</code> above, but instead of returning immediately,
  passes the formatter to its first argument at the end of printing.</p>
</div>
</div>

<pre><span id="VALkdprintf"><span class="keyword">val</span> kdprintf</span> : <code class="type">((<a href="Format.html#TYPEformatter">formatter</a> -> unit) -> 'a) -><br>       ('b, <a href="Format.html#TYPEformatter">formatter</a>, unit, 'a) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Format.html#VALdprintf"><code class="code"><span class="constructor">Format</span>.dprintf</code></a> above, but instead of returning immediately,
  passes the suspended printer to its first argument at the end of printing.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08.0</li>
</ul>
</div>

<pre><span id="VALikfprintf"><span class="keyword">val</span> ikfprintf</span> : <code class="type">(<a href="Format.html#TYPEformatter">formatter</a> -> 'a) -><br>       <a href="Format.html#TYPEformatter">formatter</a> -> ('b, <a href="Format.html#TYPEformatter">formatter</a>, unit, 'a) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">kfprintf</code> above, but does not print anything.
  Useful to ignore some material when conditionally printing.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 3.12.0</li>
</ul>
</div>

<pre><span id="VALksprintf"><span class="keyword">val</span> ksprintf</span> : <code class="type">(string -> 'a) -> ('b, unit, string, 'a) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">sprintf</code> above, but instead of returning the string,
  passes it to the first argument.</p>
</div>
</div>

<pre><span id="VALkasprintf"><span class="keyword">val</span> kasprintf</span> : <code class="type">(string -> 'a) -> ('b, <a href="Format.html#TYPEformatter">formatter</a>, unit, 'a) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">asprintf</code> above, but instead of returning the string,
  passes it to the first argument.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03</li>
</ul>
</div>
<h2 id="1_Deprecated">Deprecated</h2>
<pre><span id="VALbprintf"><span class="keyword">val</span> bprintf</span> : <code class="type"><a href="Buffer.html#TYPEt">Buffer.t</a> -> ('a, <a href="Format.html#TYPEformatter">formatter</a>, unit) <a href="Stdlib.html#TYPEformat">format</a> -> 'a</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>This function is error prone. Do not use it.
  This function is neither compositional nor incremental, since it flushes
  the pretty-printer queue at each call.

  If you need to print to some buffer <code class="code">b</code>, you must first define a
  formatter writing to <code class="code">b</code>, using <code class="code"><span class="keyword">let</span>&nbsp;to_b&nbsp;=&nbsp;formatter_of_buffer&nbsp;b</code>; then
  use regular calls to <code class="code"><span class="constructor">Format</span>.fprintf</code> with formatter <code class="code">to_b</code>.</div>
</div>

<pre><span id="VALkprintf"><span class="keyword">val</span> kprintf</span> : <code class="type">(string -> 'a) -> ('b, unit, string, 'a) <a href="Stdlib.html#TYPEformat4">format4</a> -> 'b</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>An alias for <code class="code">ksprintf</code>.</div>
</div>

<pre><span id="VALset_all_formatter_output_functions"><span class="keyword">val</span> set_all_formatter_output_functions</span> : <code class="type">out:(string -> int -> int -> unit) -><br>       flush:(unit -> unit) -><br>       newline:(unit -> unit) -> spaces:(int -> unit) -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <code class="code">set_formatter_out_functions</code>.</div>
</div>

<pre><span id="VALget_all_formatter_output_functions"><span class="keyword">val</span> get_all_formatter_output_functions</span> : <code class="type">unit -><br>       (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) *<br>       (int -> unit)</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <code class="code">get_formatter_out_functions</code>.</div>
</div>

<pre><span id="VALpp_set_all_formatter_output_functions"><span class="keyword">val</span> pp_set_all_formatter_output_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -><br>       out:(string -> int -> int -> unit) -><br>       flush:(unit -> unit) -><br>       newline:(unit -> unit) -> spaces:(int -> unit) -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <code class="code">pp_set_formatter_out_functions</code>.</div>
</div>

<pre><span id="VALpp_get_all_formatter_output_functions"><span class="keyword">val</span> pp_get_all_formatter_output_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -><br>       unit -><br>       (string -> int -> int -> unit) * (unit -> unit) * (unit -> unit) *<br>       (int -> unit)</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <code class="code">pp_get_formatter_out_functions</code>.</div>
</div>
<h3 id="2_Stringtags">String tags</h3>
<pre><span id="VALpp_open_tag"><span class="keyword">val</span> pp_open_tag</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> <a href="Format.html#TYPEtag">tag</a> -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALpp_open_stag"><code class="code"><span class="constructor">Format</span>.pp_open_stag</code></a>.</div>
</div>

<pre><span id="VALopen_tag"><span class="keyword">val</span> open_tag</span> : <code class="type"><a href="Format.html#TYPEtag">tag</a> -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALopen_stag"><code class="code"><span class="constructor">Format</span>.open_stag</code></a>.</div>
</div>

<pre><span id="VALpp_close_tag"><span class="keyword">val</span> pp_close_tag</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALpp_close_stag"><code class="code"><span class="constructor">Format</span>.pp_close_stag</code></a>.</div>
</div>

<pre><span id="VALclose_tag"><span class="keyword">val</span> close_tag</span> : <code class="type">unit -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALclose_stag"><code class="code"><span class="constructor">Format</span>.close_stag</code></a>.</div>
</div>

<pre><code><span id="TYPEformatter_tag_functions"><span class="keyword">type</span> <code class="type"></code>formatter_tag_functions</span> = {</code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_tag_functions.mark_open_tag">mark_open_tag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEtag">tag</a> -> string</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_tag_functions.mark_close_tag">mark_close_tag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEtag">tag</a> -> string</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_tag_functions.print_open_tag">print_open_tag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEtag">tag</a> -> unit</code>;</code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code>&nbsp;&nbsp;</code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTformatter_tag_functions.print_close_tag">print_close_tag</span>&nbsp;: <code class="type"><a href="Format.html#TYPEtag">tag</a> -> unit</code>;</code></td>

</tr></table>
<code>}</code>

<div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#TYPEformatter_stag_functions"><code class="code"><span class="constructor">Format</span>.formatter_stag_functions</code></a>.</div>
</div>


<pre><span id="VALpp_set_formatter_tag_functions"><span class="keyword">val</span> pp_set_formatter_tag_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> <a href="Format.html#TYPEformatter_tag_functions">formatter_tag_functions</a> -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALpp_set_formatter_stag_functions"><code class="code"><span class="constructor">Format</span>.pp_set_formatter_stag_functions</code></a>.</div>
<div class="info-desc">
<p>This function will erase non-string tag formatting functions.</p>
</div>
</div>

<pre><span id="VALset_formatter_tag_functions"><span class="keyword">val</span> set_formatter_tag_functions</span> : <code class="type"><a href="Format.html#TYPEformatter_tag_functions">formatter_tag_functions</a> -> unit</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALset_formatter_stag_functions"><code class="code"><span class="constructor">Format</span>.set_formatter_stag_functions</code></a>.</div>
</div>

<pre><span id="VALpp_get_formatter_tag_functions"><span class="keyword">val</span> pp_get_formatter_tag_functions</span> : <code class="type"><a href="Format.html#TYPEformatter">formatter</a> -> unit -> <a href="Format.html#TYPEformatter_tag_functions">formatter_tag_functions</a></code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALpp_get_formatter_stag_functions"><code class="code"><span class="constructor">Format</span>.pp_get_formatter_stag_functions</code></a>.</div>
</div>

<pre><span id="VALget_formatter_tag_functions"><span class="keyword">val</span> get_formatter_tag_functions</span> : <code class="type">unit -> <a href="Format.html#TYPEformatter_tag_functions">formatter_tag_functions</a></code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Subsumed by <a href="Format.html#VALget_formatter_stag_functions"><code class="code"><span class="constructor">Format</span>.get_formatter_stag_functions</code></a>.</div>
</div>
</body></html>