void set_code_xform_parameters( Entry e, POETCode* par) { POETCode* p = e.get_param(); if (p == 0) e.set_param(par); else { if (p != par && !match_AST(p, par, MATCH_AST_EQ)) { std::cerr << "par=" << par << "; p = " << p << "\n"; SYM_DIFF_DEFINED(par->get_className() + ":" + par->toString(OUTPUT_VAR_VAL), p->get_className() + ":" + p->toString(OUTPUT_VAR_VAL)); } return; } switch (par->get_enum()) { case SRC_LVAR: static_cast<LocalVar*>(par)->get_entry().set_code(ASTFactory::inst()->new_iconst(0)); break; case SRC_TUPLE: { POETTuple* vec = static_cast<POETTuple*>(par); for (unsigned i = 0; i < vec->size(); ++i) { LocalVar* cur_par = dynamic_cast<LocalVar*>(vec->get_entry(i)); assert (cur_par != 0); cur_par->get_entry().set_code(ASTFactory::inst()->new_iconst(i) ); } break; } default: assert(false); } }
LocalVar* POETProgram:: set_local_static(LvarSymbolTable* local, POETCode* id, LocalVarType t, POETCode* code, POETCode * restr, bool insert) { assert(local != 0); LocalVar* lvar = local->find(id); POETCode* orig = 0; if (lvar == 0) { if (insert) { lvar = local->insert(id, t); lvar->get_entry().set_code(code); lvar->get_entry().set_restr(restr); } else SYM_UNDEFINED(id->toString()+"="+code->toString()); } else if (code != 0 && (orig = lvar->get_entry().get_code()) != 0 && orig != code && !match_AST(orig, code, MATCH_AST_EQ)) { SYM_DIFF_DEFINED(id->toString()+"="+code->toString(), orig->toString()); } else { if (code != 0) lvar->get_entry().set_code(code); if (restr != 0) lvar->get_entry().set_restr(restr); } return lvar; }
extern "C" POETCode* make_localPar(POETCode* id, POETCode* restr, LocalVarType type) { try { LvarSymbolTable* local = top_scope(); assert(local != 0); LocalVar* res = local->insert(id, type); POETCode* restr1 = res->get_entry().get_restr(); if (restr != 0 && restr1 != 0 && restr != restr1 && !match_AST(restr,restr1, MATCH_AST_EQ)) { SYM_DIFF_DEFINED(id->toString() + ":" + restr->get_className() + ":" + restr->toString(),restr1->get_className() + ":" + restr1->toString()); return res; } if (restr != 0) res->get_entry().set_restr(restr); return res; } catch (Error err) { std::cerr << "\nAt line " << yylineno << " of file " << curfile->get_filename() << "\n"; exit(1); } }