aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl_opts.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-20 16:02:05 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-20 16:02:05 +0000
commit71ddcd873082a3c68ed2be7b7661075fb09d5849 (patch)
tree7eb75a067079e8a591b76791b56f0b7673b109d5 /tbl_opts.c
parent58ca7d3112e5d39b93ab732cf103b4b0b834b106 (diff)
downloadmandoc-71ddcd873082a3c68ed2be7b7661075fb09d5849.tar.gz
mandoc-71ddcd873082a3c68ed2be7b7661075fb09d5849.tar.zst
mandoc-71ddcd873082a3c68ed2be7b7661075fb09d5849.zip
Consolidate messages. Have all parse-time messages (in libmdoc,
libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the time being in libmandoc.h. This requires struct mparse to be passed into the allocation routines instead of mandocmsg and a void pointer. Then, move some of the functionality of the old mmsg() into read.c's mparse_mmsg() (check against wlevel and setting of file_status) and use main.c's mmsg() as simply a printing tool.
Diffstat (limited to 'tbl_opts.c')
-rw-r--r--tbl_opts.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/tbl_opts.c b/tbl_opts.c
index 52a0403c..dbdcaa81 100644
--- a/tbl_opts.c
+++ b/tbl_opts.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_opts.c,v 1.9 2011/03/15 16:23:51 kristaps Exp $ */
+/* $Id: tbl_opts.c,v 1.10 2011/03/20 16:02:05 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -20,6 +20,7 @@
#include <string.h>
#include "mandoc.h"
+#include "libmandoc.h"
#include "libroff.h"
enum tbl_ident {
@@ -88,7 +89,8 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
/* Arguments always begin with a parenthesis. */
if ('(' != p[*pos]) {
- TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse,
+ ln, *pos, NULL);
return(0);
}
@@ -103,12 +105,14 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
switch (key) {
case (KEY_DELIM):
if ('\0' == p[(*pos)++]) {
- TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse,
+ ln, *pos - 1, NULL);
return(0);
}
if ('\0' == p[(*pos)++]) {
- TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse,
+ ln, *pos - 1, NULL);
return(0);
}
break;
@@ -116,7 +120,8 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
if ('\0' != (tbl->opts.tab = p[(*pos)++]))
break;
- TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse,
+ ln, *pos - 1, NULL);
return(0);
case (KEY_LINESIZE):
for (i = 0; i < KEY_MAXNUMSZ && p[*pos]; i++, (*pos)++) {
@@ -131,13 +136,14 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
break;
}
- (*tbl->msg)(MANDOCERR_TBL, tbl->data, ln, *pos, NULL);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos, NULL);
return(0);
case (KEY_DPOINT):
if ('\0' != (tbl->opts.decimal = p[(*pos)++]))
break;
- TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse,
+ ln, *pos - 1, NULL);
return(0);
default:
abort();
@@ -149,7 +155,7 @@ arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key)
if (')' == p[(*pos)++])
return(1);
- TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos - 1);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos - 1, NULL);
return(0);
}
@@ -196,7 +202,7 @@ again: /*
/* Exit if buffer is empty (or overrun). */
if (KEY_MAXNAME == i || 0 == i) {
- TBL_MSG(tbl, MANDOCERR_TBL, ln, *pos);
+ mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos, NULL);
return;
}
@@ -235,7 +241,7 @@ again: /*
*/
if (KEY_MAXKEYS == i)
- TBL_MSG(tbl, MANDOCERR_TBLOPT, ln, sv);
+ mandoc_msg(MANDOCERR_TBLOPT, tbl->parse, ln, sv, NULL);
goto again;
/* NOTREACHED */