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

65 lines
2.1 KiB
C
Raw Normal View History

2019-04-02 10:27:37 +01:00
/**
* @file real.h
* @date Sat May 19 13:44:04 2018
*
* @brief Prolog to R interface
*
*
*/
2015-10-13 08:25:49 +01:00
2019-04-02 10:27:37 +01:00
#ifdef __cplusplus
extern "C"{
#endif
bool R_isNull(SEXP sexp);
2015-10-13 08:25:49 +01:00
2019-04-02 10:27:37 +01:00
#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
2015-10-13 08:25:49 +01:00
2019-04-02 10:27:37 +01:00
// #define PL_free(v)
2015-10-13 08:25:49 +01:00
2019-04-02 10:27:37 +01:00
static inline SEXP protected_tryEval(SEXP expr, SEXP env, int *errp) {
SEXP o;
o = R_tryEval(expr, env, errp);
return o ? o : expr;
}
2015-10-13 08:25:49 +01:00
2019-04-02 10:27:37 +01:00
#ifndef term_t
#define term_t YAP_Int
#endif
2015-10-13 08:25:49 +01:00
2019-04-02 10:27:37 +01:00
extern bool sexp_to_pl(term_t t, SEXP s);
extern SEXP term_to_sexp(term_t t, bool eval);
2015-10-13 08:25:49 +01:00
2019-04-02 10:27:37 +01:00
#ifdef __cplusplus
}
#endif
2015-10-13 08:25:49 +01:00