2013-05-06 23:06:13 -06:00
|
|
|
/* obj.h: objecty and exceptiony stuff
|
|
|
|
*
|
|
|
|
* Some macros to make C a bit more like C++, but without bringing in
|
|
|
|
* all of C++'s crapola.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __OBJ_H__
|
|
|
|
#define __OBJ_H__
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* Some things I use for debugging */
|
|
|
|
#ifdef NODUMP
|
|
|
|
# define DUMPf(fmt, args...)
|
|
|
|
#else
|
|
|
|
# define DUMPf(fmt, args...) fprintf(stderr, "%s:%s:%d " fmt "\n", __FILE__, __FUNCTION__, __LINE__, ##args)
|
|
|
|
#endif
|
|
|
|
#define DUMP() DUMPf("")
|
|
|
|
#define DUMP_d(v) DUMPf("%s = %d", #v, v)
|
2013-09-08 17:45:44 -06:00
|
|
|
#define DUMP_l(v) DUMPf("%s = %ld", #v, 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
|