[BACK]Return to out.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Annotation of src/usr.bin/mandoc/out.h, Revision 1.16

1.16    ! deraadt     1: /*     $OpenBSD: out.h,v 1.15 2014/10/14 02:16:02 schwarze Exp $ */
1.1       schwarze    2: /*
1.7       schwarze    3:  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
1.1       schwarze    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: enum   roffscale {
1.10      schwarze   18:        SCALE_CM, /* centimeters (c) */
                     19:        SCALE_IN, /* inches (i) */
                     20:        SCALE_PC, /* pica (P) */
                     21:        SCALE_PT, /* points (p) */
                     22:        SCALE_EM, /* ems (m) */
                     23:        SCALE_MM, /* mini-ems (M) */
                     24:        SCALE_EN, /* ens (n) */
                     25:        SCALE_BU, /* default horizontal (u) */
                     26:        SCALE_VS, /* default vertical (v) */
                     27:        SCALE_FS, /* syn. for u (f) */
1.1       schwarze   28:        SCALE_MAX
                     29: };
                     30:
1.10      schwarze   31: struct roffcol {
                     32:        size_t           width; /* width of cell */
                     33:        size_t           decimal; /* decimal position in cell */
1.15      schwarze   34:        int              flags; /* layout flags, see tbl_cell */
1.10      schwarze   35: };
                     36:
1.1       schwarze   37: struct roffsu {
                     38:        enum roffscale    unit;
                     39:        double            scale;
                     40: };
                     41:
1.10      schwarze   42: typedef        size_t  (*tbl_strlen)(const char *, void *);
                     43: typedef        size_t  (*tbl_len)(size_t, void *);
                     44:
                     45: struct rofftbl {
                     46:        tbl_strlen       slen; /* calculate string length */
                     47:        tbl_len          len; /* produce width of empty space */
                     48:        struct roffcol  *cols; /* master column specifiers */
                     49:        void            *arg; /* passed to slen and len */
                     50: };
                     51:
                     52: __BEGIN_DECLS
                     53:
1.1       schwarze   54: #define        SCALE_VS_INIT(p, v) \
                     55:        do { (p)->unit = SCALE_VS; \
1.5       schwarze   56:             (p)->scale = (v); } \
1.3       schwarze   57:        while (/* CONSTCOND */ 0)
                     58:
1.1       schwarze   59: #define        SCALE_HS_INIT(p, v) \
1.14      schwarze   60:        do { (p)->unit = SCALE_EN; \
1.5       schwarze   61:             (p)->scale = (v); } \
1.3       schwarze   62:        while (/* CONSTCOND */ 0)
1.1       schwarze   63:
1.13      schwarze   64: int              a2roffsu(const char *, struct roffsu *, enum roffscale);
1.15      schwarze   65: void             tblcalc(struct rofftbl *tbl,
                     66:                        const struct tbl_span *, size_t);
1.1       schwarze   67:
                     68: __END_DECLS