[BACK]Return to libroff.h CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/libroff.h, Revision 1.10

1.10    ! kristaps    1: /*     $Id: libroff.h,v 1.9 2010/12/30 10:26:00 kristaps Exp $ */
1.1       kristaps    2: /*
                      3:  * Copyright (c) 2009, 2010 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 LIBROFF_H
                     18: #define LIBROFF_H
                     19:
                     20: __BEGIN_DECLS
                     21:
1.2       kristaps   22: enum   tbl_part {
                     23:        TBL_PART_OPTS, /* in options (first line) */
                     24:        TBL_PART_LAYOUT, /* describing layout */
                     25:        TBL_PART_DATA  /* creating data rows */
                     26: };
                     27:
1.5       kristaps   28: enum   tbl_cellt {
                     29:        TBL_CELL_CENTRE, /* c, C */
                     30:        TBL_CELL_RIGHT, /* r, R */
                     31:        TBL_CELL_LEFT, /* l, L */
                     32:        TBL_CELL_NUMBER, /* n, N */
                     33:        TBL_CELL_SPAN, /* s, S */
                     34:        TBL_CELL_LONG, /* a, A */
                     35:        TBL_CELL_DOWN, /* ^ */
                     36:        TBL_CELL_HORIZ, /* _, - */
                     37:        TBL_CELL_DHORIZ, /* = */
                     38:        TBL_CELL_VERT, /* | */
                     39:        TBL_CELL_DVERT, /* || */
                     40:        TBL_CELL_MAX
                     41: };
                     42:
                     43: struct tbl_cell {
                     44:        struct tbl_cell  *next;
                     45:        enum tbl_cellt    pos;
                     46:        int               spacing;
                     47:        int               flags;
                     48: #define        TBL_CELL_TALIGN  (1 << 0) /* t, T */
                     49: #define        TBL_CELL_BALIGN  (1 << 1) /* d, D */
                     50: #define        TBL_CELL_BOLD    (1 << 2) /* fB, B, b */
                     51: #define        TBL_CELL_ITALIC  (1 << 3) /* fI, I, i */
                     52: #define        TBL_CELL_EQUAL   (1 << 4) /* e, E */
                     53: #define        TBL_CELL_UP      (1 << 5) /* u, U */
                     54: #define        TBL_CELL_WIGN    (1 << 6) /* z, Z */
                     55: };
                     56:
                     57: struct tbl_row {
                     58:        struct tbl_row   *next;
                     59:        struct tbl_cell  *first;
                     60:        struct tbl_cell  *last;
                     61: };
                     62:
1.7       kristaps   63: struct tbl_dat {
1.9       kristaps   64:        struct tbl_cell  *layout; /* layout cell: CAN BE NULL */
1.7       kristaps   65:        struct tbl_dat   *next;
                     66:        char             *string;
                     67:        int               flags;
                     68: #define        TBL_DATA_HORIZ   (1 << 0)
                     69: #define        TBL_DATA_DHORIZ  (1 << 1)
                     70: #define        TBL_DATA_NHORIZ  (1 << 2)
                     71: #define        TBL_DATA_NDHORIZ (1 << 3)
                     72: };
                     73:
                     74: struct tbl_span {
1.9       kristaps   75:        struct tbl_row   *layout; /* layout row: CAN BE NULL */
1.7       kristaps   76:        struct tbl_dat   *first;
                     77:        struct tbl_dat   *last;
                     78:        int               flags;
                     79: #define        TBL_SPAN_HORIZ  (1 << 0)
                     80: #define        TBL_SPAN_DHORIZ (1 << 1)
1.8       kristaps   81:        struct tbl_span  *next;
1.7       kristaps   82: };
                     83:
1.2       kristaps   84: struct tbl {
1.5       kristaps   85:        mandocmsg         msg; /* status messages */
                     86:        void             *data; /* privdata for messages */
1.2       kristaps   87:        enum tbl_part     part;
                     88:        char              tab; /* cell-separator */
                     89:        char              decimal; /* decimal point */
                     90:        int               linesize;
                     91:        char              delims[2];
                     92:        int               opts;
                     93: #define        TBL_OPT_CENTRE   (1 << 0)
                     94: #define        TBL_OPT_EXPAND   (1 << 1)
                     95: #define        TBL_OPT_BOX      (1 << 2)
                     96: #define        TBL_OPT_DBOX     (1 << 3)
                     97: #define        TBL_OPT_ALLBOX   (1 << 4)
                     98: #define        TBL_OPT_NOKEEP   (1 << 5)
                     99: #define        TBL_OPT_NOSPACE  (1 << 6)
1.8       kristaps  100:        struct tbl_row   *first_row;
                    101:        struct tbl_row   *last_row;
                    102:        struct tbl_span  *first_span;
                    103:        struct tbl_span  *last_span;
1.10    ! kristaps  104:        struct tbl       *next;
1.2       kristaps  105: };
1.1       kristaps  106:
1.3       kristaps  107: #define        TBL_MSG(tblp, type, line, col) \
                    108:        (*(tblp)->msg)((type), (tblp)->data, (line), (col), NULL)
                    109:
                    110: struct tbl     *tbl_alloc(void *, mandocmsg);
1.6       kristaps  111: void            tbl_restart(struct tbl *);
1.1       kristaps  112: void            tbl_free(struct tbl *);
                    113: void            tbl_reset(struct tbl *);
                    114: enum rofferr    tbl_read(struct tbl *, int, const char *, int);
1.3       kristaps  115: int             tbl_option(struct tbl *, int, const char *);
1.5       kristaps  116: int             tbl_layout(struct tbl *, int, const char *);
1.8       kristaps  117: int             tbl_data(struct tbl *, int, const char *);
1.1       kristaps  118:
                    119: __END_DECLS
                    120:
                    121: #endif /*LIBROFF_H*/

CVSweb