Changeset 12004 for issm/branches/trunk-jpl-damage/src/c/include/macros.h
- Timestamp:
- 04/16/12 16:06:52 (13 years ago)
- Location:
- issm/branches/trunk-jpl-damage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-jpl-damage
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 11709,11711-11769,11771-11777,11780-11782,11784-11800,11803-11983,11986-11989
- Property svn:mergeinfo changed
-
issm/branches/trunk-jpl-damage/src/c/include/macros.h
r10188 r12004 34 34 #ifdef _ISSM_DEBUG_ 35 35 #define _assert_(statement)\ 36 if (!(statement)) _error_("Assertion \"%s\" failed, please report bug to ISSM developers",#statement)36 if (!(statement)) _error_("Assertion \"%s\" failed, please report bug to %s",#statement,PACKAGE_BUGREPORT) 37 37 #else 38 38 #define _assert_(ignore)\ … … 40 40 #endif 41 41 /*}}}*/ 42 42 43 /* MODULEBOOT/MODULEEND {{{1*/ 44 43 45 /*The following macros hide the error exception handling in a matlab module. Just put 44 46 * MODULEBOOT(); and MODULEEND(); at the beginning and end of a module, and c++ exceptions 45 47 * will be trapped. Really nifty!*/ 48 46 49 #ifdef _SERIAL_ 47 50 #ifdef _HAVE_MATLAB_ //{{{2 48 51 #define MODULEBOOT(); ModuleBoot(); \ 49 52 try{ … … 58 61 mexErrMsgTxt(" ");\ 59 62 } 63 #endif //}}} 64 #ifdef _HAVE_PYTHON_ //{{{2 65 #define MODULEBOOT(); ModuleBoot(); \ 66 PyObject* output = PyTuple_New(NLHS); if (!output) return NULL; 60 67 68 #define MODULEEND(); ModuleEnd(); \ 69 return output; 70 #endif //}}} 61 71 #else 62 72 //{{{2 63 73 #define MODULEBOOT(); \ 64 74 try{ … … 73 83 return 1;\ 74 84 } 85 //}}} 86 #endif 87 /*}}}*/ 88 /* WRAPPER {{{1*/ 89 #ifdef _HAVE_MATLAB_ 90 #define WRAPPER(modulename,...) void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) 91 #endif 92 #ifdef _HAVE_PYTHON_ 93 #define WRAPPER(modulename,...) \ 94 \ 95 static PyObject* modulename(PyObject* self,PyObject* args);\ 96 static PyMethodDef modulename##_funcs[] = {\ 97 {#modulename, (PyCFunction)modulename, METH_VARARGS, ""},\ 98 {NULL,NULL,0,NULL}\ 99 };\ 100 \ 101 static struct PyModuleDef modulename##module= {\ 102 PyModuleDef_HEAD_INIT,\ 103 #modulename, /* name of module */\ 104 NULL, /* module documentation, may be NULL */\ 105 -1, /* size of per-interpreter state of the module,\ 106 or -1 if the module keeps state in global variables. */\ 107 modulename##_funcs\ 108 };\ 109 \ 110 PyMODINIT_FUNC PyInit_##modulename(void){\ 111 \ 112 import_array();\ 113 return PyModule_Create(&modulename##module);\ 114 }\ 115 \ 116 static PyObject* modulename(PyObject* self,PyObject* args) 117 118 #endif 119 120 /*}}}*/ 121 /* CHECKARGUMENTS {{{1*/ 122 #ifdef _HAVE_MATLAB_ 123 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,functionpointer) 124 #endif 125 #ifdef _HAVE_PYTHON_ 126 #define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumPythonArguments(args, NRHS,functionpointer) 75 127 #endif 76 128 /*}}}*/ 77 129 130 78 131 #endif
Note:
See TracChangeset
for help on using the changeset viewer.