#include <nspcinfo.h>
Inheritance diagram for VM::NamespaceInfo:
Public Types | |
enum | NSType { NSNamespace, NSClass } |
Different types of namespace info. More... | |
Public Member Functions | |
NamespaceInfo (const TLString &name, NamespaceInfo *parent=NULL, NSType nstype=NSNamespace) | |
Construct namespace node. | |
virtual | ~NamespaceInfo () |
Destroy namespace node recursively deleting all child nodes. | |
void | SortNamespaceTree () |
Recursively sort the namespace tree. | |
void | AddChild (NamespaceInfo *child) |
Explicitly add a child. | |
virtual TLString | CompleteName () const |
Return complete name. | |
virtual void | DumpTree (StringTreeDump &dump, bool IDs_resolved, bool recurse=1) const |
Emit a dump of the tree. | |
Static Public Member Functions | |
const char * | NSType2String (NSType t) |
Translate NSType to string representation. | |
Protected Types | |
typedef TLLinearQueue< SymbolEntryE, TLDefaultOperators_CDT< SymbolEntryE > > | SymbolList |
Protected Member Functions | |
void | _AddChild (NamespaceInfo *child) |
Used by child to add itself as child node. | |
void | _DelChild (NamespaceInfo *child) |
Used by child to delete itself as child node. | |
Protected Attributes | |
NamespaceInfo * | parent |
Pointer to parent in tree. | |
LinkedList< NamespaceInfo > | down |
List of child nodes. | |
TLString | name |
Name of the namespace or class. | |
NSType | nstype |
Which type of namespace info. | |
SCLocation | asm_loc |
Location in assembler source. No set in the master tree. | |
NamespaceInfo * | linked |
uint16 | link_info_set: 1 |
uint16 | recursion_flag: 1 |
Used by checks for recursive loops of namespaces. | |
SymbolList | symbol |
TLBTree< NamespaceInfo *, PtrListOperators< NamespaceInfo > > | map_name2child |
Map of child names to child nodes. | |
TLBTree< SymbolEntryE *, PtrListOperators< SymbolEntryE > > | map_name2symbol |
Map of symbol names to symbol entries (non-internal symbols only). | |
Private Member Functions | |
NamespaceInfo (const NamespaceInfo &) | |
Do not use. | |
void | operator= (const NamespaceInfo &) |
Do not use. | |
Friends | |
class | AssemblerFile |
class | AssemblerFile_Plaintext |
class | VMLinker |
This class is used to build a tree-like structure of the class/namespace information blocks; it is NOT C++-safe; the base list is held by the higher-level NamespaceInfo.
AssemblerFile (and derived classes) are friends for parsing.
VMLinker is a friend for linking.
Both these friendships are due to the fact that the NamespaceInfo is actually more a information container and tree node than a full-featured class of itself.
Definition at line 61 of file nspcinfo.h.
|
Definition at line 217 of file nspcinfo.h. |
|
Different types of namespace info.
Definition at line 105 of file nspcinfo.h. |
|
Do not use.
|
|
Construct namespace node.
Definition at line 289 of file nspcinfo.cc. References _AddChild(), link_info_set, parent, and recursion_flag. |
|
Destroy namespace node recursively deleting all child nodes.
Definition at line 309 of file nspcinfo.cc. References _DelChild(), down, LinkedList< NamespaceInfo >::IsEmpty(), linked, parent, and LinkedList< NamespaceInfo >::PopFirst(). |
|
Used by child to add itself as child node.
For internal use only.
Definition at line 248 of file nspcinfo.cc. References _unused_, LinkedList< NamespaceInfo >::append(), Assert, down, LinkedList< NamespaceInfo >::last(), map_name2child, name, LinkedListBase< NamespaceInfo >::next, and TLBTree< NamespaceInfo *, PtrListOperators< NamespaceInfo > >::store(). Referenced by AddChild(), and NamespaceInfo(). |
|
Used by child to delete itself as child node.
For internal use only.
Definition at line 264 of file nspcinfo.cc. References _unused_, Assert, LinkedList< NamespaceInfo >::dequeue(), down, LinkedList< NamespaceInfo >::last(), map_name2child, name, LinkedListBase< NamespaceInfo >::next, and TLBTree< NamespaceInfo *, PtrListOperators< NamespaceInfo > >::remove(). Referenced by ~NamespaceInfo(). |
|
Explicitly add a child.
Can be used only if the child was created with parent=NULL. Definition at line 278 of file nspcinfo.cc. References _AddChild(), Assert, and parent. Referenced by VM::VMLinker::_MergeNamespaceInfo_Recursive(). |
|
Return complete name. The complete name is the name of the class/namespace and all the names up the hierarchy, separated by "::". Reimplemented in VM::ClassInfo. Definition at line 191 of file nspcinfo.cc. References name, parent, and TLString::prepend(). Referenced by VM::VMLinker::_CheckBaseRecursion_Recursive(), VM::VMLinker::_CheckNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_ParseSymbols_Symbols(), and VM::NamespaceInfo::SymbolEntryB::CompleteName(). |
|
|
Translate NSType to string representation.
Definition at line 25 of file nspcinfo.cc. References NSClass, and NSNamespace. Referenced by DumpTree(). |
|
Do not use.
|
|
Recursively sort the namespace tree. This uses mergesort on linked lists and uses O(n*log(n)) time without any additional memory. Definition at line 163 of file nspcinfo.cc. References down, LinkedList< NamespaceInfo >::first(), LinkedList< NamespaceInfo >::IsEmpty(), LinkedList< NamespaceInfo >::last(), LinkedList< NamespaceInfo >::MergeSort(), and LinkedListBase< NamespaceInfo >::next. |
|
Reimplemented in VM::ClassInfo. Definition at line 64 of file nspcinfo.h. |
|
Reimplemented in VM::ClassInfo. Definition at line 65 of file nspcinfo.h. |
|
Reimplemented in VM::ClassInfo. Definition at line 67 of file nspcinfo.h. |
|
Location in assembler source. No set in the master tree.
Definition at line 204 of file nspcinfo.h. Referenced by VM::VMLinker::_CheckBaseRecursion_Recursive(), VM::VMLinker::_CheckNamespaceInfo_Recursive(), VM::VMLinker::_GenerateSymbolProvideMap(), VM::VMLinker::_GenerateSymbolProvideMap_AddGlobal(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_ParseSymbols_Class(), VM::AssemblerFile_Plaintext::_ParseSymbols_Namespace(), VM::AssemblerFile_Plaintext::_ParseSymbolSection(), VM::AssemblerFile::_ResolveIDsNamespaceLocal_Recursive(), and VM::VMLinker::LinkAll(). |
|
|
Flag indicating whether this NamespaceInfo is already filled with info from the first occurance in souce or not. Used by linker; only used in master tree. Definition at line 212 of file nspcinfo.h. Referenced by VM::VMLinker::_CheckNamespaceInfo_Recursive(), DumpTree(), and NamespaceInfo(). |
|
Pointer to corresponding merged/linked master namespace info. Used by linker; not used in master tree. Definition at line 208 of file nspcinfo.h. Referenced by VM::VMLinker::_CheckNamespaceInfo_Recursive(), VM::VMLinker::_LinkerNeedClassConstruct(), VM::VMLinker::_LinkFunction(), VM::VMLinker::_LinkGlobalStorage(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), DumpTree(), VM::VMLinker::LinkAll(), VM::VMLinker::SPM_ORD(), VM::NamespaceInfo::SymbolEntryE::SymbolEntryE(), and ~NamespaceInfo(). |
|
Map of child names to child nodes.
Definition at line 227 of file nspcinfo.h. Referenced by _AddChild(), VM::AssemblerFile_Plaintext::_CheckNspcNameKnown(), and _DelChild(). |
|
Map of symbol names to symbol entries (non-internal symbols only).
Definition at line 230 of file nspcinfo.h. Referenced by VM::VMLinker::_LinkGlobalStorage(), VM::AssemblerFile_Plaintext::_ParseProgram_Label(), VM::AssemblerFile_Plaintext::_ParseSymbols_Symbols(), and VM::VMLinker::LinkAll(). |
|
Name of the namespace or class.
Definition at line 200 of file nspcinfo.h. Referenced by _AddChild(), _DelChild(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_ParseProgram_Label(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), CompleteName(), DumpTree(), VM::NamespaceInfo::_Operators::le(), and VM::NamespaceInfo::SymbolEntryE::SymbolEntryE(). |
|
|
Pointer to parent in tree.
Definition at line 198 of file nspcinfo.h. Referenced by VM::VMLinker::_GetDefinitionFile(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), AddChild(), CompleteName(), VM::NamespaceInfo::SymbolEntryB::CompleteName(), DumpTree(), NamespaceInfo(), and ~NamespaceInfo(). |
|
Used by checks for recursive loops of namespaces.
Definition at line 214 of file nspcinfo.h. Referenced by VM::VMLinker::_CheckBaseRecursion(), and NamespaceInfo(). |
|
Queue of symbol entries. Actually, we could use an array for parsing but for linking, a queue is better (resize operation). Definition at line 224 of file nspcinfo.h. Referenced by VM::VMLinker::_LinkGlobalStorage(), VM::AssemblerFile_Plaintext::_ParseSymbols_Symbols(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), DumpTree(), and VM::VMLinker::LinkAll(). |