Annotation of mandoc/out.h, Revision 1.16
1.16 ! schwarze 1: /* $Id: out.h,v 1.15 2011/01/05 15:37:23 kristaps Exp $ */
1.1 kristaps 2: /*
1.16 ! schwarze 3: * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.1 kristaps 4: *
5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
8: *
9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: */
17: #ifndef OUT_H
18: #define OUT_H
19:
1.6 kristaps 20: #define DATESIZ 24
21:
1.1 kristaps 22: __BEGIN_DECLS
23:
1.15 kristaps 24: struct roffcol {
25: size_t width; /* width of cell */
26: size_t decimal; /* decimal position in cell */
27: };
28:
29: typedef size_t (*tbl_strlen)(const char *, void *);
30: typedef size_t (*tbl_len)(size_t, void *);
31:
32: struct rofftbl {
33: tbl_strlen slen; /* calculate string length */
34: tbl_len len; /* produce width of empty space */
35: struct roffcol *cols; /* master column specifiers */
36: void *arg; /* passed to slen and len */
37: };
38:
1.3 kristaps 39: enum roffscale {
40: SCALE_CM,
41: SCALE_IN,
42: SCALE_PC,
43: SCALE_PT,
44: SCALE_EM,
45: SCALE_MM,
46: SCALE_EN,
47: SCALE_BU,
48: SCALE_VS,
49: SCALE_FS,
50: SCALE_MAX
51: };
52:
1.7 kristaps 53: enum roffdeco {
54: DECO_NONE,
1.16 ! schwarze 55: DECO_NUMBERED, /* numbered character */
1.14 kristaps 56: DECO_SPECIAL, /* special character */
57: DECO_SSPECIAL, /* single-char special */
58: DECO_RESERVED, /* reserved word */
1.15 kristaps 59: DECO_BOLD, /* bold font */
60: DECO_ITALIC, /* italic font */
61: DECO_ROMAN, /* "normal" undecorated font */
62: DECO_PREVIOUS, /* revert to previous font */
63: DECO_NOSPACE, /* suppress spacing */
1.10 kristaps 64: DECO_FONT, /* font */
65: DECO_FFONT, /* font family */
1.7 kristaps 66: DECO_MAX
67: };
68:
1.3 kristaps 69: struct roffsu {
70: enum roffscale unit;
1.4 kristaps 71: double scale;
1.3 kristaps 72: };
73:
74: #define SCALE_VS_INIT(p, v) \
75: do { (p)->unit = SCALE_VS; \
1.12 kristaps 76: (p)->scale = (v); } \
1.8 kristaps 77: while (/* CONSTCOND */ 0)
78:
1.3 kristaps 79: #define SCALE_HS_INIT(p, v) \
80: do { (p)->unit = SCALE_BU; \
1.12 kristaps 81: (p)->scale = (v); } \
1.8 kristaps 82: while (/* CONSTCOND */ 0)
1.3 kristaps 83:
1.15 kristaps 84: int a2roffsu(const char *, struct roffsu *, enum roffscale);
85: int a2roffdeco(enum roffdeco *, const char **, size_t *);
86: void time2a(time_t, char *, size_t);
87: void tblcalc(struct rofftbl *tbl, const struct tbl_span *);
1.1 kristaps 88:
89: __END_DECLS
90:
1.15 kristaps 91: #endif /*!OUT_H*/
CVSweb