Disable "hard" examples in CI
[qpms.git] / qpms / error.c
blob21b97aa4607d28d34ab6911df6c04ae0b4ba51ff
1 #include "qpms_error.h"
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <stdarg.h>
6 qpms_dbgmsg_flags qpms_dbgmsg_enabled = QPMS_DBGMSG_MISC;
8 qpms_dbgmsg_flags qpms_dbgmsg_enable(qpms_dbgmsg_flags types) {
9 return (qpms_dbgmsg_enabled |= types);
12 qpms_dbgmsg_flags qpms_dbgmsg_disable(qpms_dbgmsg_flags types) {
13 return (qpms_dbgmsg_enabled &= ~types);
16 void qpms_pr_error(const char *fmt, ...) {
17 fflush(stdout);
18 va_list ap;
19 va_start(ap, fmt);
20 vfprintf(stderr, fmt, ap);
21 va_end(ap);
22 fputc('\n', stderr);
23 fflush(stderr);
24 abort();
28 //void qpms_error(const char *fmt, ...);
30 void qpms_pr_error_at_line(const char *filename, unsigned int linenum,
31 const char *fmt, ...) {
32 fflush(stdout);
33 fprintf(stderr, "%s:%u: ", filename, linenum);
34 va_list ap;
35 va_start(ap, fmt);
36 vfprintf(stderr, fmt, ap);
37 va_end(ap);
38 fputc('\n', stderr);
39 fflush(stderr);
40 abort();
43 void qpms_pr_error_at_flf(const char *filename, unsigned int linenum,
44 const char *func,
45 const char *fmt, ...) {
46 fflush(stdout);
47 fprintf(stderr, "%s:%u, %s: ", filename, linenum, func);
48 va_list ap;
49 va_start(ap, fmt);
50 vfprintf(stderr, fmt, ap);
51 va_end(ap);
52 fputc('\n', stderr);
53 fflush(stderr);
54 abort();
57 void qpms_warn_at_flf(const char *filename, unsigned int linenum,
58 const char *func,
59 const char *fmt, ...) {
60 fprintf(stderr, "%s:%u, %s: ", filename, linenum, func);
61 va_list ap;
62 va_start(ap, fmt);
63 vfprintf(stderr, fmt, ap);
64 va_end(ap);
65 fputc('\n', stderr);
66 fflush(stderr);
69 void qpms_debug_at_flf(const char *filename, unsigned int linenum,
70 const char *func, qpms_dbgmsg_flags type,
71 const char *fmt, ...) {
72 if (!(type & qpms_dbgmsg_enabled)) return;
73 fprintf(stderr, "%s:%u, %s: ", filename, linenum, func);
74 va_list ap;
75 va_start(ap, fmt);
76 vfprintf(stderr, fmt, ap);
77 va_end(ap);
78 fputc('\n', stderr);
79 fflush(stderr);
82 //void qpms_error_at_line(const char *filename, unsigned int linenum,
83 // const char *fmt, ...);