]>
git.cameronkatri.com Git - mandoc.git/blob - term.h
1 /* $Id: term.h,v 1.27 2009/03/19 11:49:00 kristaps Exp $ */
3 * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
24 /* FIXME - clean up tabs. */
31 size_t rmargin
; /* Current right margin. */
32 size_t maxrmargin
; /* Max right margin. */
33 size_t maxcols
; /* Max size of buf. */
34 size_t offset
; /* Margin offest. */
35 size_t col
; /* Bytes in buf. */
37 #define TERMP_NOSPACE (1 << 0) /* No space before words. */
38 #define TERMP_NOLPAD (1 << 1) /* No leftpad before flush. */
39 #define TERMP_NOBREAK (1 << 2) /* No break after flush. */
40 #define TERMP_LITERAL (1 << 3) /* Literal words. */
41 #define TERMP_IGNDELIM (1 << 4) /* Delims like regulars. */
42 #define TERMP_NONOSPACE (1 << 5) /* No space (no autounset). */
43 #define TERMP_NONOBREAK (1 << 7) /* Don't newln NOBREAK. */
44 #define TERMP_STYLE 0x0300 /* Style mask. */
45 #define TERMP_BOLD (1 << 8) /* Styles... */
46 #define TERMP_UNDER (1 << 9)
47 char *buf
; /* Output buffer. */
48 void *symtab
; /* Encoded-symbol table. */
51 /* XXX - clean this up. */
54 struct termpair
*ppair
;
56 #define TERMPAIR_FLAG (1 << 0)
63 #define TERMPAIR_SETFLAG(termp, p, fl) \
65 assert(! (TERMPAIR_FLAG & (p)->type)); \
66 (termp)->flags |= (fl); \
68 (p)->type |= TERMPAIR_FLAG; \
72 int (*pre
)(struct termp
*, struct termpair
*,
73 const struct mdoc_meta
*,
74 const struct mdoc_node
*);
75 void (*post
)(struct termp
*, struct termpair
*,
76 const struct mdoc_meta
*,
77 const struct mdoc_node
*);
80 void *ascii2htab(void);
81 const char *a2ascii(void *, const char *, size_t, size_t *);
82 void asciifree(void *);
84 void newln(struct termp
*);
85 void vspace(struct termp
*);
86 void word(struct termp
*, const char *);
87 void flushln(struct termp
*);
88 void transcode(struct termp
*, const char *, size_t);
89 void subtree(struct termp
*, const struct mdoc_meta
*,
90 const struct mdoc_node
*);
92 const struct termact
*termacts
;