MANDOC_HEADERS(3) | Library Functions Manual | MANDOC_HEADERS(3) |
mandoc_headers
—
ordering of mandoc include files
To support a cleaner coding style, the mandoc header files do not contain any include directives and do not guard against multiple inclusion. The application developer has to make sure that the headers are included in a proper order, and that no header is included more than once.
The headers and functions form three major groups: Parser interface, Parser internals, and Formatter interface.
Various rules are given below prohibiting the inclusion of certain combinations of headers into the same file. The intention is to keep the following functional components separate from each other:
Note that mere usage of an opaque struct type does not require inclusion of the header where that type is defined.
Each of the following headers can be included without including any other mandoc header. These headers should be included before any other mandoc headers.
Requires
<sys/types.h>
for size_t.
Provides the functions documented in mandoc_malloc(3).
Requires
<stddef.h>
for ptrdiff_t and
<stdint.h>
for uint32_t.
Includes
<ohash.h>
and provides
mandoc_ohash_init
().
Requires
<sys/types.h>
for size_t and
<stdio.h>
for FILE.
Provides enum
mandoc_esc, enum mandocerr,
enum mandoclevel, the function
mandoc_escape(3), the
functions described in
mchars_alloc(3), and
the
mandoc_msg*
()
functions.
Provides enum mandoc_os,
enum mdoc_endbody, enum
roff_macroset, enum roff_sec,
enum roff_tok, enum
roff_type, struct roff_man,
struct roff_meta, struct
roff_node, the constant array roff_name and
the function
deroff
().
Uses pointers to the types struct ohash from "mandoc_ohash.h", struct mdoc_arg and union mdoc_data from "mdoc.h", struct tbl_span from "tbl.h", and struct eqn_box from "eqn.h" as opaque struct members.
Requires
<sys/types.h>
for size_t and
"mandoc.h" for enum
mandoc_esc.
Provides enum tbl_cellt, enum tbl_datt, enum tbl_spant, struct tbl_opts, struct tbl_cell, struct tbl_row, struct tbl_dat, and struct tbl_span.
Requires
<sys/types.h>
for size_t.
Provides enum eqn_boxt, enum eqn_fontt, enum eqn_post, and struct eqn_box.
Requires "mandoc.h" for enum mandocerr and enum mandoclevel and "roff.h" for enum mandoc_os.
Uses the opaque type struct mparse from read.c for function prototypes. Uses struct roff_meta from "roff.h" as an opaque type for function prototypes.
Provides struct
mandoc_xr and the functions
mandoc_xr_reset
(),
mandoc_xr_add
(),
mandoc_xr_get
(),
and
mandoc_xr_free
().
Requires
<limits.h>
for INT_MAX
.
Provides the functions
tag_alloc
(),
tag_put
(),
tag_check
(),
and
tag_free
()
and some TAG_*
constants.
Uses the type struct roff_node from "roff.h" as an opaque type for function prototypes.
The following two require "roff.h" but no other mandoc headers. Afterwards, any other mandoc headers can be included as needed.
<sys/types.h>
for size_t.
Provides enum mdocargt,
enum mdoc_auth, enum
mdoc_disp, enum mdoc_font,
enum mdoc_list, struct
mdoc_argv, struct mdoc_arg,
struct mdoc_an, struct
mdoc_bd, struct mdoc_bf,
struct mdoc_bl, struct
mdoc_rs, union mdoc_data, and the functions
mdoc_*
()
described in mandoc(3).
Uses the types struct roff_node from "roff.h" and struct roff_man from "roff_int.h" as opaque types for function prototypes.
When this header is included, the same file should not include internals of different parsers.
man_*
()
described in mandoc(3).
Uses the type struct roff_man from "roff.h" as an opaque type for function prototypes.
When this header is included, the same file should not include internals of different parsers.
Most of the following headers require inclusion of a parser interface header before they can be included. All parser interface headers should precede all parser internal headers. When any parser internal headers are included, the same file should not include any formatter headers.
<sys/types.h>
for size_t and
"mandoc.h" for enum
mandocerr.
Provides struct buf, utility functions needed by multiple parsers, and the top-level functions to call the parsers.
Uses the opaque type struct roff from roff.c for function prototypes. Uses the type struct roff_man from "roff.h" as an opaque type for function prototypes.
Requires "roff.h" for enum roff_type and enum roff_tok.
Provides enum roff_next,
struct roff_man, functions named
roff_*
()
to handle roff nodes,
roffhash_alloc
(),
roffhash_find
(),
roffhash_free
(),
and
roff_validate
(),
and the two special functions
man_breakscope
()
and
mdoc_argv_free
()
because the latter two are needed by roff.c.
Uses the types struct ohash from "mandoc_ohash.h", struct roff_node and struct roff_meta from "roff.h", struct roff from roff.c, and struct mdoc_arg from "mdoc.h" as opaque types for function prototypes.
Provides enum margserr, enum mdelim, struct mdoc_macro, and many functions internal to the mdoc(7) parser.
Uses the types struct roff_node from "roff.h", struct roff_man from "roff_int.h", and struct mdoc_arg from "mdoc.h" as opaque types for function prototypes.
When this header is included, the same file should not include interfaces of different parsers.
Provides struct man_macro and some functions internal to the man(7) parser.
Uses the types struct roff_node from "roff.h" and struct roff_man from "roff_int.h" as opaque types for function prototypes.
When this header is included, the same file should not include interfaces of different parsers.
Requires
<sys/types.h>
for size_t.
Provides struct eqn_node
and the functions
eqn_alloc
(),
eqn_box_new
(),
eqn_box_free
(),
eqn_free
(),
eqn_parse
(),
eqn_read
(),
and
eqn_reset
().
Uses the type struct eqn_box from "mandoc.h" as an opaque type for function prototypes. Uses the types struct roff_node from "roff.h" and struct eqn_def from eqn.c as opaque struct members.
When this header is included, the same file should not include internals of different parsers.
Provides the functions documented in tbl(3).
Uses the types struct tbl_span from "tbl.h" and struct tbl_node from "tbl_int.h" as opaque types for function prototypes.
When this header is included, the same file should not include internals of different parsers.
Requires "tbl.h" for struct tbl_opts.
Provides enum tbl_part,
struct tbl_node, and the functions
tbl_option
(),
tbl_layout
(),
tbl_data
(),
tbl_cdata
(),
and
tbl_reset
().
When this header is included, the same file should not include interfaces of different parsers.
These headers should be included after any parser interface headers. No parser internal headers should be included by the same file.
<sys/types.h>
for size_t.
Provides enum roffscale,
struct roffcol, struct
roffsu, struct rofftbl,
a2roffsu
(),
and
tblcalc
().
Uses struct tbl_span from "mandoc.h" as an opaque type for function prototypes.
When this header is included, the same file should not include "mansearch.h".
<sys/types.h>
for size_t and
"out.h" for struct
roffsu and struct rofftbl.
Provides enum
termenc, enum termfont, enum
termtype, struct termp_tbl,
struct termp,
roff_term_pre
(),
and many terminal formatting functions.
Uses the opaque type struct termp_ps from term_ps.c. Uses struct tbl_span and struct eqn_box from "mandoc.h" and struct roff_meta and struct roff_node from "roff.h" as opaque types for function prototypes.
When this header is included, the same file should not include "html.h" or "mansearch.h".
<sys/types.h>
for size_t and
<stdio.h>
for FILE.
Provides an interface to generate
ctags(1) files
for the :t
functionality mentioned in
man(1).
Uses the type struct roff_node from "roff.h" as an opaque type for function prototypes.
When this header is included, the same file should not include "html.h" or "mansearch.h".
<sys/types.h>
for size_t,
"mandoc.h" for enum
mandoc_esc, "roff.h" for
enum roff_tok, and
"out.h" for struct
roffsu and struct rofftbl.
Provides enum
htmltag, enum htmlattr, enum
htmlfont, struct tag, struct
tagq, struct htmlpair,
struct html,
roff_html_pre
(),
and many HTML formatting functions.
Uses struct tbl_span and struct eqn_box from "mandoc.h" and struct roff_node from "roff.h" as opaque types for function prototypes.
When this header is included, the same file should not include "term.h", "tab_term.h", or "mansearch.h".
Uses the type struct roff_meta from "roff.h" as an opaque type for function prototypes.
<sys/types.h>
for size_t.
Provides struct
manconf, struct manpaths,
struct manoutput, and the functions
manconf_parse
(),
manconf_output
(),
manconf_free
(),
and
manpath_base
().
<sys/types.h>
for size_t and
<stdint.h>
for uint64_t.
Provides enum argmode,
struct manpage, struct
mansearch, and the functions
mansearch
()
and
mansearch_free
().
Uses struct manpaths from "manconf.h" as an opaque type for function prototypes.
When this header is included, the same file should not include "out.h", "term.h", "tab_term.h", or "html.h".
August 10, 2021 | OpenBSD 6.7 |