Ignore:
Timestamp:
04/16/12 16:06:52 (13 years ago)
Author:
cborstad
Message:

merged trunk-jpl into trunk-jpl-damage through revision 11990

Location:
issm/branches/trunk-jpl-damage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-jpl-damage

  • issm/branches/trunk-jpl-damage/src/c/include/macros.h

    r10188 r12004  
    3434#ifdef _ISSM_DEBUG_
    3535#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)
    3737#else
    3838#define _assert_(ignore)\
     
    4040#endif
    4141/*}}}*/
     42
    4243/* MODULEBOOT/MODULEEND {{{1*/
     44
    4345/*The following macros hide the error exception handling in a matlab module. Just put
    4446 * MODULEBOOT(); and MODULEEND(); at the beginning and end of a module, and c++ exceptions
    4547 * will be trapped. Really nifty!*/
     48
    4649#ifdef _SERIAL_
    47 
     50#ifdef _HAVE_MATLAB_ //{{{2
    4851#define MODULEBOOT(); ModuleBoot(); \
    4952        try{
     
    5861                mexErrMsgTxt(" ");\
    5962        }
     63#endif //}}}
     64#ifdef _HAVE_PYTHON_ //{{{2
     65#define MODULEBOOT(); ModuleBoot();  \
     66        PyObject* output = PyTuple_New(NLHS); if (!output) return NULL;
    6067
     68#define MODULEEND();  ModuleEnd(); \
     69                                                 return output;
     70#endif //}}}
    6171#else
    62 
     72//{{{2
    6373#define MODULEBOOT(); \
    6474        try{
     
    7383                return 1;\
    7484        }
     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\
     95static PyObject* modulename(PyObject* self,PyObject* args);\
     96static PyMethodDef modulename##_funcs[] = {\
     97        {#modulename, (PyCFunction)modulename, METH_VARARGS, ""},\
     98        {NULL,NULL,0,NULL}\
     99};\
     100\
     101static 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\
     110PyMODINIT_FUNC PyInit_##modulename(void){\
     111\
     112        import_array();\
     113        return PyModule_Create(&modulename##module);\
     114}\
     115\
     116static 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)
    75127#endif
    76128/*}}}*/
    77129
     130
    78131#endif
Note: See TracChangeset for help on using the changeset viewer.