1 #ifndef RLANG_RLANG_H 2 #define RLANG_RLANG_H 3 4 5 #include <inttypes.h> 6 #include <stdbool.h> 7 8 #define R_NO_REMAP 9 #include <Rinternals.h> 10 11 typedef struct SEXPREC sexp; 12 typedef Rbyte r_byte_t; 13 typedef Rcomplex r_complex_t; 14 15 typedef R_xlen_t r_ssize; 16 #define R_SSIZE_MAX R_XLEN_T_MAX 17 #define R_SSIZE_MIN (-R_XLEN_T_MAX) 18 19 r_ssize r_as_ssize(sexp* n); 20 21 enum r_type { 22 r_type_null = 0, 23 r_type_symbol = 1, 24 r_type_pairlist = 2, 25 r_type_closure = 3, 26 r_type_environment = 4, 27 r_type_promise = 5, 28 r_type_call = 6, 29 r_type_special = 7, 30 r_type_builtin = 8, 31 r_type_string = 9, 32 r_type_logical = 10, 33 r_type_integer = 13, 34 r_type_double = 14, 35 r_type_complex = 15, 36 r_type_character = 16, 37 r_type_dots = 17, 38 r_type_any = 18, 39 r_type_list = 19, 40 r_type_expression = 20, 41 r_type_bytecode = 21, 42 r_type_pointer = 22, 43 r_type_weakref = 23, 44 r_type_raw = 24, 45 r_type_s4 = 25, 46 47 r_type_new = 30, 48 r_type_free = 31, 49 50 r_type_function = 99 51 }; 52 53 #include <Rversion.h> 54 #if (R_VERSION < R_Version(3, 5, 0)) 55 # define r_list_deref_const(x) ((sexp* const *) STRING_PTR(x)) 56 #else 57 # define r_list_deref_const(x) ((sexp* const *) DATAPTR_RO(x)) 58 #endif 59 60 61 #define r_null R_NilValue 62 extern sexp* r_shared_true; 63 extern sexp* r_shared_false; 64 65 66 #define KEEP PROTECT 67 #define FREE UNPROTECT 68 #define KEEP_N(x, n) (++n, KEEP(x)) 69 70 #define r_keep_t PROTECT_INDEX 71 #define KEEP_AT REPROTECT 72 #define KEEP_HERE PROTECT_WITH_INDEX 73 74 #define RLANG_ASSERT(condition) ((void)sizeof(char[1 - 2*!(condition)])) 75 76 77 #include "sexp.h" 78 79 #include "attrs.h" 80 #include "debug.h" 81 #include "c-utils.h" 82 #include "cnd.h" 83 #include "env.h" 84 #include "env-binding.h" 85 #include "eval.h" 86 #include "export.h" 87 #include "fn.h" 88 #include "formula.h" 89 #include "lang.h" 90 #include "node.h" 91 #include "parse.h" 92 #include "quo.h" 93 #include "replace-na.h" 94 #include "session.h" 95 #include "squash.h" 96 #include "stack.h" 97 #include "state.h" 98 #include "sym.h" 99 #include "vec.h" 100 #include "vec-chr.h" 101 #include "vec-lgl.h" 102 #include "vec-list.h" 103 104 sexp* r_init_library(); 105 106 107 #endif 108