]>
git.cameronkatri.com Git - mandoc.git/blob - roff.h
1 /* $Id: roff.h,v 1.40 2017/02/16 03:00:23 schwarze Exp $ */
3 * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
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.
35 SEC_IMPLEMENTATION
, /* IMPLEMENTATION NOTES */
68 ROFF_NEXT_SIBLING
= 0,
73 * Indicates that a BODY's formatting has ended, but
74 * the scope is still open. Used for badly nested blocks.
78 ENDBODY_SPACE
/* Is broken: append a space. */
82 struct roff_node
*parent
; /* Parent AST node. */
83 struct roff_node
*child
; /* First child AST node. */
84 struct roff_node
*last
; /* Last child AST node. */
85 struct roff_node
*next
; /* Sibling AST node. */
86 struct roff_node
*prev
; /* Prior sibling AST node. */
87 struct roff_node
*head
; /* BLOCK */
88 struct roff_node
*body
; /* BLOCK/ENDBODY */
89 struct roff_node
*tail
; /* BLOCK */
90 struct mdoc_arg
*args
; /* BLOCK/ELEM */
91 union mdoc_data
*norm
; /* Normalized arguments. */
92 char *string
; /* TEXT */
93 const struct tbl_span
*span
; /* TBL */
94 const struct eqn
*eqn
; /* EQN */
95 int line
; /* Input file line number. */
96 int pos
; /* Input file column number. */
97 int tok
; /* Request or macro ID. */
98 #define TOKEN_NONE (-1) /* No request or macro. */
100 #define NODE_VALID (1 << 0) /* Has been validated. */
101 #define NODE_ENDED (1 << 1) /* Gone past body end mark. */
102 #define NODE_EOS (1 << 2) /* At sentence boundary. */
103 #define NODE_LINE (1 << 3) /* First macro/text on line. */
104 #define NODE_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting. */
105 #define NODE_BROKEN (1 << 5) /* Must validate parent when ending. */
106 #define NODE_DELIMO (1 << 6)
107 #define NODE_DELIMC (1 << 7)
108 #define NODE_NOSRC (1 << 8) /* Generated node, not in input file. */
109 #define NODE_NOPRT (1 << 9) /* Shall not print anything. */
110 int prev_font
; /* Before entering this node. */
111 int aux
; /* Decoded node data, type-dependent. */
112 enum roff_type type
; /* AST node type. */
113 enum roff_sec sec
; /* Current named section. */
114 enum mdoc_endbody end
; /* BODY */
118 char *msec
; /* Manual section, usually a digit. */
119 char *vol
; /* Manual volume title. */
120 char *os
; /* Operating system. */
121 char *arch
; /* Machine architecture. */
122 char *title
; /* Manual title, usually CAPS. */
123 char *name
; /* Leading manual name. */
124 char *date
; /* Normalized date. */
125 int hasbody
; /* Document is not empty. */
129 struct roff_meta meta
; /* Document meta-data. */
130 struct mparse
*parse
; /* Parse pointer. */
131 struct roff
*roff
; /* Roff parser state data. */
132 const char *defos
; /* Default operating system. */
133 struct roff_node
*first
; /* The first node parsed. */
134 struct roff_node
*last
; /* The last node parsed. */
135 struct roff_node
*last_es
; /* The most recent Es node. */
136 int quick
; /* Abort parse early. */
137 int flags
; /* Parse flags. */
138 #define MDOC_LITERAL (1 << 1) /* In a literal scope. */
139 #define MDOC_PBODY (1 << 2) /* In the document body. */
140 #define MDOC_NEWLINE (1 << 3) /* First macro/text in a line. */
141 #define MDOC_PHRASE (1 << 4) /* In a Bl -column phrase. */
142 #define MDOC_PHRASELIT (1 << 5) /* Literal within a phrase. */
143 #define MDOC_FREECOL (1 << 6) /* `It' invocation should close. */
144 #define MDOC_SYNOPSIS (1 << 7) /* SYNOPSIS-style formatting. */
145 #define MDOC_KEEP (1 << 8) /* In a word keep. */
146 #define MDOC_SMOFF (1 << 9) /* Spacing is off. */
147 #define MDOC_NODELIMC (1 << 10) /* Disable closing delimiter handling. */
148 #define MAN_ELINE (1 << 11) /* Next-line element scope. */
149 #define MAN_BLINE (1 << 12) /* Next-line block scope. */
150 #define MDOC_PHRASEQF (1 << 13) /* Quote first word encountered. */
151 #define MDOC_PHRASEQL (1 << 14) /* Quote last word of this phrase. */
152 #define MDOC_PHRASEQN (1 << 15) /* Quote first word of the next phrase. */
153 #define MAN_LITERAL MDOC_LITERAL
154 #define MAN_NEWLINE MDOC_NEWLINE
155 enum roff_macroset macroset
; /* Kind of high-level macros used. */
156 enum roff_sec lastsec
; /* Last section seen. */
157 enum roff_sec lastnamed
; /* Last standard section seen. */
158 enum roff_next next
; /* Where to put the next node. */
162 void deroff(char **, const struct roff_node
*);