=================================================================== RCS file: /cvs/mandoc/libmdoc.h,v retrieving revision 1.5 retrieving revision 1.9 diff -u -p -r1.5 -r1.9 --- mandoc/libmdoc.h 2009/04/12 19:29:53 1.5 +++ mandoc/libmdoc.h 2009/06/15 10:02:52 1.9 @@ -1,20 +1,18 @@ -/* $Id: libmdoc.h,v 1.5 2009/04/12 19:29:53 kristaps Exp $ */ +/* $Id: libmdoc.h,v 1.9 2009/06/15 10:02:52 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies. + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef LIBMDOC_H #define LIBMDOC_H @@ -57,48 +55,29 @@ struct mdoc_macro { /* Reserved words in arguments treated as text. */ }; -#define mdoc_nwarn(mdoc, node, type, fmt, ...) \ - mdoc_vwarn((mdoc), (node)->line, \ - (node)->pos, (type), (fmt), ##__VA_ARGS__) - -#define mdoc_nerr(mdoc, node, fmt, ...) \ - mdoc_verr((mdoc), (node)->line, \ - (node)->pos, (fmt), ##__VA_ARGS__) - -#define mdoc_warn(mdoc, type, fmt, ...) \ - mdoc_vwarn((mdoc), (mdoc)->last->line, \ - (mdoc)->last->pos, (type), (fmt), ##__VA_ARGS__) - -#define mdoc_err(mdoc, fmt, ...) \ - mdoc_verr((mdoc), (mdoc)->last->line, \ - (mdoc)->last->pos, (fmt), ##__VA_ARGS__) - -#define mdoc_msg(mdoc, fmt, ...) \ - mdoc_vmsg((mdoc), (mdoc)->last->line, \ - (mdoc)->last->pos, (fmt), ##__VA_ARGS__) - -#define mdoc_pmsg(mdoc, line, pos, fmt, ...) \ - mdoc_vmsg((mdoc), (line), \ - (pos), (fmt), ##__VA_ARGS__) - -#define mdoc_pwarn(mdoc, line, pos, type, fmt, ...) \ - mdoc_vwarn((mdoc), (line), \ - (pos), (type), (fmt), ##__VA_ARGS__) - -#define mdoc_perr(mdoc, line, pos, fmt, ...) \ - mdoc_verr((mdoc), (line), \ - (pos), (fmt), ##__VA_ARGS__) - extern const struct mdoc_macro *const mdoc_macros; __BEGIN_DECLS +/* + * When GCC2 is deprecated, most of these can be reverted to #define + * as mdoc_vmsg 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 *, ...); int mdoc_macro(MACRO_PROT_ARGS); int mdoc_word_alloc(struct mdoc *, int, int, const char *);