From 71ddcd873082a3c68ed2be7b7661075fb09d5849 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 20 Mar 2011 16:02:05 +0000 Subject: 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. --- libmdoc.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'libmdoc.h') diff --git a/libmdoc.h b/libmdoc.h index 5f6a3cac..9e3a3f55 100644 --- a/libmdoc.h +++ b/libmdoc.h @@ -1,4 +1,4 @@ -/* $Id: libmdoc.h,v 1.68 2011/03/17 11:30:23 kristaps Exp $ */ +/* $Id: libmdoc.h,v 1.69 2011/03/20 16:02:05 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -25,9 +25,8 @@ enum mdoc_next { }; struct mdoc { - void *data; /* private application data */ - mandocmsg msg; /* message callback */ - int flags; + struct mparse *parse; /* parse pointer */ + int flags; /* parse flags */ #define MDOC_HALT (1 << 0) /* error in parse: halt */ #define MDOC_LITERAL (1 << 1) /* in a literal scope */ #define MDOC_PBODY (1 << 2) /* in the document body */ @@ -86,11 +85,9 @@ extern const struct mdoc_macro *const mdoc_macros; __BEGIN_DECLS #define mdoc_pmsg(m, l, p, t) \ - (*(m)->msg)((t), (m)->data, (l), (p), NULL) + mandoc_msg((t), (m)->parse, (l), (p), NULL) #define mdoc_nmsg(m, n, t) \ - (*(m)->msg)((t), (m)->data, (n)->line, (n)->pos, NULL) -void mdoc_vmsg(struct mdoc *, enum mandocerr, - int, int, const char *, ...); + mandoc_msg((t), (m)->parse, (n)->line, (n)->pos, NULL) int mdoc_macro(MACRO_PROT_ARGS); int mdoc_word_alloc(struct mdoc *, int, int, const char *); -- cgit v1.2.3-56-ge451