///////////////////////////////////////////////////////////////// // Rename a propagation pattern for a given propaagation pattern ///////////////////////////////////////////////////////////////// *operation* void do_rename(Propagation_pattern *pp_obj) *traverse* *from* Rename_input *to* Rename *wrapper* Rename *prefix* (@ if (this->get_renaming()->list_length() == 0) return; this->check_legal(); if (pp_obj->get_meta_def() != NULL) pp_obj->get_meta_def()->do_rename(this); pp_obj->get_header()->rename_header(this); pp_obj->get_impl_or_loc()->rename_impl(this); @) *operation* void do_rename(Meta_def_input *meta_obj) *traverse* *from* Rename_input *to* Rename *wrapper* Rename *prefix* (@ if (this->get_renaming()->list_length() == 0) return; this->check_legal(); Meta_def_list_iterator next(*meta_obj->get_metas()); Meta_def * each; while (each = next()) each->do_rename(this); @) *operation* void do_rename(Rename *ren) *traverse* *from* Meta_def *to* Meta_macro_def *wrapper* Meta_macro_def *prefix* (@ if (this->get_classes() != NULL) { Term_Commalist * nc = new Term_Commalist(); this->get_classes()->ren_classes(ren,nc); this->rset_classes(nc)->g_delete(); } if (this->get_relations() != NULL) { // Meta_edge_Commalist *nr = new Meta_edge_Commalist(); // this->get_relations()->ren_relations(ren,nr); // this->rset_relations(nr)->g_delete(); this->get_relations()->ren_pde(ren); } if (this->get_class_sets() != NULL) { Class_set_def_Amplist *ns = new Class_set_def_Amplist(); this->get_class_sets()->ren_class_sets(ren,ns); this->rset_class_sets(ns)->g_delete(); } if (this->get_dirs() != NULL) { Dir_meta_def_Amplist *nd = new Dir_meta_def_Amplist(); this->get_dirs()->ren_dirs(ren,nd); this->rset_dirs(nd)->g_delete(); } /* not implemented if (this->get_macros() != NULL) this->get_macros()->ren_dirs(ren); */ @) *operation* void check_legal() *wrapper* Rename *prefix* (@ Each_renaming_list_iterator next1(*this->get_renaming()); Each_renaming * each1; while (each1 = next1()) { if (strcmp(each1->get_old_name()->get_type(),each1->get_new_name()->get_type())) { each1->get_old_name()->g_print(cout); cout << " => "; each1->get_new_name()->g_print(cout); cout << endl; derror('e',1," illegal renaming.\n"); exit(-1); } int i = 0; Each_renaming_list_iterator next2(*this->get_renaming()); Each_renaming * each2; while (each2 = next2()) if (each2->get_old_name()->g_equal(each1->get_old_name())) i++; if (i > 1) { cout << "\n"; this->g_print(cout); cout << endl; derror('e',1," error : there are two renamings for the same symbol.\n"); exit(-1); } } @) *operation* void get_relation_name(DemIdent *&n) *traverse* *from* Name_inst *to* {CppTerm, Normal} *wrapper* Normal *prefix* (@ static LocalRef * chck = new LocalRef(); if (this->get_moduleRef()->g_equal(chck)) n = this->get_vertex()->get_vertex_name(); else n = NULL; @) *wrapper* CppTerm *prefix* (@ derror('e',1," there should be no C++ type (with $) in the renaming. '"); this->pp(cout); cout << "' on line " << this->get_vertex()->get_vertex_name()->get_line_number() << endl; exit(-1); @)