2013-09-15 21:42:33 -06:00
|
|
|
#ifndef __DUMP_H__
|
|
|
|
#define __DUMP_H__
|
2013-05-06 23:06:13 -06:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* Some things I use for debugging */
|
2017-03-19 16:03:31 -06:00
|
|
|
#ifndef DEBUG
|
2013-05-06 23:06:13 -06:00
|
|
|
# define DUMPf(fmt, args...)
|
|
|
|
#else
|
2014-12-14 21:26:01 -07:00
|
|
|
# define DUMPf(fmt, args...) fprintf(stderr, "%s:%d " fmt "\n", __FILE__, __LINE__, ##args)
|
2013-05-06 23:06:13 -06:00
|
|
|
#endif
|
|
|
|
#define DUMP() DUMPf("")
|
2013-09-15 21:42:33 -06:00
|
|
|
#define DUMP_d(v) DUMPf("%s = %d", #v, (int)v)
|
|
|
|
#define DUMP_l(v) DUMPf("%s = %ld", #v, (long)v)
|
2013-05-06 23:06:13 -06:00
|
|
|
#define DUMP_x(v) DUMPf("%s = 0x%x", #v, v)
|
|
|
|
#define DUMP_s(v) DUMPf("%s = %s", #v, v)
|
|
|
|
#define DUMP_c(v) DUMPf("%s = '%c' (0x%02x)", #v, v, v)
|
|
|
|
#define DUMP_p(v) DUMPf("%s = %p", #v, v)
|
|
|
|
|
|
|
|
#endif
|