49 # define __BEGIN_DECLS extern "C" { 50 # define __END_DECLS } 52 # define __BEGIN_DECLS 59 # if __STDC_VERSION__ >= 201112 && !defined __STDC_NO_THREADS__ 60 # define thread_local _Thread_local 61 # elif defined _WIN32 && ( \ 65 defined __BORLANDC__ ) 66 # define thread_local __declspec(thread) 68 # elif defined __GNUC__ || \ 69 defined __SUNPRO_C || \ 71 # define thread_local __thread 73 # error "Cannot define thread_local" 78 extern thread_local
int modena_error_code;
81 extern PyObject *modena_DoesNotExist;
82 extern PyObject *modena_OutOfBounds;
83 extern PyObject *modena_ParametersNotValid;
88 MODENA_MODEL_NOT_FOUND,
89 MODENA_FUNCTION_NOT_FOUND,
90 MODENA_INDEX_SET_NOT_FOUND,
95 INLINE_DECL
bool modena_error_occurred();
98 INLINE_DECL
int modena_error();
102 INLINE_FUN
bool modena_error_occurred()
104 return modena_error_code != MODENA_SUCCESS;
107 INLINE_FUN
int modena_error()
109 int ret = modena_error_code;
110 modena_error_code = 0;
117 const char* modena_error_message(
int error_code);
119 void modena_print_backtrace();
121 #define Modena_Info_Print(...) \ 122 char Modena_message[256]; \ 123 sprintf(Modena_message, __VA_ARGS__); \ 124 fprintf(stdout, "%s in line %i of %s\n", Modena_message, __LINE__, __FILE__); 126 #define Modena_Error_Print(...) \ 127 char Modena_message[256]; \ 128 sprintf(Modena_message, __VA_ARGS__); \ 129 fprintf(stderr, "%s in line %i of %s\n", Modena_message, __LINE__, __FILE__); 131 #define Modena_PyErr_Print() \ 133 Modena_Error_Print("Error in python catched"); \ 134 modena_print_backtrace();