42 #ifndef BUILTINFUNCTION_H
43 #define BUILTINFUNCTION_H
50 #include <boost/serialization/nvp.hpp>
141 return s_function_table[m_offset].arity;
177 return s_function_table[m_offset].gram.kind;
186 return s_function_table[m_offset].name;
226 return s_function_table[m_offset].gram.precedence;
240 return m_result_printing_mode;
249 return s_function_table[m_offset].gram.rightassoc;
258 return "(builtin or special)";
273 return s_function_table[m_offset].variant;
283 return (s_function_table[m_offset].flags%100)/10 == 1;
293 friend class boost::serialization::access;
300 unsigned int rightassoc;
317 enum ResultPrintingMode {FORCE_ON = 0, FORCE_OFF, SOFT_ON};
320 static TableEntry* s_function_table;
324 typedef std::map<std::string, BuiltInFunction*> map;
329 ResultPrintingMode m_result_printing_mode;
353 BuiltInFunction(
unsigned int offset);
359 static void cleanup();
369 static int indexInTable(
const char*
name);
373 static void initialize();
376 RObject* invoke(Environment* env,
const ArgList* arglist,
377 const Expression* call)
const
379 return m_function(const_cast<Expression*>(call),
380 const_cast<BuiltInFunction*>(
this),
381 const_cast<PairList*>(arglist->list()), env);
384 template<
class Archive>
385 void load(Archive & ar,
const unsigned int version);
397 static void missingArgumentError(
const BuiltInFunction* func,
398 const PairList* args,
401 template<
class Archive>
402 void save(Archive & ar,
const unsigned int version)
const;
405 template <
class Archive>
406 void serialize(Archive& ar,
const unsigned int version) {
407 boost::serialization::split_member(ar, *
this, version);
415 #include "CXXR/Environment.h"
423 template<
class Archive>
424 void CXXR::BuiltInFunction::load(Archive& ar,
const unsigned int version)
430 ar >> boost::serialization::make_nvp(
"name", namestr);
434 template<
class Archive>
435 void CXXR::BuiltInFunction::save(Archive& ar,
const unsigned int version)
const
437 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(FunctionBase);
438 std::string namestr(name());
439 ar << boost::serialization::make_nvp(
"name", namestr);
444 inline int PRIMARITY(
SEXP x)
446 using namespace CXXR;
453 using namespace CXXR;
458 inline int PRIMINTERNAL(
SEXP x)
460 using namespace CXXR;
465 inline int PRIMPRINT(
SEXP x)
467 using namespace CXXR;
476 const char* PRIMNAME(
SEXP x);
478 inline const char* PRIMNAME(
SEXP x)
480 using namespace CXXR;
497 using namespace CXXR;
504 unsigned int PRIMVAL(
SEXP x);
506 inline unsigned int PRIMVAL(
SEXP x)
508 using namespace CXXR;