51 #include <R_ext/Error.h>
53 #ifndef STRICT_R_HEADERS
55 #define R_PROBLEM_BUFSIZE 4096
57 #define PROBLEM {char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,
58 #define MESSAGE {char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,
59 #define ERROR ),error(R_problem_buf);}
60 #define RECOVER(x) ),error(R_problem_buf);}
61 #define WARNING(x) ),warning(R_problem_buf);}
62 #define LOCAL_EVALUATOR
64 #define WARN WARNING(NULL)
70 extern void *R_chk_calloc(
size_t,
size_t);
71 extern void *R_chk_realloc(
void *,
size_t);
72 extern void R_chk_free(
void *);
75 #ifndef STRICT_R_HEADERS
77 #define Calloc(n, t) reinterpret_cast<t *>(R_chk_calloc(size_t(n), sizeof(t) ))
78 #define Realloc(p,n,t) reinterpret_cast<t *>(R_chk_realloc( p, size_t((n) * sizeof(t)) ))
79 #define Free(p) (R_chk_free(p), (p) = NULL)
81 #define R_Calloc(n, t) reinterpret_cast<t *>(R_chk_calloc( size_t(n), sizeof(t) ))
82 #define R_Realloc(p,n,t) reinterpret_cast<t *>(R_chk_realloc( (p), (size_t)((n) * sizeof(t)) ))
83 #define R_Free(p) (R_chk_free(p), (p) = NULL)
84 #define Memcpy(p,q,n) memcpy( p, q, size_t( (n) * sizeof(*p) ) )
86 #ifndef STRICT_R_HEADERS
88 #define Calloc(n, t) (t *) R_chk_calloc( (size_t) (n), sizeof(t) )
89 #define Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (size_t)((n) * sizeof(t)) )
90 #define Free(p) (R_chk_free( (void *)(p) ), (p) = NULL)
92 #define R_Calloc(n, t) (t *) R_chk_calloc( (size_t) (n), sizeof(t) )
93 #define R_Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (size_t)((n) * sizeof(t)) )
94 #define R_Free(p) (R_chk_free( (void *)(p) ), (p) = NULL)
95 #define Memcpy(p,q,n) memcpy( p, q, (size_t)( (n) * sizeof(*p) ) )
99 #define CallocCharBuf(n) reinterpret_cast<char *>(R_chk_calloc(size_t((n)+1), sizeof(char)))
101 #define CallocCharBuf(n) (char *) R_chk_calloc((size_t) ((n)+1), sizeof(char))
108 #ifdef HAVE_F77_UNDERSCORE
109 # define F77_CALL(x) x ## _
111 # define F77_CALL(x) x
113 #define F77_NAME(x) F77_CALL(x)
114 #define F77_SUB(x) F77_CALL(x)
115 #define F77_COM(x) F77_CALL(x)
116 #define F77_COMDECL(x) F77_CALL(x)
119 void call_R(
char*,
long,
void**,
char**,
long*,
char**,
long,
char**);