source: issm/trunk/src/wrappers/javascript/include/wrapper_macros.h@ 20500

Last change on this file since 20500 was 20500, checked in by Mathieu Morlighem, 9 years ago

merged trunk-jpl and trunk for revision 20497

File size: 978 bytes
Line 
1/* \file javascript macros.h
2 * \brief: macros used for the javascript bindings
3 */
4
5#ifndef _JAVASCRIPT_MACROS_H_
6#define _JAVASCRIPT_MACROS_H_
7
8#ifdef HAVE_CONFIG_H
9 #include <config.h>
10#else
11#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
12#endif
13
14#ifdef _HAVE_JAVASCRIPT_
15/* MODULEBOOT/MODULEEND {{{*/
16
17/*The following macros hide the error exception handling in a javascript module. Just put
18 * MODULEBOOT(); and MODULEEND(); at the beginning and end of a module, and c++ exceptions
19 * will be trapped*/
20#define MODULEBOOT(); try{ \
21 IssmComm::SetComm();
22
23#define MODULEEND(); }\
24 catch(ErrorException &exception){\
25 printf(exception.WrapperReport()); \
26 }\
27 catch (exception &e){\
28 printf(e.what());\
29 }\
30 catch(...){\
31 printf("An unexpected error occurred");\
32 }\
33 return 0;\
34 }
35/*}}}*/
36/* CHECKARGUMENTS {{{*/
37#define CHECKARGUMENTS(NLHS,NRHS,functionpointer) //do nothing, we are not creating a dynamic library here!
38/*}}}*/
39#endif
40
41#endif
Note: See TracBrowser for help on using the repository browser.