aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl_opts.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-02 10:10:57 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-02 10:10:57 +0000
commit56cfcaa84d0b04041aeeec950bddb179297ebd2d (patch)
treecbbb1fbf51f9aa2deeb6b182fd71077edf34cf0d /tbl_opts.c
parent3ffc6039a959f3b27d837b66a8856c2dc5f1b736 (diff)
downloadmandoc-56cfcaa84d0b04041aeeec950bddb179297ebd2d.tar.gz
mandoc-56cfcaa84d0b04041aeeec950bddb179297ebd2d.tar.zst
mandoc-56cfcaa84d0b04041aeeec950bddb179297ebd2d.zip
Churn to get parts of 'struct tbl' visible from mandoc.h: rename the
existing 'struct tbl' as 'struct tbl_node', then move all option stuff into a 'struct tbl' in mandoc.h. This conflicted with a structure in chars.c, which was renamed.
Diffstat (limited to 'tbl_opts.c')
-rw-r--r--tbl_opts.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/tbl_opts.c b/tbl_opts.c
index 91fd0ce5..8500b74d 100644
--- a/tbl_opts.c
+++ b/tbl_opts.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_opts.c,v 1.4 2010/12/29 14:38:14 kristaps Exp $ */
+/* $Id: tbl_opts.c,v 1.5 2011/01/02 10:10:57 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -71,11 +71,13 @@ static const struct tbl_phrase keys[KEY_MAXKEYS] = {
{ "nospaces", TBL_OPT_NOSPACE, KEY_NOSPACE},
};
-static int arg(struct tbl *, int, const char *, int *, int);
-static void opt(struct tbl *, int, const char *, int *);
+static int arg(struct tbl_node *, int,
+ const char *, int *, int);
+static void opt(struct tbl_node *, int,
+ const char *, int *);
static int
-arg(struct tbl *tbl, int ln, const char *p, int *pos, int key)
+arg(struct tbl_node *tbl, int ln, const char *p, int *pos, int key)
{
int i;
char buf[KEY_MAXNUMSZ];
@@ -100,18 +102,18 @@ arg(struct tbl *tbl, int ln, const char *p, int *pos, int key)
switch (key) {
case (KEY_DELIM):
- if ('\0' == (tbl->delims[0] = p[(*pos)++])) {
+ if ('\0' == (tbl->opts.delims[0] = p[(*pos)++])) {
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
return(0);
}
- if ('\0' == (tbl->delims[1] = p[(*pos)++])) {
+ if ('\0' == (tbl->opts.delims[1] = p[(*pos)++])) {
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
return(0);
}
break;
case (KEY_TAB):
- if ('\0' != (tbl->tab = p[(*pos)++]))
+ if ('\0' != (tbl->opts.tab = p[(*pos)++]))
break;
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
@@ -125,14 +127,14 @@ arg(struct tbl *tbl, int ln, const char *p, int *pos, int key)
if (i < KEY_MAXNUMSZ) {
buf[i] = '\0';
- tbl->linesize = atoi(buf);
+ tbl->opts.linesize = atoi(buf);
break;
}
(*tbl->msg)(MANDOCERR_TBL, tbl->data, ln, *pos, NULL);
return(0);
case (KEY_DPOINT):
- if ('\0' != (tbl->decimal = p[(*pos)++]))
+ if ('\0' != (tbl->opts.decimal = p[(*pos)++]))
break;
TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
@@ -152,7 +154,7 @@ arg(struct tbl *tbl, int ln, const char *p, int *pos, int key)
}
static void
-opt(struct tbl *tbl, int ln, const char *p, int *pos)
+opt(struct tbl_node *tbl, int ln, const char *p, int *pos)
{
int i, sv;
char buf[KEY_MAXNAME];
@@ -220,7 +222,7 @@ again: /*
*/
if (keys[i].key)
- tbl->opts |= keys[i].key;
+ tbl->opts.opts |= keys[i].key;
else if ( ! arg(tbl, ln, p, pos, keys[i].ident))
return;
@@ -240,7 +242,7 @@ again: /*
}
int
-tbl_option(struct tbl *tbl, int ln, const char *p)
+tbl_option(struct tbl_node *tbl, int ln, const char *p)
{
int pos;