Minor refactor of R error handling code
This commit is contained in:
parent
995b443948
commit
a0d4218543
1 changed files with 32 additions and 34 deletions
|
|
@ -1,5 +1,34 @@
|
||||||
#include <stdarg.h> // va_list, va_start, va_end
|
/* Remove global namespace pollution */
|
||||||
#include <stdio.h> // vsnprintf
|
#if !defined(SWIG_NO_R_NO_REMAP)
|
||||||
|
# define R_NO_REMAP
|
||||||
|
#endif
|
||||||
|
#if !defined(SWIG_NO_STRICT_R_HEADERS)
|
||||||
|
# define STRICT_R_HEADERS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Rdefines.h>
|
||||||
|
#include <Rversion.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <exception>
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* for raw pointer */
|
||||||
|
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||||
|
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
||||||
|
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags)
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#if R_VERSION >= R_Version(2,6,0)
|
||||||
|
#define VMAXTYPE void *
|
||||||
|
#else
|
||||||
|
#define VMAXTYPE char *
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Last error */
|
/* Last error */
|
||||||
static int SWIG_lasterror_code = 0;
|
static int SWIG_lasterror_code = 0;
|
||||||
|
|
@ -12,7 +41,7 @@ SWIGRUNTIME void SWIG_Error(int code, const char *format, ...) {
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME const char* SWIG_ErrorType(int code) {
|
SWIGRUNTIME const char *SWIG_ErrorType(int code) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case SWIG_MemoryError:
|
case SWIG_MemoryError:
|
||||||
return "SWIG:MemoryError";
|
return "SWIG:MemoryError";
|
||||||
|
|
@ -42,37 +71,6 @@ SWIGRUNTIME const char* SWIG_ErrorType(int code) {
|
||||||
|
|
||||||
#define SWIG_fail goto fail
|
#define SWIG_fail goto fail
|
||||||
|
|
||||||
/* Remove global namespace pollution */
|
|
||||||
#if !defined(SWIG_NO_R_NO_REMAP)
|
|
||||||
# define R_NO_REMAP
|
|
||||||
#endif
|
|
||||||
#if !defined(SWIG_NO_STRICT_R_HEADERS)
|
|
||||||
# define STRICT_R_HEADERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Rdefines.h>
|
|
||||||
#include <Rversion.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#include <exception>
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* for raw pointer */
|
|
||||||
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
|
||||||
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_R_ConvertPtr(obj, pptr, type, flags)
|
|
||||||
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_R_NewPointerObj(ptr, type, flags)
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#if R_VERSION >= R_Version(2,6,0)
|
|
||||||
#define VMAXTYPE void *
|
|
||||||
#else
|
|
||||||
#define VMAXTYPE char *
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is mainly a way to avoid having lots of local variables that may
|
This is mainly a way to avoid having lots of local variables that may
|
||||||
conflict with those in the routine.
|
conflict with those in the routine.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue