]> git.cameronkatri.com Git - mandoc.git/blob - out.h
Remove duplicate UNCONST definition.
[mandoc.git] / out.h
1 /* $Id: out.h,v 1.17 2011/03/07 01:35:51 schwarze Exp $ */
2 /*
3 * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
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
20 __BEGIN_DECLS
21
22 struct roffcol {
23 size_t width; /* width of cell */
24 size_t decimal; /* decimal position in cell */
25 };
26
27 typedef size_t (*tbl_strlen)(const char *, void *);
28 typedef size_t (*tbl_len)(size_t, void *);
29
30 struct rofftbl {
31 tbl_strlen slen; /* calculate string length */
32 tbl_len len; /* produce width of empty space */
33 struct roffcol *cols; /* master column specifiers */
34 void *arg; /* passed to slen and len */
35 };
36
37 enum roffscale {
38 SCALE_CM,
39 SCALE_IN,
40 SCALE_PC,
41 SCALE_PT,
42 SCALE_EM,
43 SCALE_MM,
44 SCALE_EN,
45 SCALE_BU,
46 SCALE_VS,
47 SCALE_FS,
48 SCALE_MAX
49 };
50
51 enum roffdeco {
52 DECO_NONE,
53 DECO_NUMBERED, /* numbered character */
54 DECO_SPECIAL, /* special character */
55 DECO_SSPECIAL, /* single-char special */
56 DECO_RESERVED, /* reserved word */
57 DECO_BOLD, /* bold font */
58 DECO_ITALIC, /* italic font */
59 DECO_ROMAN, /* "normal" undecorated font */
60 DECO_PREVIOUS, /* revert to previous font */
61 DECO_NOSPACE, /* suppress spacing */
62 DECO_FONT, /* font */
63 DECO_FFONT, /* font family */
64 DECO_MAX
65 };
66
67 struct roffsu {
68 enum roffscale unit;
69 double scale;
70 };
71
72 #define SCALE_VS_INIT(p, v) \
73 do { (p)->unit = SCALE_VS; \
74 (p)->scale = (v); } \
75 while (/* CONSTCOND */ 0)
76
77 #define SCALE_HS_INIT(p, v) \
78 do { (p)->unit = SCALE_BU; \
79 (p)->scale = (v); } \
80 while (/* CONSTCOND */ 0)
81
82 int a2roffsu(const char *, struct roffsu *, enum roffscale);
83 int a2roffdeco(enum roffdeco *, const char **, size_t *);
84 void time2a(time_t, char *, size_t);
85 void tblcalc(struct rofftbl *tbl, const struct tbl_span *);
86
87 __END_DECLS
88
89 #endif /*!OUT_H*/