Annotation of mandoc/libroff.h, Revision 1.5
1.5 ! kristaps 1: /* $Id: libroff.h,v 1.4 2010/12/29 01:18:23 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.2 kristaps 63: struct tbl {
1.5 ! kristaps 64: mandocmsg msg; /* status messages */
! 65: void *data; /* privdata for messages */
1.2 kristaps 66: enum tbl_part part;
67: char tab; /* cell-separator */
68: char decimal; /* decimal point */
69: int linesize;
70: char delims[2];
71: int opts;
72: #define TBL_OPT_CENTRE (1 << 0)
73: #define TBL_OPT_EXPAND (1 << 1)
74: #define TBL_OPT_BOX (1 << 2)
75: #define TBL_OPT_DBOX (1 << 3)
76: #define TBL_OPT_ALLBOX (1 << 4)
77: #define TBL_OPT_NOKEEP (1 << 5)
78: #define TBL_OPT_NOSPACE (1 << 6)
1.5 ! kristaps 79: struct tbl_row *first;
! 80: struct tbl_row *last;
1.2 kristaps 81: };
1.1 kristaps 82:
1.3 kristaps 83: #define TBL_MSG(tblp, type, line, col) \
84: (*(tblp)->msg)((type), (tblp)->data, (line), (col), NULL)
85:
86: struct tbl *tbl_alloc(void *, mandocmsg);
1.1 kristaps 87: void tbl_free(struct tbl *);
88: void tbl_reset(struct tbl *);
89: enum rofferr tbl_read(struct tbl *, int, const char *, int);
1.3 kristaps 90: int tbl_option(struct tbl *, int, const char *);
1.5 ! kristaps 91: int tbl_layout(struct tbl *, int, const char *);
1.1 kristaps 92:
93: __END_DECLS
94:
95: #endif /*LIBROFF_H*/
CVSweb