Esempio n. 1
0
void EventEntry::print(ostream& out, int indent) const{
	if(name()!="any"){
		for(int i=0;i<indent;++i){
			out << "\t";
		}
		out << "event "<< name() << "(";
		const SymTab* st = this->symTab();
		if(st!=NULL){
			for(SymTab::const_iterator i = st->begin(); i != st->end();){
				if((*i)->kind()==SymTabEntry::Kind::VARIABLE_KIND){
					VariableEntry* ve = (VariableEntry*) (*i);
					if(ve->varKind()==VariableEntry::VarKind::PARAM_VAR){
						out << ve->type()->fullName()<<" "<<ve->name();
						out << "(offset = " << ve->offSet() << ")";
					}
				}
				++i;
				if(i != st->end()){
					out << ", ";
				}
			}
		}
		out << ");"<<endl;
	}
}
Esempio n. 2
0
void FunctionEntry::print(ostream& out, int indent) const{
	for(int i=0;i<indent;++i){
		out << "\t";
	}
	out << type()->retType()->name() << " " << name() << "(";
	const SymTab* st = this->symTab();
	bool p_var = true;
	if(st!=NULL){
		for(SymTab::const_iterator i = st->begin(); i != st->end(); ++i){
			if((*i)->kind()==SymTabEntry::Kind::VARIABLE_KIND){
				VariableEntry* ve = (VariableEntry*) (*i);
				if(ve->varKind()==VariableEntry::VarKind::PARAM_VAR && p_var){
					if(i != st->begin()){
						out << ", ";
					}
					out << ve->type()->fullName()<<" "<<ve->name();
					out << "(offset = " << ve->offSet() << ")";
				} else {
					if(p_var){
						out << ")(return_label = " << returnLabel() << ", return_address = " << returnOffset() << ", control_link = " << controlLink() << ") {" << endl;
						p_var = false;
					}
					ve->print(out,indent+1);
				}
			}
		}
	}
	if(p_var){
		out << ")(return_address = " << returnOffset() << ", control_link = " << controlLink() << ")";
	}
	if(body()!=NULL){
		if(p_var){
			out<<" {" << endl;
		}
		body()->printWithoutBraces(out,indent);
		for(int i=0;i<indent-1;++i){
			out << "\t";
		}
		out << "}";
	}
	out<< ";" << endl;
}