-/* $Id: libmdoc.h,v 1.9 2009/06/15 10:02:52 kristaps Exp $ */
+/* $Id: libmdoc.h,v 1.10 2009/06/15 10:36:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
/*
* When GCC2 is deprecated, most of these can be reverted to #define
- * as mdoc_vmsg using __VA_ARGS__. Until then, use real functions.
+ * as mdoc_vXXX using __VA_ARGS__. Until then, use real functions.
*/
int mdoc_vwarn(struct mdoc *, int, int,
enum mdoc_warn, const char *, ...);
-void mdoc_vmsg(struct mdoc *, int, int,
- const char *, ...);
int mdoc_verr(struct mdoc *, int, int,
const char *, ...);
int mdoc_nerr(struct mdoc *, const struct mdoc_node *,
const char *, ...);
int mdoc_warn(struct mdoc *, enum mdoc_warn, const char *, ...);
int mdoc_err(struct mdoc *, const char *, ...);
-void mdoc_msg(struct mdoc *, const char *, ...);
-void mdoc_pmsg(struct mdoc *, int, int, const char *, ...);
int mdoc_pwarn(struct mdoc *, int, int,
enum mdoc_warn,const char *, ...);
int mdoc_perr(struct mdoc *, int, int, const char *, ...);
-/* $Id: main.c,v 1.27 2009/06/11 12:07:49 kristaps Exp $ */
+/* $Id: main.c,v 1.28 2009/06/15 10:36:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
struct mdoc *mdoc;
struct mdoc_cb mdoccb;
- mdoccb.mdoc_msg = NULL;
mdoccb.mdoc_err = merr;
mdoccb.mdoc_warn = mdocwarn;
-/* $Id: mdoc.c,v 1.79 2009/06/15 10:02:53 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.80 2009/06/15 10:36:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
}
-void
-mdoc_vmsg(struct mdoc *mdoc, int ln, int pos, const char *fmt, ...)
-{
- char buf[256];
- va_list ap;
-
- if (NULL == mdoc->cb.mdoc_msg)
- return;
-
- va_start(ap, fmt);
- (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
- va_end(ap);
- (*mdoc->cb.mdoc_msg)(mdoc->data, ln, pos, buf);
-}
-
-
int
mdoc_verr(struct mdoc *mdoc, int ln, int pos,
const char *fmt, ...)
}
-void
-mdoc_msg(struct mdoc *mdoc, const char *fmt, ...)
-{
- char buf[256];
- va_list ap;
-
- if (NULL == mdoc->cb.mdoc_msg)
- return;
-
- va_start(ap, fmt);
- (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
- va_end(ap);
- (*mdoc->cb.mdoc_msg)(mdoc->data, mdoc->last->line, mdoc->last->pos,
- buf);
-}
-
-
-void
-mdoc_pmsg(struct mdoc *mdoc, int line, int pos, const char *fmt, ...)
-{
- char buf[256];
- va_list ap;
-
- if (NULL == mdoc->cb.mdoc_msg)
- return;
-
- va_start(ap, fmt);
- (void)vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
- va_end(ap);
- (*mdoc->cb.mdoc_msg)(mdoc->data, line, pos, buf);
-}
-
-
int
mdoc_pwarn(struct mdoc *mdoc, int line, int pos, enum mdoc_warn type,
const char *fmt, ...)
-/* $Id: mdoc.h,v 1.57 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.58 2009/06/15 10:36:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
/* Call-backs for parse messages. */
struct mdoc_cb {
- void (*mdoc_msg)(void *, int, int, const char *);
int (*mdoc_err)(void *, int, int, const char *);
int (*mdoc_warn)(void *, int, int,
enum mdoc_warn, const char *);