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 ,
151 Uses pointers to the types
157 as opaque struct members.
160 The following two require
162 but no other mandoc headers.
163 Afterwards, any other mandoc headers can be included as needed.
177 .Vt struct mdoc_argv ,
178 .Vt struct mdoc_arg ,
184 .Vt union mdoc_data ,
194 as an opaque type for function prototypes.
196 When this header is included, the same file should not include
201 Provides the functions
210 for function prototypes.
215 as an opaque type for function prototypes.
217 When this header is included, the same file should not include
223 The following headers require inclusion of a parser interface header
224 before they can be included.
225 All parser interface headers should precede all parser internal headers.
226 When any parser internal headers are included, the same file should
227 not include any formatter headers.
229 .It Qq Pa libmandoc.h
242 utility functions needed by multiple parsers,
243 and the top-level functions to call the parsers.
245 Uses the opaque types
253 for function prototypes.
264 as opaque types for function prototypes.
271 Provides functions named
273 to handle roff nodes and the two special functions
277 because the latter two are needed by
295 as opaque types for function prototypes.
311 .Vt struct mdoc_macro ,
312 and many functions internal to the
326 as opaque types for function prototypes.
328 When this header is included, the same file should not include
341 and some functions internal to the
351 as opaque types for function prototypes.
353 When this header is included, the same file should not include
375 .Vt struct tbl_node ,
377 .Vt struct eqn_node ,
378 and many functions internal to the
389 When this header is included, the same file should not include
396 .Ss Formatter interface
397 These headers should be included after any parser interface headers.
398 No parser internal headers should be included by the same file.
419 as an opaque type for function prototypes.
421 When this header is included, the same file should not include
439 .Vt struct termp_tbl ,
442 and many terminal formatting functions.
460 as opaque types for function prototypes.
462 When this header is included, the same file should not include
484 .Vt struct htmlpair ,
487 and many HTML formatting functions.
499 as opaque types for function prototypes.
501 When this header is included, the same file should not include
511 Provides an interface to generate
515 functionality mentioned in
518 Provides the top level steering functions for all formatters.
524 as an opaque type for function prototypes.
533 .Vt struct manpaths ,
534 .Vt struct manoutput ,
540 .It Qq Pa mansearch.h
553 .Vt struct mansearch ,
563 as an opaque type for function prototypes.
565 When this header is included, the same file should not include