4 * Copyright (c) Tuomo Valkonen 1999-2002.
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.
10 #ifndef LIBTU_OUTPUT_H
11 #define LIBTU_OUTPUT_H
17 #if __STDC_VERSION__ >= 199901L
18 #define WARN_FUNC(...) warn_obj(__func__, __VA_ARGS__)
19 #define WARN_ERR_FUNC() warn_err_obj(__func__)
21 #define WARN_FUNC warn
22 #define WARN_ERR_FUNC() warn_err()
25 typedef void WarnHandler(const char *);
26 extern WarnHandler
*set_warn_handler(WarnHandler
*handler
);
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
);
33 extern void warn_progname_enable(bool enable
);
35 extern void die(const char *p
, ...);
36 extern void die_v(const char *p
, va_list args
);
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
);
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
);
48 extern void warn(const char *p
, ...);
49 extern void warn_v(const char *p
, va_list args
);
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
);
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
);
61 extern char *errmsg(const char *p
, ...);
62 extern char *errmsg_v(const char *p
, va_list args
);
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
);
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
);
73 extern void libtu_asprintf(char **ret
, const char *fmt
, ...);
74 extern void libtu_vasprintf(char **ret
, const char *fmt
, va_list args
);
76 #endif /* LIBTU_OUTPUT_H */