rev 236 - trunk/include/prothon
SVN User <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bcollins
Date: 2004-03-31 13:48:23 -0500 (Wed, 31 Mar 2004)
New Revision: 236
Modified:
trunk/include/prothon/prothon.h
Log:
Redo CHECK_TYPE_EXC() macro. VC doesn't support varargs in macros.
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-03-31 17:50:58 UTC (rev 235)
+++ trunk/include/prothon/prothon.h 2004-03-31 18:48:23 UTC (rev 236)
@@ -483,23 +483,17 @@
// or have a circular reference. See section "INTERPRETER STATE" below.
int has_proto_QUES(isp ist, obj_p obj, obj_p obj_proto);
-// CHECK_PROTO: Convenience macro to check that an object has a certain
-// prototype. If not, the exception type will be thrown with message, and
-// return the value ret.
-#define CHECK_PROTO(__obj, __proto_obj, __exc_obj, __ret, __msg, args...) \
-do { \
- if (!has_proto_QUES(ist, __obj, __proto_obj)) { \
- raise_exception(ist, __exc_obj, __msg, ## args); \
- return __ret; \
- } \
+// CHECK_TYPE_EXC: Convenience macro for type validation of objects
+// (usually self).
+#define CHECK_TYPE_EXC(__obj, __proto_obj, name) \
+do { \
+ if (!has_proto_QUES(ist, __obj, __proto_obj)) { \
+ raise_exception(ist, OBJ(TYPE_EXC), \
+ "object is not of type " #name); \
+ return NULL; \
+ } \
} while(0)
-// CHECK_TYPE_EXC: Even more specific than CHECK_PROTO, it does the common
-// type validation for objects (usually self).
-#define CHECK_TYPE_EXC(__obj, __proto_obj, name) \
- CHECK_PROTO(__obj, __proto_obj, OBJ(TYPE_EXC), NULL, \
- "object is not of type " #name)
-
// SWITCH_PROTO_TO: Replace all old protos with a new single proto object
void switch_proto_to(isp ist, obj_p obj, obj_p new_proto);