void SymTab::typePrintST(ostream& os, int indent, char leftdelim, char rightdelim, bool linebreak, int first, int last) const { int i; SymTab::const_iterator it = begin(); int n_printed=0; //os << "printST(" << indent << ")"; if ((first == 0) && (last == 0)) last = 1000000; for (i=0; (it != end()) && (i < last); i++, ++it) { SymTabEntry *ste = (SymTabEntry *)(*it); if (i >= first) { if ((ste->kind() != SymTabEntry::RULE_BLOCK_KIND) && (ste->kind() != SymTabEntry::EVENT_BLOCK_KIND) && (ste->name() != "state") && (ste->name() != "other") && (ste->name() != "any")) { n_printed++; } } } if (leftdelim != '\0') { os << leftdelim; if ((n_printed > 0) && (linebreak)) prtln(os, indent+STEP_INDENT); } for (i=0, it=begin(); (it != end()) && (i < last); i++, ++it) { SymTabEntry *ste = (SymTabEntry *)(*it); if (i >= first) { if ((ste->kind() != SymTabEntry::RULE_BLOCK_KIND) && (ste->kind() != SymTabEntry::EVENT_BLOCK_KIND) && (ste->name() != "state") && (ste->name() != "other") && (ste->name() != "any")) { ste->typePrint(os,indent+STEP_INDENT); if ((leftdelim == '\0') && (rightdelim != '\0')) os << rightdelim; if (--n_printed > 0) { if (linebreak) prtln(os,indent+STEP_INDENT); else os << ", "; } else if (linebreak) prtln(os,indent); } } } if (leftdelim != '\0') // This is not a typo -- we shd check leftdelim os << rightdelim; //if (linebreak) //prtln(os, indent); }
void Session::insertIn(SymTabEntry& ste, const char *val) { int i = ste.index(); assert (ste.kind() == INPUT_PARAM_KIND); while (i > inval_.size()) inval_.push_back(NULL); if (i == inval_.size()) inval_.push_back(val); else { if (inval_[i] != NULL) { cout << "WARNING: Updating input sym: " << &ste; cout << " OLD VAL=" << inval_[i] << " NEW VAL=" << val << endl; } inval_[i] = val; } }
void FunctionEntry::print(ostream& out, int indent) const { out << type()->fullName() << " " << name(); out << "("; int i = 0; const SymTab *st = symTab(); if(st!=NULL) { SymTab::const_iterator it = st->begin(); for (i=0; (it != st->end()); i++, ++it) { SymTabEntry *ste = (SymTabEntry *)(*it); if(ste->kind() == SymTabEntry::Kind::VARIABLE_KIND) { VariableEntry *ve = (VariableEntry *)ste; if(ve->varKind() != VariableEntry::VarKind::PARAM_VAR) { break; } } } } if(i!=0) { printST(out, indent,'\0', '\0', false, 0, i); } out << ")"; if((st != NULL && i < st->size()) || body()) { out << " {"; if(st != NULL && i < st->size()) printST(out, indent,'\0', ';',true, i, st->size()); if(body()) body()->printWithoutBraces(out, indent); out << "}"; } }