96 typedef std::vector<GCRoot<Symbol> > Table;
110 const Symbol* operator*() {
121 return (m_tblit != other.m_tblit);
124 Table::const_iterator m_tblit;
132 static const_iterator end()
134 return const_iterator(s_table->end());
158 return m_dd_index != 0;
176 return s_missing_arg;
203 return (name->m_symbol ? name->m_symbol : make(name));
249 return s_unbound_value;
262 friend class boost::serialization::access;
265 static const size_t s_max_length = 256;
266 static Table* s_table;
270 static Symbol* s_missing_arg;
271 static Symbol* s_unbound_value;
275 unsigned int m_dd_index;
277 enum S11nType {NORMAL = 0, MISSINGARG, UNBOUNDVALUE};
289 explicit Symbol(
const String*
name = 0);
298 Symbol(
const Symbol&);
299 Symbol& operator=(
const Symbol&);
301 static void cleanup();
304 static void initialize();
306 template<
class Archive>
307 void load(Archive & ar,
const unsigned int version);
314 static Symbol* make(
const String*
name);
316 template<
class Archive>
317 void save(Archive & ar,
const unsigned int version)
const;
320 template <
class Archive>
321 void serialize(Archive& ar,
const unsigned int version)
323 boost::serialization::split_member(ar, *
this, version);
336 return symbol && symbol->
name()->
c_str()[0] ==
'.';
352 extern Symbol*
const Bracket2Symbol;
353 extern Symbol*
const BracketSymbol;
354 extern Symbol*
const BraceSymbol;
355 extern Symbol*
const ClassSymbol;
356 extern Symbol*
const ConnIdSymbol;
357 extern Symbol*
const DimNamesSymbol;
358 extern Symbol*
const DimSymbol;
359 extern Symbol*
const DollarSymbol;
360 extern Symbol*
const DotClassSymbol;
361 extern Symbol*
const DotDeviceSymbol;
362 extern Symbol*
const DotDevicesSymbol;
363 extern Symbol*
const DotGenericSymbol;
364 extern Symbol*
const DotGenericCallEnvSymbol;
365 extern Symbol*
const DotGenericDefEnvSymbol;
366 extern Symbol*
const DotGroupSymbol;
367 extern Symbol*
const DotMethodSymbol;
368 extern Symbol*
const DotMethodsSymbol;
369 extern Symbol*
const DotdefinedSymbol;
370 extern Symbol*
const DotsSymbol;
371 extern Symbol*
const DottargetSymbol;
372 extern Symbol*
const DoubleColonSymbol;
373 extern Symbol*
const DropSymbol;
374 extern Symbol*
const ExactSymbol;
375 extern Symbol*
const LastvalueSymbol;
376 extern Symbol*
const LevelsSymbol;
377 extern Symbol*
const ModeSymbol;
378 extern Symbol*
const NameSymbol;
379 extern Symbol*
const NamesSymbol;
380 extern Symbol*
const NaRmSymbol;
381 extern Symbol*
const PackageSymbol;
382 extern Symbol*
const PreviousSymbol;
383 extern Symbol*
const QuoteSymbol;
384 extern Symbol*
const RowNamesSymbol;
385 extern Symbol*
const S3MethodsTableSymbol;
386 extern Symbol*
const SeedsSymbol;
387 extern Symbol*
const LastvalueSymbol;
388 extern Symbol*
const TripleColonSymbol;
389 extern Symbol*
const TspSymbol;
390 extern Symbol*
const CommentSymbol;
391 extern Symbol*
const SourceSymbol;
392 extern Symbol*
const DotEnvSymbol;
393 extern Symbol*
const RecursiveSymbol;
394 extern Symbol*
const SrcfileSymbol;
395 extern Symbol*
const SrcrefSymbol;
396 extern Symbol*
const WholeSrcrefSymbol;
397 extern Symbol*
const TmpvalSymbol;
398 extern Symbol*
const UseNamesSymbol;
409 template<
class Archive>
410 void CXXR::Symbol::load(Archive& ar,
const unsigned int version)
414 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
RObject);
416 ar >> BOOST_SERIALIZATION_NVP(symtype);
422 ar >> BOOST_SERIALIZATION_NVP(name);
427 reloc = s_missing_arg;
430 reloc = s_unbound_value;
436 template<
class Archive>
437 void CXXR::Symbol::save(Archive& ar,
const unsigned int version)
const
439 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(RObject);
440 S11nType symtype = NORMAL;
441 if (
this == s_missing_arg)
442 symtype = MISSINGARG;
443 else if (
this == s_unbound_value)
444 symtype = UNBOUNDVALUE;
445 ar << BOOST_SERIALIZATION_NVP(symtype);
446 if (symtype == NORMAL) {
451 std::string name = m_name->stdstring();
452 ar << BOOST_SERIALIZATION_NVP(name);
460 extern SEXP R_MissingArg;
461 extern SEXP R_UnboundValue;
464 extern SEXP R_Bracket2Symbol;
465 extern SEXP R_BracketSymbol;
466 extern SEXP R_BraceSymbol;
467 extern SEXP R_ClassSymbol;
468 extern SEXP R_ConnIdSymbol;
469 extern SEXP R_DeviceSymbol;
470 extern SEXP R_DevicesSymbol;
471 extern SEXP R_DimNamesSymbol;
472 extern SEXP R_DimSymbol;
473 extern SEXP R_DollarSymbol;
474 extern SEXP R_DotsSymbol;
475 extern SEXP R_DoubleColonSymbol;
476 extern SEXP R_DropSymbol;
477 extern SEXP R_LastvalueSymbol;
478 extern SEXP R_LevelsSymbol;
479 extern SEXP R_ModeSymbol;
480 extern SEXP R_NameSymbol;
481 extern SEXP R_NamesSymbol;
482 extern SEXP R_NaRmSymbol;
483 extern SEXP R_PackageSymbol;
484 extern SEXP R_QuoteSymbol;
485 extern SEXP R_RowNamesSymbol;
486 extern SEXP R_SeedsSymbol;
487 extern SEXP R_SourceSymbol;
488 extern SEXP R_TripleColonSymbol;
489 extern SEXP R_TspSymbol;
491 extern SEXP R_dot_Generic;
492 extern SEXP R_dot_Method;
493 extern SEXP R_dot_defined;
494 extern SEXP R_dot_target;
508 using namespace CXXR;
509 const Symbol& sym = *SEXP_downcast<Symbol*>(x);
510 return Rboolean(sym.isDotDotSymbol());
577 using namespace CXXR;
578 const Symbol& sym = *SEXP_downcast<Symbol*>(x);
579 return const_cast<String*
>(sym.name());