diff options
Diffstat (limited to 'code/spyglass/ext/spyglass_parser/ext_help.h')
| -rw-r--r-- | code/spyglass/ext/spyglass_parser/ext_help.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/code/spyglass/ext/spyglass_parser/ext_help.h b/code/spyglass/ext/spyglass_parser/ext_help.h new file mode 100644 index 0000000..8b4d754 --- /dev/null +++ b/code/spyglass/ext/spyglass_parser/ext_help.h @@ -0,0 +1,14 @@ +#ifndef ext_help_h +#define ext_help_h + +#define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be."); +#define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name); +#define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T); + +#ifdef DEBUG +#define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__) +#else +#define TRACE() +#endif + +#endif |
