vhdlpp: Added Subprogram::write_to_stream_body() method.
This commit is contained in:
parent
5b7b980ead
commit
5349ca9a55
|
|
@ -308,3 +308,39 @@ void Subprogram::write_to_stream(ostream&fd) const
|
|||
return_type_->write_to_stream(fd);
|
||||
fd << ";" << endl;
|
||||
}
|
||||
|
||||
void Subprogram::write_to_stream_body(ostream&fd) const
|
||||
{
|
||||
fd << "function " << name_ << "(";
|
||||
if (ports_ && ! ports_->empty()) {
|
||||
list<InterfacePort*>::const_iterator cur = ports_->begin();
|
||||
InterfacePort*curp = *cur;
|
||||
fd << curp->name << " : ";
|
||||
curp->type->write_to_stream(fd);
|
||||
for (++cur ; cur != ports_->end() ; ++cur) {
|
||||
curp = *cur;
|
||||
fd << "; " << curp->name << " : ";
|
||||
curp->type->write_to_stream(fd);
|
||||
}
|
||||
}
|
||||
fd << ") return ";
|
||||
return_type_->write_to_stream(fd);
|
||||
fd << " is" << endl;
|
||||
|
||||
for (map<perm_string,Variable*>::const_iterator cur = new_variables_.begin()
|
||||
; cur != new_variables_.end() ; ++cur) {
|
||||
cur->second->write_to_stream(fd);
|
||||
}
|
||||
|
||||
fd << "begin" << endl;
|
||||
|
||||
if (statements_) {
|
||||
for (list<SequentialStmt*>::const_iterator cur = statements_->begin()
|
||||
; cur != statements_->end() ; ++cur) {
|
||||
(*cur)->write_to_stream(fd);
|
||||
}
|
||||
} else {
|
||||
fd << "--empty body" << endl;
|
||||
}
|
||||
fd << "end function;" << endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ class Subprogram : public LineInfo, public ScopeBase {
|
|||
int emit_package(std::ostream&fd) const;
|
||||
|
||||
void write_to_stream(std::ostream&fd) const;
|
||||
void write_to_stream_body(std::ostream&fd) const;
|
||||
void dump(std::ostream&fd) const;
|
||||
|
||||
// Creates a new instance of the function that takes arguments of
|
||||
|
|
|
|||
Loading…
Reference in New Issue