1 .Dd $Mdocdate: July 8 2017 $
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 ,
102 .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.
125 .It Qq Pa mandoc_xr.h
129 .Fn mandoc_xr_reset ,
136 .Qq Pa mandoc_ohash.h
145 .Vt enum mdoc_endbody ,
146 .Vt enum roff_macroset ,
151 .Vt struct roff_man ,
152 .Vt struct roff_meta ,
153 .Vt struct roff_node ,
164 Uses pointers to the types
170 as opaque struct members.
173 The following two require
175 but no other mandoc headers.
176 Afterwards, any other mandoc headers can be included as needed.
190 .Vt struct mdoc_argv ,
191 .Vt struct mdoc_arg ,
197 .Vt union mdoc_data ,
207 as an opaque type for function prototypes.
209 When this header is included, the same file should not include
214 Provides the functions
223 for function prototypes.
228 as an opaque type for function prototypes.
230 When this header is included, the same file should not include
236 The following headers require inclusion of a parser interface header
237 before they can be included.
238 All parser interface headers should precede all parser internal headers.
239 When any parser internal headers are included, the same file should
240 not include any formatter headers.
242 .It Qq Pa libmandoc.h
255 utility functions needed by multiple parsers,
256 and the top-level functions to call the parsers.
258 Uses the opaque types
266 for function prototypes.
271 as an opaque type for function prototypes.
278 Provides functions named
280 to handle roff nodes and the two special functions
284 because the latter two are needed by
297 as opaque types for function prototypes.
313 .Vt struct mdoc_macro ,
314 and many functions internal to the
328 as opaque types for function prototypes.
330 When this header is included, the same file should not include
343 and some functions internal to the
353 as opaque types for function prototypes.
355 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 ,
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