1 .Dd $Mdocdate: August 24 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
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
254 utility functions needed by multiple parsers,
255 and the top-level functions to call the parsers.
257 Uses the opaque types
265 for function prototypes.
270 as an opaque type for function prototypes.
277 Provides functions named
279 to handle roff nodes and the two special functions
283 because the latter two are needed by
296 as opaque types for function prototypes.
312 .Vt struct mdoc_macro ,
313 and many functions internal to the
327 as opaque types for function prototypes.
329 When this header is included, the same file should not include
342 and some functions internal to the
352 as opaque types for function prototypes.
354 When this header is included, the same file should not include
373 .Vt struct tbl_node ,
375 .Vt struct eqn_node ,
376 and many functions internal to the
387 When this header is included, the same file should not include
394 .Ss Formatter interface
395 These headers should be included after any parser interface headers.
396 No parser internal headers should be included by the same file.
417 as an opaque type for function prototypes.
419 When this header is included, the same file should not include
437 .Vt struct termp_tbl ,
440 and many terminal formatting functions.
458 as opaque types for function prototypes.
460 When this header is included, the same file should not include
482 .Vt struct htmlpair ,
485 and many HTML formatting functions.
497 as opaque types for function prototypes.
499 When this header is included, the same file should not include
509 Provides an interface to generate
513 functionality mentioned in
516 Provides the top level steering functions for all formatters.
522 as an opaque type for function prototypes.
531 .Vt struct manpaths ,
532 .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