This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/real/real.h
Vítor Santos Costa 63a514cad5 yap4r
2019-04-02 10:27:37 +01:00

65 lines
2.1 KiB
C

/**
* @file real.h
* @date Sat May 19 13:44:04 2018
*
* @brief Prolog to R interface
*
*
*/
#ifdef __cplusplus
extern "C"{
#endif
bool R_isNull(SEXP sexp);
#if DEBUG_MEMORY
#define PROTECT_AND_COUNT(EXP) \
{ \
extern int R_PPStackTop; \
PROTECT(EXP); \
nprotect++; \
printf("%s:%d +%d=%d\n", __FUNCTION__, __LINE__, nprotect, R_PPStackTop); \
}
#define Ureturn \
{ \
extern int R_PPStackTop; \
printf("%s:%d -%d=%d\n", __FUNCTION__, __LINE__, nprotect, \
R_PPStackTop - nprotect); \
} \
unprotect(nprotect); \
return
#else
#define PROTECT_AND_COUNT(EXP) \
{ \
PROTECT(EXP); \
nprotect++; \
}
#define Ureturn \
unprotect(nprotect); \
return
#endif
// #define PL_free(v)
static inline SEXP protected_tryEval(SEXP expr, SEXP env, int *errp) {
SEXP o;
o = R_tryEval(expr, env, errp);
return o ? o : expr;
}
#ifndef term_t
#define term_t YAP_Int
#endif
extern bool sexp_to_pl(term_t t, SEXP s);
extern SEXP term_to_sexp(term_t t, bool eval);
#ifdef __cplusplus
}
#endif