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
63 Provides the utility functions documented in
74 .Vt enum mandoclevel ,
90 the function prototype typedef
94 the functions described in
101 Uses the opaque types
109 for function prototypes.
118 as opaque types for function prototypes.
121 .Vt enum mdoc_endbody ,
124 .Vt struct roff_meta ,
126 .Vt struct roff_node .
128 Uses pointers to the types
134 as opaque struct members.
137 The following two require
139 but no other mandoc headers.
140 Afterwards, any other mandoc headers can be included as needed.
158 .Vt struct mdoc_argv ,
159 .Vt struct mdoc_arg ,
174 as an opaque type for function prototypes.
175 Uses pointers to the types
179 as opaque struct members.
181 When this header is included, the same file should not include
191 Provides the functions
200 for function prototypes.
205 as an opaque type for function prototypes.
206 Uses pointers to the types
210 as opaque struct members.
212 When this header is included, the same file should not include
218 The following headers require inclusion of a parser interface header
219 before they can be included. All parser interface headers should
220 precede all parser internal headers. When any parser internal headers
221 are included, the same file should not include any formatter headers.
223 .It Qq Pa libmandoc.h
236 .Vt struct roff_node .
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.
266 as opaque types for function prototypes.
280 .Vt struct mdoc_macro ,
281 and many functions internal to the
285 Uses the opaque types
294 When this header is included, the same file should not include
305 .Vt struct roff_node .
310 .Vt struct man_macro ,
311 and many functions internal to the
315 Uses the opaque types
324 When this header is included, the same file should not include
346 .Vt struct tbl_node ,
348 .Vt struct eqn_node ,
349 and many functions internal to the
360 When this header is included, the same file should not include
367 .Ss Formatter interface
368 These headers should be included after any parser interface headers.
369 No parser internal headers should be included by the same file.
390 as an opaque type for function prototypes.
392 When this header is included, the same file should not include
410 .Vt struct termp_tbl ,
412 and many terminal formatting functions.
414 Uses the opaque types
432 as opaque types for function prototypes.
434 When this header is included, the same file should not include
459 .Vt struct htmlpair ,
461 and many HTML formatting functions.
468 When this header is included, the same file should not include
473 Provides the top level steering functions for all formatters.
487 as opaque types for function prototypes.
496 .Vt struct manpaths ,
497 .Vt struct manoutput ,
503 .It Qq Pa mansearch.h
516 .Vt struct mansearch ,
518 .Fn mansearch_setup ,
527 as an opaque type for function prototypes.
529 When this header is included, the same file should not include