Annotation of mandoc/roff.h, Revision 1.30
1.28 schwarze 1: /* $OpenBSD$ */
1.1 kristaps 2: /*
1.28 schwarze 3: * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4: * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
1.1 kristaps 5: *
6: * Permission to use, copy, modify, and distribute this software for any
1.12 kristaps 7: * purpose with or without fee is hereby granted, provided that the above
8: * copyright notice and this permission notice appear in all copies.
1.1 kristaps 9: *
1.28 schwarze 10: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
1.12 kristaps 11: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1.28 schwarze 12: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
1.12 kristaps 13: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1 kristaps 17: */
18:
1.29 schwarze 19: struct mdoc_arg;
20: union mdoc_data;
21:
22: enum roff_sec {
23: SEC_NONE = 0,
24: SEC_NAME,
25: SEC_LIBRARY,
26: SEC_SYNOPSIS,
27: SEC_DESCRIPTION,
28: SEC_CONTEXT,
29: SEC_IMPLEMENTATION, /* IMPLEMENTATION NOTES */
30: SEC_RETURN_VALUES,
31: SEC_ENVIRONMENT,
32: SEC_FILES,
33: SEC_EXIT_STATUS,
34: SEC_EXAMPLES,
35: SEC_DIAGNOSTICS,
36: SEC_COMPATIBILITY,
37: SEC_ERRORS,
38: SEC_SEE_ALSO,
39: SEC_STANDARDS,
40: SEC_HISTORY,
41: SEC_AUTHORS,
42: SEC_CAVEATS,
43: SEC_BUGS,
44: SEC_SECURITY,
45: SEC_CUSTOM,
46: SEC__MAX
47: };
48:
1.28 schwarze 49: enum roff_type {
50: ROFFT_ROOT,
51: ROFFT_BLOCK,
52: ROFFT_HEAD,
53: ROFFT_BODY,
54: ROFFT_TAIL,
55: ROFFT_ELEM,
56: ROFFT_TEXT,
57: ROFFT_TBL,
58: ROFFT_EQN
1.29 schwarze 59: };
60:
61: /*
62: * Indicates that a BODY's formatting has ended, but
63: * the scope is still open. Used for badly nested blocks.
64: */
65: enum mdoc_endbody {
66: ENDBODY_NOT = 0,
67: ENDBODY_SPACE, /* Is broken: append a space. */
68: ENDBODY_NOSPACE /* Is broken: don't append a space. */
69: };
70:
71: struct roff_node {
72: struct roff_node *parent; /* Parent AST node. */
73: struct roff_node *child; /* First child AST node. */
74: struct roff_node *last; /* Last child AST node. */
75: struct roff_node *next; /* Sibling AST node. */
76: struct roff_node *prev; /* Prior sibling AST node. */
77: struct roff_node *head; /* BLOCK */
78: struct roff_node *body; /* BLOCK/ENDBODY */
79: struct roff_node *tail; /* BLOCK */
80: struct mdoc_arg *args; /* BLOCK/ELEM */
81: union mdoc_data *norm; /* Normalized arguments. */
82: char *string; /* TEXT */
83: const struct tbl_span *span; /* TBL */
84: const struct eqn *eqn; /* EQN */
85: int nchild; /* Number of child nodes. */
86: int line; /* Input file line number. */
87: int pos; /* Input file column number. */
88: int tok; /* Request or macro ID. */
89: int flags;
90: #define MDOC_VALID (1 << 0) /* Has been validated. */
91: #define MDOC_ENDED (1 << 1) /* Gone past body end mark. */
92: #define MDOC_EOS (1 << 2) /* At sentence boundary. */
93: #define MDOC_LINE (1 << 3) /* First macro/text on line. */
94: #define MDOC_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting. */
95: #define MDOC_BROKEN (1 << 5) /* Must validate parent when ending. */
96: #define MDOC_DELIMO (1 << 6)
97: #define MDOC_DELIMC (1 << 7)
98: #define MAN_VALID MDOC_VALID
99: #define MAN_EOS MDOC_EOS
100: #define MAN_LINE MDOC_LINE
101: int prev_font; /* Before entering this node. */
102: int aux; /* Decoded node data, type-dependent. */
103: enum roff_type type; /* AST node type. */
104: enum roff_sec sec; /* Current named section. */
105: enum mdoc_endbody end; /* BODY */
1.28 schwarze 106: };
1.30 ! schwarze 107:
! 108: struct roff_meta {
! 109: char *msec; /* Manual section, usually a digit. */
! 110: char *vol; /* Manual volume title. */
! 111: char *os; /* Operating system. */
! 112: char *arch; /* Machine architecture. */
! 113: char *title; /* Manual title, usually CAPS. */
! 114: char *name; /* Leading manual name. */
! 115: char *date; /* Normalized date. */
! 116: int hasbody; /* Document is not empty. */
! 117: };
CVSweb