1 .Dd $Mdocdate: December 13 2018 $
6 .Nd ordering of mandoc include files
8 To support a cleaner coding style, the mandoc header files do not
9 contain any include directives and do not guard against multiple
11 The application developer has to make sure that the headers are
12 included in a proper order, and that no header is included more
15 The headers and functions form three major groups:
16 .Sx Parser interface ,
17 .Sx Parser internals ,
19 .Sx Formatter interface .
21 Various rules are given below prohibiting the inclusion of certain
22 combinations of headers into the same file.
23 The intention is to keep the following functional components
24 separate from each other:
26 .Bl -dash -offset indent -compact
52 Note that mere usage of an opaque struct type does
54 require inclusion of the header where that type is defined.
56 Each of the following headers can be included without including
57 any other mandoc header.
58 These headers should be included before any other mandoc headers.
60 .It Qq Pa mandoc_aux.h
61 Memory allocation utility functions; can be used everywhere.
68 Provides the functions documented in
70 .It Qq Pa mandoc_ohash.h
71 Hashing utility functions; can be used everywhere.
85 .Fn mandoc_ohash_init .
87 Error handling, escape sequence, and character utilities;
88 can be used everywhere.
98 .Vt enum mandoclevel ,
99 the function prototype typedef
102 .Xr mandoc_escape 3 ,
103 and the functions described in
106 Common data types for all syntax trees and related functions;
107 can be used everywhere.
111 .Vt enum mdoc_endbody ,
112 .Vt enum roff_macroset ,
117 .Vt struct roff_man ,
118 .Vt struct roff_meta ,
119 .Vt struct roff_node ,
127 Uses pointers to the types
137 as opaque struct members.
139 Data structures for the
141 parse tree; can be used everywhere.
152 .Vt struct tbl_opts ,
153 .Vt struct tbl_cell ,
157 .Vt struct tbl_span .
159 Data structures for the
161 parse tree; can be used everywhere.
174 .It Qq Pa mandoc_parse.h
175 Top level parser interface, for use in the main program
176 and in the main parser, but not in formatters.
182 .Vt enum mandoclevel ,
194 for function prototypes.
199 as an opaque type for function prototypes.
200 .It Qq Pa mandoc_xr.h
201 Cross reference validation; intended for use in the main program
202 and in parsers, but not in formatters.
207 .Fn mandoc_xr_reset ,
214 The following two require
216 but no other mandoc headers.
217 Afterwards, any other mandoc headers can be included as needed.
231 .Vt struct mdoc_argv ,
232 .Vt struct mdoc_arg ,
238 .Vt union mdoc_data ,
248 as an opaque type for function prototypes.
250 When this header is included, the same file should not include
251 internals of different parsers.
253 Provides the functions
262 for function prototypes.
267 as an opaque type for function prototypes.
269 When this header is included, the same file should not include
270 internals of different parsers.
273 Most of the following headers require inclusion of a parser interface header
274 before they can be included.
275 All parser interface headers should precede all parser internal headers.
276 When any parser internal headers are included, the same file should
277 not include any formatter headers.
279 .It Qq Pa libmandoc.h
291 utility functions needed by multiple parsers,
292 and the top-level functions to call the parsers.
294 Uses the opaque types
302 for function prototypes.
307 as an opaque type for function prototypes.
309 Parser internals shared by multiple parsers.
310 Can be used in all parsers, but not in main programs or formatters.
319 Provides functions named
321 to handle roff nodes,
326 and the two special functions
330 because the latter two are needed by
343 as opaque types for function prototypes.
355 .Vt struct mdoc_macro ,
356 and many functions internal to the
370 as opaque types for function prototypes.
372 When this header is included, the same file should not include
373 interfaces of different parsers.
382 and some functions internal to the
392 as opaque types for function prototypes.
394 When this header is included, the same file should not include
395 interfaces of different parsers.
396 .It Qq Pa eqn_parse.h
397 External interface of the
399 parser, for use in the
426 for function prototypes.
431 as an opaque type for function prototypes.
440 as opaque struct members.
442 When this header is included, the same file should not include
443 internals of different parsers.
444 .It Qq Pa tbl_parse.h
445 External interface of the
447 parser, for use in the
453 Provides the functions documented in
468 as opaque types for function prototypes.
470 When this header is included, the same file should not include
471 internals of different parsers.
473 Internal interfaces of the
475 parser, for use inside the
482 .Vt struct tbl_opts .
486 .Vt struct tbl_node ,
495 Uses a pointer to the opaque type
499 as an opaque struct member.
501 When this header is included, the same file should not include
502 interfaces of different parsers.
504 .Ss Formatter interface
505 These headers should be included after any parser interface headers.
506 No parser internal headers should be included by the same file.
527 as an opaque type for function prototypes.
529 When this header is included, the same file should not include
547 .Vt struct termp_tbl ,
550 and many terminal formatting functions.
568 as opaque types for function prototypes.
570 When this header is included, the same file should not include
592 .Vt struct htmlpair ,
595 and many HTML formatting functions.
607 as opaque types for function prototypes.
609 When this header is included, the same file should not include
619 Provides an interface to generate
623 functionality mentioned in
626 Provides the top level steering functions for all formatters.
632 as an opaque type for function prototypes.
641 .Vt struct manpaths ,
642 .Vt struct manoutput ,
649 .It Qq Pa mansearch.h
662 .Vt struct mansearch ,
672 as an opaque type for function prototypes.
674 When this header is included, the same file should not include