Skip to main content

Module sexp

Module sexp 

Source
Expand description

SEXP type definitions — the C-compatible memory layout for R values.

This defines miniR’s own SEXP ABI. Package C code compiled against our Rinternals.h header uses this layout to access R values.

All allocations use the C allocator (calloc/malloc/free) so that SEXPs created by Rust and SEXPs created by C code are interchangeable and can be freed by either side.

Structs§

PairlistData
Pairlist node data — matches minir_pairlist_data in Rinternals.h. Used by LISTSXP/LANGSXP nodes. Stored at data pointer of the SexpRec.
SexpRec
A heap-allocated R value in C-compatible layout.

Constants§

CHARSXP
CPLXSXP
ENVSXP
INTSXP
LANGSXP
LGLSXP
LISTSXP
NA_INTEGER
R’s NA_INTEGER — i32::MIN.
NA_LOGICAL
R’s NA_LOGICAL — same as NA_INTEGER.
NA_REAL
R’s NA_REAL — a specific NaN with payload 1954 (0x7FF00000000007A2).
NILSXP
RAWSXP
REALSXP
R_NIL_VALUE
Null SEXP sentinel.
STRSXP
SYMSXP
VECSXP

Functions§

alloc_vector
Allocate a SEXPREC with a typed data buffer using the C allocator.
calloc 🔒
char_data
Read the CHARSXP data as a Rust &str.
free 🔒
free_sexp
Free a SEXP and its data buffer using the C allocator.
integer_ptr
Read INTEGER data pointer.
is_na_real
Check if a f64 is R’s NA_REAL (not just any NaN).
logical_ptr
Read LOGICAL data pointer.
malloc 🔒
mk_char
Allocate a CHARSXP from a Rust string.
mk_null
Allocate a NILSXP.
mk_string
Allocate a length-1 STRSXP from a Rust string.
real_ptr
Read REAL data pointer.
scalar_integer
Allocate a scalar INTSXP.
scalar_logical
Allocate a scalar LGLSXP.
scalar_real
Allocate a scalar REALSXP.
string_elt
Read STRING_ELT.
vector_elt
Read VECTOR_ELT.

Type Aliases§

Sexp
The SEXP pointer type — equivalent to C’s SEXP.