more fiddling with edgestyles
[swftools.git] / lib / python / pyutils.h
1 #ifndef __pyutil_h__
2 #define __pyutil_h__
3 #include <Python.h>
4
5 #define PY_NONE Py_BuildValue("s", 0)
6
7 extern int verbose;
8
9 void setVerbosity(int verbose);
10
11 char* setError(char*format, ...);
12 void mylog(char*format, ...);
13 PyObject* FindMethodMore(PyObject*ret, PyMethodDef f[], PyObject*self, char* a);
14 void dummy_dealloc(PyObject* self);
15 PyMethodDef* addMethods(PyMethodDef*obj1, PyMethodDef*obj2);
16
17 #define PY_CHECK_TYPE(o,c) ((o)->ob_type == (c))
18 #define PY_ASSERT_TYPE(o,c) {if((o)->ob_type != (c)) {printf("Invalid type: %08x(%d)", (int)(o), (o)->ob_refcnt);exit(1);}}
19         
20 #define PY_ERROR(s,args...) (PyErr_SetString(PyExc_Exception, setError(s, ## args)),NULL)
21 #define PY_TYPE(o) ((o)->ob_type->tp_name)
22 #endif