2006-01-28 14:03:53 -05:00
|
|
|
#ifndef ext_help_h
|
|
|
|
#define ext_help_h
|
|
|
|
|
2012-07-10 18:47:49 -04:00
|
|
|
#define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "%s", "NULL found for " # T " when shouldn't be.");
|
2006-01-28 14:03:53 -05:00
|
|
|
#define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name);
|
2012-07-10 18:47:49 -04:00
|
|
|
#define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "%s", "Wrong argument type for " # V " required " # T);
|
2008-03-23 23:48:10 -04:00
|
|
|
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
2006-01-28 14:03:53 -05:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
#define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
|
|
|
|
#else
|
|
|
|
#define TRACE()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|