projects
/
henge
/
apc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
390722f
)
error printing update
author
ken
<ken@mihrtec.com>
Sat, 18 Feb 2017 19:03:51 +0000
(11:03 -0800)
committer
ken
<ken@mihrtec.com>
Sat, 18 Feb 2017 19:03:51 +0000
(11:03 -0800)
src/ir.c
patch
|
blob
|
history
src/print.h
patch
|
blob
|
history
diff --git
a/src/ir.c
b/src/ir.c
index
3577d48
..
e860bd7
100644
(file)
--- a/
src/ir.c
+++ b/
src/ir.c
@@
-17,12
+17,11
@@
#include <unistr.h> //u32_cpy
\r
#include <unistdio.h> //ulc_fprintf
\r
/* Local */
\r
#include <unistr.h> //u32_cpy
\r
#include <unistdio.h> //ulc_fprintf
\r
/* Local */
\r
+#define eprintf_callback(...) exit(EXIT_FAILURE)
\r
#include "print.h"
\r
#include "apc.h"
\r
#include "ir.h"
\r
#include "pagenode.h"
\r
#include "print.h"
\r
#include "apc.h"
\r
#include "ir.h"
\r
#include "pagenode.h"
\r
-#undef do_error
\r
-#define do_error(...) exit(-1)
\r
#define XXH_PRIVATE_API
\r
#include "../xxHash/xxhash.h"
\r
/* Public */
\r
#define XXH_PRIVATE_API
\r
#include "../xxHash/xxhash.h"
\r
/* Public */
\r
diff --git
a/src/print.h
b/src/print.h
index
6e1c4ba
..
2f44970
100644
(file)
--- a/
src/print.h
+++ b/
src/print.h
@@
-11,28
+11,45
@@
#ifndef DEBUG
#define DEBUG 0
#endif
#ifndef DEBUG
#define DEBUG 0
#endif
+/* wprintf callback, may be defined prior to include
+ or undefined and redefined later
+*/
+#ifndef wprintf_callback
+#define wprintf_callback(...) do { \
+ } while (0)
+#endif
+/* eprintf callback, may be defined prior to include
+ or undefined and redefined later
+*/
+#ifndef eprintf_callback
+#define eprintf_callback(...) do { \
+ } while (0)
+#endif
+
+/* Print a unicode string */
#define uprintf(...) do { \
#define uprintf(...) do { \
-
ulc_fprintf(stdout, __VA_ARGS__);
\
+
ulc_fprintf(stdout, __VA_ARGS__);
\
} while (0)
} while (0)
+/* Print a unicode string to a filestream */
#define ufprintf(_STREAM,...) do { \
#define ufprintf(_STREAM,...) do { \
- ulc_fprintf(_STREAM, __VA_ARGS__); \
- } while (0)
-#define do_warn(...) do { \
+ ulc_fprintf(_STREAM, __VA_ARGS__); \
} while (0)
} while (0)
+/* Print a warning message to stderr, then do_warn */
#define wprintf(...) do { \
ufprintf(stderr, __VA_ARGS__); \
#define wprintf(...) do { \
ufprintf(stderr, __VA_ARGS__); \
- do_warn(__VA_ARGS__); \
- } while (0)
-#define do_error(...) do { \
+ wprintf_callback(__VA_ARGS__); \
} while (0)
} while (0)
+/* Print an error message to stderr, then do_error */
#define eprintf(...) do { \
ufprintf(stderr, __VA_ARGS__); \
#define eprintf(...) do { \
ufprintf(stderr, __VA_ARGS__); \
-
do_error(__VA_ARGS_);
\
+
eprintf_callback(__VA_ARGS_);
\
} while (0)
} while (0)
+/* Print only when the provided boolean is true */
#define bprintf(_BOOL,...) do { \
if (_BOOL) \
ufprintf(stdout, __VA_ARGS__); \
} while (0)
#define bprintf(_BOOL,...) do { \
if (_BOOL) \
ufprintf(stdout, __VA_ARGS__); \
} while (0)
+/* Print only when DEBUG is set to a value */
#define dprintf(...) do { \
bprintf(DEBUG, __VA_ARGS__); \
} while (0)
#define dprintf(...) do { \
bprintf(DEBUG, __VA_ARGS__); \
} while (0)