Wed, 06 Oct 2004 18:24:41 +0200
trunk: changeset 1789
Added some macros.
58 | 1 | /* |
2 | * libtu/output.h | |
3 | * | |
4 | * Copyright (c) Tuomo Valkonen 1999-2002. | |
5 | * | |
6 | * You may distribute and modify this library under the terms of either | |
7 | * the Clarified Artistic License or the GNU LGPL, version 2.1 or later. | |
8 | */ | |
9 | ||
10 | #ifndef LIBTU_OUTPUT_H | |
11 | #define LIBTU_OUTPUT_H | |
12 | ||
13 | #include <stdarg.h> | |
14 | ||
15 | #include "types.h" | |
16 | ||
81 | 17 | #if __STDC_VERSION__ >= 199901L |
18 | #define WARN_FUNC(...) warn_obj(__func__, __VA_ARGS__) | |
19 | #define WARN_ERR_FUNC() warn_err_obj(__func__) | |
20 | #else | |
21 | #define WARN_FUNC warn | |
22 | #define WARN_ERR_FUNC() warn_err() | |
23 | #endif | |
24 | ||
58 | 25 | typedef void WarnHandler(const char *); |
26 | extern WarnHandler *set_warn_handler(WarnHandler *handler); | |
27 | ||
28 | extern void verbose(const char *p, ...); | |
29 | extern void verbose_v(const char *p, va_list args); | |
30 | extern void verbose_enable(bool enable); | |
31 | extern int verbose_indent(int depth); | |
32 | ||
33 | extern void warn_progname_enable(bool enable); | |
34 | ||
35 | extern void die(const char *p, ...); | |
36 | extern void die_v(const char *p, va_list args); | |
37 | ||
38 | extern void die_obj(const char *obj, const char *p, ...); | |
39 | extern void die_obj_v(const char *obj, const char *p, va_list args); | |
40 | extern void die_obj_line(const char *obj, int line, const char *p, ...); | |
41 | extern void die_obj_line_v(const char *obj, int line, const char *p, va_list args); | |
42 | ||
43 | extern void die_err(); | |
44 | extern void die_err_obj(const char *obj); | |
45 | extern void die_err_obj_line(const char *obj, int line); | |
46 | ||
47 | ||
48 | extern void warn(const char *p, ...); | |
49 | extern void warn_v(const char *p, va_list args); | |
50 | ||
51 | extern void warn_obj(const char *obj, const char *p, ...); | |
52 | extern void warn_obj_v(const char *obj, const char *p, va_list args); | |
53 | extern void warn_obj_line(const char *obj, int line, const char *p, ...); | |
54 | extern void warn_obj_line_v(const char *obj, int line, const char *p, va_list args); | |
55 | ||
56 | extern void warn_err(); | |
57 | extern void warn_err_obj(const char *obj); | |
58 | extern void warn_err_obj_line(const char *obj, int line); | |
59 | ||
60 | ||
61 | extern char *errmsg(const char *p, ...); | |
62 | extern char *errmsg_v(const char *p, va_list args); | |
63 | ||
64 | extern char *errmsg_obj(const char *obj, const char *p, ...); | |
65 | extern char *errmsg_obj_v(const char *obj, const char *p, va_list args); | |
66 | extern char *errmsg_obj_line(const char *obj, int line, const char *p, ...); | |
67 | extern char *errmsg_obj_line_v(const char *obj, int line, const char *p, va_list args); | |
68 | ||
69 | extern char *errmsg_err(); | |
70 | extern char *errmsg_err_obj(const char *obj); | |
71 | extern char *errmsg_err_obj_line(const char *obj, int line); | |
72 | ||
73 | extern void libtu_asprintf(char **ret, const char *fmt, ...); | |
74 | extern void libtu_vasprintf(char **ret, const char *fmt, va_list args); | |
75 | ||
76 | #endif /* LIBTU_OUTPUT_H */ |