Ejemplo n.º 1
0
void SymScope::dump(FILE* f, int nest_level)
{
	//recursively prints out the symbol table
	//from the head down through all the childrens
	ScopeTableType::iterator si;

	//indent appropriately
	fprintf(f,"# ");
	for( int i=0; i<nest_level; i++ ) { fprintf(f,"\t"); }
	fprintf(f,"+-- Symbol Scope (%d bytes at %p)---\n", m_scopesize, (void*)this );

	for( si = m_scopetable.begin(); si != m_scopetable.end(); ++si )
	{
		//indent appropriately
		fprintf(f,"# ");
		for( int i=0; i<nest_level; i++ ) { fprintf(f,"\t"); }
		fprintf( f, "| %s (offset=%d,scope=%p)\n", si->first, si->second->m_offset, (void*)si->second->m_symscope );
	}
	fprintf(f,"# ");
	for( int i=0; i<nest_level; i++ ) { fprintf(f,"\t"); }
	fprintf(f,"+-------------\n#\n");

	//now print all the children
	list<SymScope*>::iterator li;
	for( li=m_child.begin(); li!=m_child.end(); ++li )
	{
		(*li)->dump(f, nest_level+1);
	}
}
Ejemplo n.º 2
0
void SymScope::dump(FILE* f, int nest_level)
{
	//recursively prints out the symbol table
	//from the head down through all the childrens

	ScopeTableType::iterator si;

	//indent appropriately
	for( int i=0; i<nest_level; i++ ) { fprintf(f,"\t"); }
	fprintf(f,"+-- Symbol Scope ---\n");

	for( si = m_scopetable.begin(); si != m_scopetable.end(); ++si )
	{
		//indent appropriately
		for( int i=0; i<nest_level; i++ ) { fprintf(f,"\t"); }
		fprintf( f, "| %s \n", si->first );
	}
	for( int i=0; i<nest_level; i++ ) { fprintf(f,"\t"); }
	fprintf(f,"+-------------\n\n");

	//now print all the children
	list<SymScope*>::iterator li;
	for( li=m_child.begin(); li!=m_child.end(); ++li )
	{
		(*li)->dump(f, nest_level+1);
	}
}