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
50 Note that mere usage of an opaque struct type does
52 require inclusion of the header where that type is defined.
54 Each of the following headers can be included without including
55 any other mandoc header.
56 These headers should be included before any other mandoc headers.
58 .It Qq Pa mandoc_aux.h
64 Provides the utility functions documented in
66 .It Qq Pa mandoc_ohash.h
79 .Fn mandoc_ohash_init .
89 .Vt enum mandoclevel ,
101 .Vt struct tbl_span ,
104 the function prototype typedef
107 .Xr mandoc_escape 3 ,
108 the functions described in
119 for function prototypes.
124 as an opaque type for function prototypes.
127 .Qq Pa mandoc_ohash.h
132 .Vt enum mdoc_endbody ,
133 .Vt enum roff_macroset ,
138 .Vt struct roff_man ,
139 .Vt struct roff_meta ,
140 .Vt struct roff_node ,
150 Uses pointers to the types
156 as opaque struct members.
159 The following two require
161 but no other mandoc headers.
162 Afterwards, any other mandoc headers can be included as needed.
176 .Vt struct mdoc_argv ,
177 .Vt struct mdoc_arg ,
183 .Vt union mdoc_data ,
193 as an opaque type for function prototypes.
195 When this header is included, the same file should not include
200 Provides the functions
209 for function prototypes.
214 as an opaque type for function prototypes.
216 When this header is included, the same file should not include
222 The following headers require inclusion of a parser interface header
223 before they can be included.
224 All parser interface headers should precede all parser internal headers.
225 When any parser internal headers are included, the same file should
226 not include any formatter headers.
228 .It Qq Pa libmandoc.h
241 utility functions needed by multiple parsers,
242 and the top-level functions to call the parsers.
244 Uses the opaque types
252 for function prototypes.
263 as opaque types for function prototypes.
270 Provides functions named
272 to handle roff nodes and the two special functions
276 because the latter two are needed by
294 as opaque types for function prototypes.
310 .Vt struct mdoc_macro ,
311 and many functions internal to the
325 as opaque types for function prototypes.
327 When this header is included, the same file should not include
340 and some functions internal to the
350 as opaque types for function prototypes.
352 When this header is included, the same file should not include
374 .Vt struct tbl_node ,
376 .Vt struct eqn_node ,
377 and many functions internal to the
388 When this header is included, the same file should not include
395 .Ss Formatter interface
396 These headers should be included after any parser interface headers.
397 No parser internal headers should be included by the same file.
418 as an opaque type for function prototypes.
420 When this header is included, the same file should not include
438 .Vt struct termp_tbl ,
441 and many terminal formatting functions.
459 as opaque types for function prototypes.
461 When this header is included, the same file should not include
483 .Vt struct htmlpair ,
486 and many HTML formatting functions.
498 as opaque types for function prototypes.
500 When this header is included, the same file should not include
510 Provides an interface to generate
514 functionality mentioned in
517 Provides the top level steering functions for all formatters.
523 as an opaque type for function prototypes.
532 .Vt struct manpaths ,
533 .Vt struct manoutput ,
539 .It Qq Pa mansearch.h
552 .Vt struct mansearch ,
562 as an opaque type for function prototypes.
564 When this header is included, the same file should not include