Expand description
Rust-native R C API runtime.
These functions deref raw SEXP pointers from C code โ this is inherently unsafe but required for C API compatibility. We suppress the clippy lint at module level since every function in this module works with raw pointers.
Implements the R C API functions (Rf_allocVector, Rf_protect, etc.)
as extern "C" Rust functions that are compiled into the miniR binary.
Package .so files resolve these symbols at load time.
setjmp/longjmp-based functions (Rf_error, _minir_call_protected)
are in csrc/native_trampoline.c (compiled via build.rs) because
longjmp is not safely callable from Rust.
Structsยง
- Alloc
Node ๐ - Linked list node for tracking allocations.
- ExtPtr
Data ๐ - Interpreter
Callbacks - Callback function pointers set by the Rust interpreter before each .Call.
- RCall
Method Def - Rcomplex
- Runtime
State ๐ - Thread-local allocation state for the current .Call invocation. This is in the binary (shared by all packages), not per-.so.
- SendPtr
- Wrapper for raw pointers that is Send (safe because we only access from single-threaded contexts).
Constantsยง
- STATE ๐
Staticsยง
- CCALLABLE ๐
- NIL_REC ๐
- REGISTERED_
CALLS - Registered .Call methods โ shared across all packages in this runtime.
- REGISTERED_
C_ METHODS - Registered .C methods โ shared across all packages in this runtime.
- R_
Base Env - R_
Base Namespace - R_
Blank String - R_
Brace Symbol - R_
Bracket2 Symbol - R_
Bracket Symbol - R_
Class Symbol - R_
DimNames Symbol - R_
DimSymbol - R_
Dollar Symbol - R_
Dots Symbol - R_
Double Colon Symbol - R_
Empty Env - R_
Global Env - R_
Input Handlers - R_
Interactive - R_
Levels Symbol - R_
Missing Arg - R_NaInt
- R_NaInt โ addressable NA_INTEGER constant for C code that takes &NA_INTEGER.
- R_
NaReal - R_NaReal โ addressable NA_REAL constant for C code that takes &NA_REAL.
- R_
NaString - R_
Name Symbol - R_
Names Symbol - R_
Namespace Registry - R_
NilValue - R_NilValue โ exported to C code.
- R_
Polled Events - R_
RowNames Symbol - R_
Srcref - R_
Triple Colon Symbol - R_
Unbound Value - R_
interrupts_ pending - R_
interrupts_ suspended - R_
wait_ usec - SYM_
CLASS ๐ - SYM_DIM ๐
- SYM_
DIMNAMES ๐ - SYM_
DOTS ๐ - SYM_
LEVELS ๐ - SYM_
NAMES ๐ - SYM_
ROWNAMES ๐ - _minir_
current_ dll_ info
Functionsยง
- BODY
- CLOENV
- ENCLOS
- FORMALS
- GetRN
Gstate - MARK_
NOT_ MUTABLE - PRCODE
- PRENV
- PREXPR
- PRVALUE
- PutRN
Gstate - R_
Active Binding Function - R_
Binding IsActive - R_
Binding IsLocked - R_
Check Stack - R_
Check Stack2 - R_
Check User Interrupt - R_
Clear External Ptr - R_
Closure Body - R_
Closure Env - R_
Closure Expr - R_
Closure Formals - R_
Continue Unwind - R_
Environment IsLocked - R_
Exec With Cleanup - R_
Expand File Name - R_
External PtrAddr - R_
External PtrAddr Fn - R_
External PtrProtected - R_
External PtrTag - R_
Find Namespace - R_
Flush Console - R_
GetC Callable - R_
GetConnection - R_
IsNamespace Env - R_
IsPackage Env - R_
Lock Binding - R_
Make Active Binding - R_
Make External Ptr - R_
Make External PtrFn - R_
Make Unwind Cont - R_
Make Weak Ref - R_
Make Weak RefC - R_
Namespace EnvSpec - R_
NewEnv - R_
Order Vector1 - R_
Package EnvName - R_
Parent Env - R_
Parse Vector - R_
Preserve Object - R_
Promise Expr - R_
Protect With Index - R_
RegisterC Callable - R_
RegisterC Finalizer - R_
RegisterC Finalizer Ex - R_
Release Object - R_
Reprotect - R_
Serialize - R_
SetExternal PtrAddr - R_
SetExternal PtrProtected - R_
SetExternal PtrTag - R_
Toplevel Exec - R_
Unwind Protect - R_
Weak RefKey - R_
Weak RefValue - R_alloc
- R_atof
- R_
check_ class_ etc - R_
chk_ calloc - R_
chk_ free - R_
chk_ realloc - R_
compute_ identical - R_
do_ MAKE_ CLASS - R_
do_ new_ object - R_
do_ slot - R_
do_ slot_ assign - R_
envHas NoSpecial Symbols - R_
exists VarIn Frame - R_
finite - R_
force AndCall - R_
force Symbols - R_
getClass Def - R_
has_ slot - R_isort
- R_
lsInternal3 - R_
new_ custom_ connection - R_qsort
- R_
qsort_ I - R_
qsort_ int - R_
qsort_ int_ I - R_
register Routines - R_
remove VarFrom Frame - R_rsort
- R_
tryEval - R_
tryEval Silent - R_
useDynamic Symbols - Rf_
GetOption1 - Rf_
GetOption Width - Rf_
Scalar Complex - Rf_
Scalar Integer - Rf_
Scalar Logical - Rf_
Scalar Raw - Rf_
Scalar Real - Rf_
Scalar String - Rf_
String Blank - Rf_
alloc Array - Rf_
alloc List - Rf_
alloc Matrix - Rf_
alloc S4Object - Rf_
allocS Exp - Rf_
alloc Vector - Rf_
any_ duplicated - Rf_
any_ duplicated3 - Rf_
asCharacter Factor - Rf_
asInteger - Rf_
asLogical - Rf_
asReal - Rf_beta
- Rf_
choose - Rf_
classgets - Rf_
coerce Vector - Rf_cons
- Rf_
copy Most Attrib - Rf_
count Contexts - Rf_
define Var - Rf_
digamma - Rf_
dimgets - Rf_
dimnamesgets - Rf_
dpsifn - Rf_
duplicate - Rf_
duplicated - Rf_eval
- Rf_
find Fun - Rf_
find Var - Rf_
find VarIn Frame - Rf_
find VarIn Frame3 - Rf_
fprec - Rf_
fround - Rf_
ftrunc - Rf_
gammafn - Rf_
getAttrib - Rf_
getCharCE - Rf_
inherits - Rf_
install - Rf_
install Char - Rf_
install TrChar - Rf_
isEnvironment - Rf_
isFrame - Rf_
isFunction - Rf_
isInteger - Rf_
isLanguage - Rf_
isLogical - Rf_
isMatrix - Rf_
isNull - Rf_
isNumeric - Rf_
isObject - Rf_
isPrimitive - Rf_
isReal - Rf_isS4
- Rf_
isString - Rf_
isSymbol - Rf_
isVector - Rf_
isVector Atomic - Rf_
isVector List - Rf_
lang1 - Rf_
lang2 - Rf_
lang3 - Rf_
lang4 - Rf_
lang5 - Rf_
lang6 - Rf_
lbeta - Rf_
lchoose - Rf_
lcons - Rf_
length - Rf_
lengthgets - Rf_lengthgets โ resize a vector (copy into a new allocation).
- Rf_
lgamma1p - Rf_
lgammafn - Rf_
lgammafn_ sign - Rf_
log1pmx - Rf_
logspace_ add - Rf_
logspace_ sub - Rf_
match - Rf_
mkChar - Rf_
mkCharCE - Rf_
mkChar Len - Rf_
mkChar LenCE - Rf_
mkNamed - Rf_
mkString - Rf_
namesgets - Rf_
nchar - Rf_
ncols - Rf_
nrows - Rf_
nthcdr - Rf_
onintr - Rf_
pentagamma - Rf_
protect - Rf_
psigamma - Rf_
reEnc - Rf_
setAttrib - Rf_
shallow_ duplicate - Rf_sign
- Rf_
str2type - Rf_
tetragamma - Rf_
translate Char - Rf_
trigamma - Rf_
type2char - Rf_
type2str - Rf_
ucstoutf8 - Rf_
unprotect - Rf_
xlength - Rf_
xlengthgets - SET_
BODY - SET_
CLOENV - SET_
ENCLOS - SET_
FORMALS - SET_
FRAME - SET_
HASHTAB - SET_
PRCODE - SET_
PRENV - SET_
PRVALUE - S_alloc
- S_
realloc - addInput
Handler - beta
- calloc ๐ โ
- chol_
- choose
- clear_
callbacks - Clear interpreter callbacks after .Call returns.
- dbinom
- dgemm_
- dgemv_
- dnorm
- dpois
- dpotrf_
- dpotri_
- dqrdc2_
- dqrsl_
- dsyrk_
- dtrsl_
- dtrsm_
- exp_
rand - find_
registered_ c_ method - Look up a registered .C method by name. Returns the function pointer or null.
- find_
registered_ call - Look up a registered .Call method by name. Returns the function pointer or null.
- free ๐ โ
- free_
allocs - Free all tracked allocations (called by Rust after .Call). Persistent SEXPs (external pointers, flags=1) are kept alive.
- gammafn
- get_
stashed_ ๐rvalue - Retrieve a stashed RValue by index. Used by Rf_eval.
- iPsort
- init_
global_ envs - Initialize the global R_BaseEnv, R_GlobalEnv, R_EmptyEnv SEXPs from interpreter envs. Called once from the package loader before the first .Call.
- init_
globals - Initialize global sentinels. Called once at interpreter startup.
- langsxp_
to_ ๐text - Decompile a pairlist-style LANGSXP into R source text.
- lbeta
- lchoose
- lgammafn
- log1pexp
- nmmin
- norm_
rand - optif9
- pgamma
- pnorm
- ps__
define_ errno - ps__
list_ apps - qchisq
- qgamma
- qnorm
- rPsort
- rbinom
- realloc ๐ โ
- register_
call_ ๐methods - registered_
c_ method_ names - Get all registered .C method names.
- registered_
call_ names - Get all registered .Call method names.
- remove
Input Handler - revsort
- rexp
- rlang_
ccallable_ ๐sexp_ stub - Stub for rlang CCallable functions that return
SEXP. - rlang_
ccallable_ ๐str_ stub - Stub for rlang CCallable functions that return
const char*. - rnorm
- rpois
- rs_
- rsort_
with_ index - runif
- set_
callbacks - Set interpreter callbacks for the current .Call invocation.
- sexp_
to_ ๐text_ repr - Convert a SEXP value to its text representation for decompilation.
- stash_
rvalue ๐ - Stash an RValue and return its index. Used by R_ParseVector.
- sym_eq ๐
- track ๐
- unif_
rand - vmmin
Type Aliasesยง
- CbResult ๐
- Result type for interpreter callbacks.
- RCMethod
Def ๐ - R_CMethodDef has the same layout as R_CallMethodDef (name, fun, numArgs).