CXXR (C++ R)
|
Namespace for the CXXR project. More...
Namespaces | |
namespace | ElementTraits |
Namespace encapsulating traits of R vector element types. | |
namespace | VectorOps |
Services to support common operations on R vectors and arrays. |
Classes | |
class | Allocator |
STL-compatible allocator front-ending CXXR::MemoryBank. More... | |
class | ArgList |
Class encapsulating the argument list of a FunctionBase. More... | |
class | ArgMatcher |
Class to match formal and supplied arguments. More... | |
class | Bailout |
Class used to implement indirect flow of control in R. More... | |
struct | BailoutContext |
Context indicating that Bailout objects are understood. More... | |
class | Browser |
Class recording the use of R browsers. More... | |
class | BuiltInFunction |
R function implemented within the interpreter. More... | |
class | ByteCode |
ByteCode interpreter. More... | |
class | CellHeap |
class | CellPool |
Class to manage a pool of memory cells of a fixed size. More... | |
class | Closure |
Class representing a functional programming closure. More... | |
class | ClosureContext |
Context typically recording the call of a Closure. More... | |
class | CommandChronicle |
Record of bindings read by top-level command. More... | |
struct | CommandTerminated |
Exception thrown when a command is terminated prematurely. More... | |
struct | Complex |
CXXR's extension of CR's Rcomplex. More... | |
class | ConsCell |
Element of a singly linked list. More... | |
class | PairList |
Singly linked list of pairs. More... | |
class | DotInternalTable |
Table of functions invoked via .Internal() . More... | |
class | DottedArgs |
List of Promise objects corresponding to an R ... argument specification. More... | |
class | Environment |
Mapping from Symbols to R objects. More... | |
class | Evaluator |
Framework for R command evaluation. More... | |
class | Expression |
Singly linked list representing an R expression. More... | |
class | ExternalPointer |
External pointer. More... | |
class | FixedVector |
R data vector primarily intended for fixed-size use. More... | |
class | Frame |
Mapping from Symbols to R objects. More... | |
class | FunctionBase |
Base class for function types. More... | |
class | FunctionContext |
Context recording the invocation of a FunctionBase. More... | |
class | GCEdgeBase |
Untemplated base class for GCEdge. More... | |
class | GCEdge |
Directed edge in the graph whose nodes are GCNode objects. More... | |
class | GCManager |
Class for managing garbage collection. More... | |
class | GCNode |
Base class for objects managed by the garbage collector. More... | |
class | GCRootBase |
Untemplated base class for GCRoot. More... | |
class | GCRoot |
Smart pointer to protect a GCNode from garbage collection. More... | |
class | GCStackRootBase |
Untemplated base class for GCStackRoot. More... | |
class | GCStackRoot |
Smart pointer to protect a GCNode from garbage collection. More... | |
class | HeterogeneousListBase |
Untemplated base class for HeterogeneousList. More... | |
class | HeterogeneousList |
Doubly-linked list of objects derived from a class Node. More... | |
class | ListFrame |
Lightweight implementation of CXXR::Frame. More... | |
class | LoopBailout |
Bailout class for R commands 'break' and 'next'. More... | |
class | LoopException |
Exception thrown by R commands 'break' and 'next'. More... | |
class | MemoryBank |
Class to manage memory allocation and deallocation for CXXR. More... | |
class | NAAugment |
Class template to augment a type with 'not available'. More... | |
class | NodeStack |
Class implementing a stack of RObject*. More... | |
struct | PlainContext |
Lightweight Context neutralizing BailoutContext. More... | |
class | Promise |
Mechanism for deferred evaluation. More... | |
class | ProtectStack |
Class implementing CR's 'pointer protection stack'. More... | |
class | Provenance |
Provenance of a Frame::Binding state. More... | |
class | RAllocStack |
Class for implementing R_alloc() and kindred functions. More... | |
class | ReturnBailout |
Bailout class to convey return value. More... | |
class | ReturnException |
Exception class to convey return value. More... | |
class | RHandle |
Smart pointer used to control the copying of RObjects. More... | |
class | RObject |
Replacement for CR's SEXPREC. More... | |
class | S11nScope |
Class providing supplementary information for serialization. More... | |
class | S3Launcher |
Class to select and call to S3 methods. More... | |
class | S4Object |
S4 object. More... | |
class | SchwarzCounter |
Schwarz counter. More... | |
class | StdFrame |
General-purpose implementation of CXXR::Frame. More... | |
class | String |
RObject representing a character string. More... | |
class | Subscripting |
Services to support R subscripting operations. More... | |
class | Symbol |
Class used to represent R symbols. More... | |
class | VectorBase |
Untemplated base class for R vectors. More... | |
class | WeakRef |
Weak reference. More... |
Typedefs | |
typedef CXXR::FixedVector < Complex, CPLXSXP > | ComplexVector |
Vector of complex numbers. | |
typedef FixedVector< RHandle <>, EXPRSXP > | ExpressionVector |
Expression vector. | |
typedef FixedVector< int, INTSXP > | IntVector |
Vector of integer values. | |
typedef FixedVector< RHandle <>, VECSXP > | ListVector |
General vector of RHandle<RObject>. | |
typedef CXXR::FixedVector< int, LGLSXP > | LogicalVector |
Vector of truth values. | |
typedef CXXR::FixedVector < Rbyte, RAWSXP > | RawVector |
Vector of 'raw bytes'. | |
typedef CXXR::FixedVector < double, REALSXP > | RealVector |
Vector of real numbers. | |
typedef FixedVector< RHandle < String >, STRSXP > | StringVector |
Vector of strings. |
Functions | |
void | DEPARSE (SEXP s) |
pair< Environment *, FunctionBase * > | findFunction (const Symbol *symbol, Environment *env, bool inherits=true) |
Search for a Binding of a Symbol to a FunctionBase. | |
void | LS (SEXP s) |
void | TRACEBACK () |
void | frameReadPairList (Frame *frame, PairList *bindings) |
Incorporate bindings defined by a PairList into a Frame. | |
bool | isMissingArgument (const Symbol *sym, Frame *frame) |
Does a Symbol correspond to a missing argument? | |
template<typename T1 , typename T2 > | |
bool | operator== (const Allocator< T1 > &, const Allocator< T2 > &) throw () |
template<typename T1 , typename T2 > | |
bool | operator!= (const Allocator< T1 > &, const Allocator< T2 > &) throw () |
bool | operator== (ConsCell::iterator l, ConsCell::iterator r) |
bool | operator!= (ConsCell::iterator l, ConsCell::iterator r) |
bool | operator== (ConsCell::const_iterator l, ConsCell::const_iterator r) |
bool | operator!= (ConsCell::const_iterator l, ConsCell::const_iterator r) |
RObject * | car0 (ConsCell *cc) |
cc ? cc->car() : 0 | |
void | ccdump (std::ostream &os, const ConsCell &cc, size_t margin=0) |
(For debugging.) | |
size_t | listLength (const ConsCell *start) |
Number of elements in list. | |
PairList * | tail0 (ConsCell *cc) |
cc ? cc->tail() : 0 | |
template<typename T > | |
bool | isNA (const T &t) |
Does a value represent a distinct 'not available' status? | |
template<typename T > | |
const T & | NA () |
Value to be used if 'not available'. | |
template<typename UnaryPredicate > | |
std::pair< Environment *, RObject * > | findTestedValue (const Symbol *symbol, Environment *env, UnaryPredicate pred, bool inherits) |
Search for a Binding whose value satisfies a predicate. | |
RObject * | evaluate (RObject *object, Environment *env) |
Shorthand for Evaluator::evaluate(). | |
RObject * | forceIfPromise (RObject *object) |
Use forced value if RObject is a Promise. | |
void | SEXP_downcast_error (const char *given, const char *wanted) |
Not for general use. | |
template<typename PtrOut , typename PtrIn > | |
PtrOut | SEXP_downcast (PtrIn s, bool allow_null=true) |
bool | isASCII (const std::string &str) |
Is a std::string entirely ASCII? | |
StringVector * | asStringVector (const std::string &str, cetype_t encoding=CE_NATIVE) |
Create a StringVector containing a single std::string. | |
void | strdump (std::ostream &os, const StringVector &sv, std::size_t margin=0) |
(For debugging.) | |
bool | isDotSymbol (const Symbol *symbol) |
Does Symbol's name start with '.'? | |
bool | isDotDotSymbol (const Symbol *symbol) |
Does Symbol's name start with '..'? | |
unsigned int | stringWidth (unsigned int minwidth, const CXXR::String *string) |
unsigned int | stringWidthQuote (unsigned int minwidth, const CXXR::String *string) |
R_len_t | length (RObject *s) |
Shorthand for Rf_length(). |
Variables | |
Symbol *const | BracketSymbol = Symbol::obtain("[") |
Symbol *const | BraceSymbol = Symbol::obtain("{") |
Symbol *const | TmpvalSymbol = Symbol::obtain("*tmp*") |
Symbol *const | ClassSymbol = Symbol::obtain("class") |
Symbol *const | ConnIdSymbol = Symbol::obtain("conn_id") |
Symbol *const | DimNamesSymbol = Symbol::obtain("dimnames") |
Symbol *const | DimSymbol = Symbol::obtain("dim") |
Symbol *const | DollarSymbol = Symbol::obtain("$") |
Symbol *const | DotClassSymbol = Symbol::obtain(".Class") |
Symbol *const | DotDeviceSymbol = Symbol::obtain(".Device") |
Symbol *const | DotDevicesSymbol = Symbol::obtain(".Devices") |
Symbol *const | DotGenericSymbol = Symbol::obtain(".Generic") |
Symbol *const | DotGenericCallEnvSymbol = Symbol::obtain(".GenericCallEnv") |
Symbol *const | DotGenericDefEnvSymbol = Symbol::obtain(".GenericDefEnv") |
Symbol *const | DotGroupSymbol = Symbol::obtain(".Group") |
Symbol *const | DotMethodSymbol = Symbol::obtain(".Method") |
Symbol *const | DotMethodsSymbol = Symbol::obtain(".Methods") |
Symbol *const | DotdefinedSymbol = Symbol::obtain(".defined") |
Symbol *const | DotsSymbol = Symbol::obtain("...") |
Symbol *const | DottargetSymbol = Symbol::obtain(".target") |
Symbol *const | DoubleColonSymbol = Symbol::obtain("::") |
Symbol *const | DropSymbol = Symbol::obtain("drop") |
Symbol *const | ExactSymbol = Symbol::obtain("exact") |
Symbol *const | LastvalueSymbol = Symbol::obtain(".Last.value") |
Symbol *const | LevelsSymbol = Symbol::obtain("levels") |
Symbol *const | ModeSymbol = Symbol::obtain("mode") |
Symbol *const | NameSymbol = Symbol::obtain("name") |
Symbol *const | NamesSymbol = Symbol::obtain("names") |
Symbol *const | NaRmSymbol = Symbol::obtain("na.rm") |
Symbol *const | PackageSymbol = Symbol::obtain("package") |
Symbol *const | PreviousSymbol = Symbol::obtain("previous") |
Symbol *const | QuoteSymbol = Symbol::obtain("quote") |
Symbol *const | RowNamesSymbol = Symbol::obtain("row.names") |
Symbol *const | S3MethodsTableSymbol = Symbol::obtain(".__S3MethodsTable__.") |
Symbol *const | SeedsSymbol = Symbol::obtain(".Random.seed") |
Symbol *const | SourceSymbol = Symbol::obtain("source") |
Symbol *const | TripleColonSymbol = Symbol::obtain(":::") |
Symbol *const | TspSymbol = Symbol::obtain("tsp") |
Symbol *const | CommentSymbol = Symbol::obtain("comment") |
Symbol *const | DotEnvSymbol = Symbol::obtain(".Environment") |
Symbol *const | RecursiveSymbol = Symbol::obtain("recursive") |
Symbol *const | UseNamesSymbol = Symbol::obtain("use.names") |
Symbol *const | SrcfileSymbol = Symbol::obtain("srcfile") |
Symbol *const | SrcrefSymbol = Symbol::obtain("srcref") |
Symbol *const | WholeSrcrefSymbol = Symbol::obtain("wholeSrcref") |
typedef FixedVector<RHandle<>, EXPRSXP> CXXR::ExpressionVector |
Expression vector.
The vector contains smart pointers of type RObject::Handle<RObject>, where the intention is that these pointers should point to language objects.
typedef FixedVector< RHandle< String >, STRSXP > CXXR::StringVector |
Vector of strings.
Note that the StringVector(size_t)
constructor will fill the constructed vector with blank strings rather than with NULL.
|
inline |
Create a StringVector containing a single std::string.
This constructor constructs a StringVector containing a single element, and initializes that element to represent a specified string and encoding.
str | The required text of the single vector element. |
encoding | The required encoding of the single vector element. Only CE_NATIVE, CE_UTF8 or CE_LATIN1 are permitted in this context (checked). |
cc ? cc->car() : 0
cc | Pointer to the ConsCell whose 'car' object is required. |
void CXXR::ccdump | ( | std::ostream & | os, |
const ConsCell & | cc, | ||
size_t | margin = 0 |
||
) |
(For debugging.)
|
inline |
Shorthand for Evaluator::evaluate().
object | Pointer to the RObject to be evaluated. May be null, in which case the function returns a null pointer. |
env | Pointer to the environment in which evaluation is to take place. May be null only if object is null. |
std::pair< Environment *, FunctionBase * > CXXR::findFunction | ( | const Symbol * | symbol, |
Environment * | env, | ||
bool | inherits = true |
||
) |
Search for a Binding of a Symbol to a FunctionBase.
This function looks for a Binding of symbol, and tests whether the Binding's value is a FunctionBase.
If a Binding of symbol to a Promise is encountered, the Promise is forced before testing whether the value of the Promise is a FunctionBase. In this case, if the predicate is satisfied, the result of evaluating the Promise is part of the returned value.
If, in the course of searching for a suitable Binding, a Binding of symbol to Symbol::missingArgument() (R_MissingArg) is encountered, an error is raised.
Read/write monitors are invoked in the following circumstances: (i) If a Promise is forced, any read monitor for the relevant Binding is called before forcing it, and any write monitor for the symbol's Binding is called immediately afterwards. (ii) If this function succeeds in finding a Binding to a FunctionBase, then any read monitor for that Binding is called.
symbol | Non-null pointer to the Symbol for which a Binding is sought. |
env | Pointer to the Environment in which the search for a Binding is to start. Must not be null. |
inherits | If false, only the Frame of env will be searched; if true, the search will propagate as necessary to enclosing environments until either a Binding to a FunctionBase is found, or the chain of enclosing environments is exhausted. |
std::pair<Environment*, RObject*> CXXR::findTestedValue | ( | const Symbol * | symbol, |
Environment * | env, | ||
UnaryPredicate | pred, | ||
bool | inherits | ||
) |
Search for a Binding whose value satisfies a predicate.
This function looks for a Binding of symbol, and tests whether the Binding's value satisfies a predicate pred.
If a Binding of symbol to a Promise is encountered, the Promise is forced before applying the predicate to the result of evaluating the Promise. In this case, if the predicate is satisfied, the result of evaluating the Promise is part of the returned value.
Read/write monitors are invoked in the following circumstances: (i) If a Promise is forced, any read monitor for the relevant Binding is called before forcing it, and any write monitor for the symbol's Binding is called immediately afterwards. (ii) If this function succeeds in finding a Binding satisfying the predicate, then any read monitor for that Binding is called.
UnaryPredicate | A type of function or function object capable of accepting const RObject* and returning bool. |
symbol | Pointer to the Symbol for which a Binding is sought. |
env | Pointer to the Environment in which the search for a Binding is to start. Must not be null. |
pred | The UnaryPredicate object to be used to test candidate values. |
inherits | If false, only the Frame of env will be searched; if true, the search will propagate as necessary to enclosing environments until either a Binding satisfying the predicate is found, or the chain of enclosing environments is exhausted. |
Incorporate bindings defined by a PairList into a Frame.
Raises an error if the Frame is locked, or an attempt is made to modify a binding that is locked.
frame | Pointer to the Frame into which new or modified bindings are to be incorporated. |
bindings | List of symbol-value pairs defining bindings to be incorporated into the environment. Every element of this list must have a Symbol as its tag (checked). If the list contains duplicate tags, later symbol-value pairs override earlier ones. Each resulting binding is locked and/or set active according to the m_active_binding and m_binding_locked fields of the corresponding PairList element. |
bool CXXR::isASCII | ( | const std::string & | str | ) |
Is a std::string entirely ASCII?
str | The string to be examined. |
|
inline |
|
inline |
Does a Symbol correspond to a missing argument?
Within a Frame frame, a Symbol sym is considered to correspond to a missing argument if any of the following criteria is satisfied:
sym is itself Symbol::missingArgument() (R_MissingArg).
The binding of sym within frame is flagged as having origin Frame::Binding::MISSING.
sym is bound to Symbol::missingArgument().
sym is bound to a unforced Promise, and forcing the Promise would consist in evaluating a Symbol which - by a recursive application of these criteria - is missing with respect to the Frame of the Environment of the Promise.
Note that unless Criterion 1 applies, sym is not considered missing if it is not bound at all within frame, or if it has an active binding.
sym | Non-null pointer to the Symbol whose missing status is to be determined. |
frame | Non-null pointer to the Frame with respect to which missingness is to be determined. |
bool CXXR::isNA | ( | const T & | t | ) |
Does a value represent a distinct 'not available' status?
This templated function is syntactic sugar for the ElementTraits::IsNA() function objects. It should not be specialized; instead specialize ElementTraits::IsNA itself.
T | A type capable of being used as the element type of an R data vector. |
t | A value of type T . |
|
inline |
Shorthand for Rf_length().
|
inline |
const T& CXXR::NA | ( | ) |
Value to be used if 'not available'.
This templated function is syntactic sugar for the ElementTraits::NAFunc() function objects. It should not be specialized; instead specialize ElementTraits::NAFunc itself.
T | A type capable of being used as the element type of an R data vector. |
PtrOut CXXR::SEXP_downcast | ( | PtrIn | s, |
bool | allow_null = true |
||
) |
Down cast within the RObject class tree.
PtrOut | Cast the pointer to type PtrOut, where PtrOut is a pointer or const pointer to RObject or a class derived from RObject. |
PtrIn | Cast the pointer from type PtrIn, where PtrIn is a pointer or const pointer to RObject or a class derived from RObject. This type is usually inferred from the supplied parameter s. |
s | The pointer to be cast. |
allow_null | true iff s is permitted to be a null pointer. |
void CXXR::SEXP_downcast_error | ( | const char * | given, |
const char * | wanted | ||
) |
Not for general use.
(Used by SEXP_downcast() to report an erroneous cast.)
void CXXR::strdump | ( | std::ostream & | os, |
const StringVector & | sv, | ||
std::size_t | margin = 0 |
||
) |
(For debugging.)
cc ? cc->tail() : 0
cc | Pointer to the ConsCell whose tail pointer is required. |