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 ,
105 the function prototype typedef
108 .Xr mandoc_escape 3 ,
109 the functions described in
120 for function prototypes.
125 as an opaque type for function prototypes.
128 .Qq Pa mandoc_ohash.h
137 .Vt enum mdoc_endbody ,
138 .Vt enum roff_macroset ,
143 .Vt struct roff_man ,
144 .Vt struct roff_meta ,
145 .Vt struct roff_node ,
156 Uses pointers to the types
162 as opaque struct members.
165 The following two require
167 but no other mandoc headers.
168 Afterwards, any other mandoc headers can be included as needed.
182 .Vt struct mdoc_argv ,
183 .Vt struct mdoc_arg ,
189 .Vt union mdoc_data ,
199 as an opaque type for function prototypes.
201 When this header is included, the same file should not include
206 Provides the functions
215 for function prototypes.
220 as an opaque type for function prototypes.
222 When this header is included, the same file should not include
228 The following headers require inclusion of a parser interface header
229 before they can be included.
230 All parser interface headers should precede all parser internal headers.
231 When any parser internal headers are included, the same file should
232 not include any formatter headers.
234 .It Qq Pa libmandoc.h
247 utility functions needed by multiple parsers,
248 and the top-level functions to call the parsers.
250 Uses the opaque types
258 for function prototypes.
269 as opaque types for function prototypes.
276 Provides functions named
278 to handle roff nodes and the two special functions
282 because the latter two are needed by
300 as opaque types for function prototypes.
316 .Vt struct mdoc_macro ,
317 and many functions internal to the
331 as opaque types for function prototypes.
333 When this header is included, the same file should not include
346 and some functions internal to the
356 as opaque types for function prototypes.
358 When this header is included, the same file should not include
380 .Vt struct tbl_node ,
382 .Vt struct eqn_node ,
383 and many functions internal to the
394 When this header is included, the same file should not include
401 .Ss Formatter interface
402 These headers should be included after any parser interface headers.
403 No parser internal headers should be included by the same file.
424 as an opaque type for function prototypes.
426 When this header is included, the same file should not include
444 .Vt struct termp_tbl ,
447 and many terminal formatting functions.
465 as opaque types for function prototypes.
467 When this header is included, the same file should not include
489 .Vt struct htmlpair ,
492 and many HTML formatting functions.
504 as opaque types for function prototypes.
506 When this header is included, the same file should not include
516 Provides an interface to generate
520 functionality mentioned in
523 Provides the top level steering functions for all formatters.
529 as an opaque type for function prototypes.
538 .Vt struct manpaths ,
539 .Vt struct manoutput ,
545 .It Qq Pa mansearch.h
558 .Vt struct mansearch ,
568 as an opaque type for function prototypes.
570 When this header is included, the same file should not include