]>
git.cameronkatri.com Git - mandoc.git/blob - roff.h
1 /* $Id: roff.h,v 1.71 2020/02/27 01:43:52 schwarze Exp $ */
3 * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2013-2015, 2017-2020 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.
18 * Common data types for all syntax trees and related functions.
40 SEC_IMPLEMENTATION
, /* IMPLEMENTATION NOTES */
194 /* MAN_in; ignored in mdoc(7) */
483 * Indicates that a BODY's formatting has ended, but
484 * the scope is still open. Used for badly nested blocks.
488 ENDBODY_SPACE
/* Is broken: append a space. */
498 struct roff_node
*parent
; /* Parent AST node. */
499 struct roff_node
*child
; /* First child AST node. */
500 struct roff_node
*last
; /* Last child AST node. */
501 struct roff_node
*next
; /* Sibling AST node. */
502 struct roff_node
*prev
; /* Prior sibling AST node. */
503 struct roff_node
*head
; /* BLOCK */
504 struct roff_node
*body
; /* BLOCK/ENDBODY */
505 struct roff_node
*tail
; /* BLOCK */
506 struct mdoc_arg
*args
; /* BLOCK/ELEM */
507 union mdoc_data
*norm
; /* Normalized arguments. */
508 char *string
; /* TEXT */
509 struct tbl_span
*span
; /* TBL */
510 struct eqn_box
*eqn
; /* EQN */
511 int line
; /* Input file line number. */
512 int pos
; /* Input file column number. */
514 #define NODE_VALID (1 << 0) /* Has been validated. */
515 #define NODE_ENDED (1 << 1) /* Gone past body end mark. */
516 #define NODE_BROKEN (1 << 2) /* Must validate parent when ending. */
517 #define NODE_LINE (1 << 3) /* First macro/text on line. */
518 #define NODE_DELIMO (1 << 4)
519 #define NODE_DELIMC (1 << 5)
520 #define NODE_EOS (1 << 6) /* At sentence boundary. */
521 #define NODE_SYNPRETTY (1 << 7) /* SYNOPSIS-style formatting. */
522 #define NODE_NOFILL (1 << 8) /* Fill mode switched off. */
523 #define NODE_NOSRC (1 << 9) /* Generated node, not in input file. */
524 #define NODE_NOPRT (1 << 10) /* Shall not print anything. */
525 int prev_font
; /* Before entering this node. */
526 int aux
; /* Decoded node data, type-dependent. */
527 enum roff_tok tok
; /* Request or macro ID. */
528 enum roff_type type
; /* AST node type. */
529 enum roff_sec sec
; /* Current named section. */
530 enum mdoc_endbody end
; /* BODY */
534 struct roff_node
*first
; /* The first node parsed. */
535 char *msec
; /* Manual section, usually a digit. */
536 char *vol
; /* Manual volume title. */
537 char *os
; /* Operating system. */
538 char *arch
; /* Machine architecture. */
539 char *title
; /* Manual title, usually CAPS. */
540 char *name
; /* Leading manual name. */
541 char *date
; /* Normalized date. */
542 char *sodest
; /* .so target file name or NULL. */
543 int hasbody
; /* Document is not empty. */
544 int rcsids
; /* Bits indexed by enum mandoc_os. */
545 enum mandoc_os os_e
; /* Operating system. */
546 enum roff_macroset macroset
; /* Kind of high-level macros used. */
549 extern const char *const *roff_name
;
552 int arch_valid(const char *, enum mandoc_os
);
553 void deroff(char **, const struct roff_node
*);
554 struct roff_node
*roff_node_child(struct roff_node
*);
555 struct roff_node
*roff_node_next(struct roff_node
*);
556 struct roff_node
*roff_node_prev(struct roff_node
*);
557 int roff_node_transparent(struct roff_node
*);