diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-22 16:15:48 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-22 16:30:07 +0300 |
commit | 0666fc3caae8e2db660d781e43bee2258bf06a00 (patch) | |
tree | 97380903872520efa3b2bf659465e63f2cf51a2a /lib/libeclat.h | |
parent | 7f3dd0599ac3fb3a69c512b0ecfd043c67ca94ee (diff) | |
download | eclat-0666fc3caae8e2db660d781e43bee2258bf06a00.tar.gz eclat-0666fc3caae8e2db660d781e43bee2258bf06a00.tar.bz2 |
Introduce output formatting language
* configure.ac: Check for lex and yacc.
* lib/diag.c: New file (moved from ../src with edits)
* lib/forlan.c: New file.
* lib/forlan.h: New file.
* lib/forlangrm.y: New file.
* lib/forlanlex.l: New file.
* lib/.gitignore: Add new files.
* lib/Makefile.am: Add new file.
* lib/libeclat.h: Add diagnostics-related stuff.
* src/Makefile.am (eclat_SOURCES): Remove diag.c
* src/cmdline.opt (set_program_name): Move to ../lib/diag.c
* src/diag.c: Remove (see above).
* src/config.c: Reflect changes to the diagnostics subsystem.
* src/eclat.c: Likewise.
* src/eclat.h: Remove diagnostics-related stuff.
It lives in libeclat.h from now on.
* src/error.c: Remove.
* tests/forlan01.at: New testcase.
* tests/testsuite.at: Include forlan01.at
* tests/tforlan.c: New file.
* tests/.gitignore: Add new files.
* tests/Makefile.am: Add new files.
Diffstat (limited to 'lib/libeclat.h')
-rw-r--r-- | lib/libeclat.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/libeclat.h b/lib/libeclat.h index 670c51b..5f37cc9 100644 --- a/lib/libeclat.h +++ b/lib/libeclat.h @@ -18,6 +18,39 @@ #include <expat.h> #include "grecs.h" +extern const char *program_name; + +struct debug_category { + const char *name; + size_t length; + int level; +}; + +extern struct debug_category debug_category[]; +#define LIBECLAT_DBG_MAX 64 + +#define debug_level(cat) ((cat >= 0 && cat < LIBECLAT_DBG_MAX) ? \ + debug_category[cat].level : 0) +#define debug(cat, lev, s) \ + do { \ + if (debug_level(cat) >= (lev)) \ + debug_printf s; \ + } while(0) + +void set_program_name(const char *arg); + +void die(int status, const char *fmt, ...); +void vdiag(grecs_locus_t const *locus, const char *qual, const char *fmt, + va_list ap); +void diag(grecs_locus_t const *locus, const char *qual, const char *fmt, ...); +void err(const char *fmt, ...); +void warn(const char *fmt, ...); +void debug_printf(const char *fmt, ...); + +int parse_debug_level(const char *arg); +int debug_register(char *name); + + void hmac_sha1(const void *text, size_t textlen, const void *key, size_t keylen, void *digest); |