#include "semcheck.h" Adjacency_List *Term::compute_associted(Adjacency_Nlist* adjs) { Adjacency_List*r = NULL; Adjacency_list_iterator next(*adjs); Adjacency* each; while (each = next()) if (each->get_source()->g_equal(this->get_vertex())) break; if (each) each->compute_associted(adjs,r); else { char* n = this->get_vertex()->get_vertex_name()->get_val(); if (!(strcmp(n,"DemString") && strcmp(n,"DemNumber") && strcmp(n,"DemReal") && strcmp(n,"DemIdent") && strcmp(n,"DemText"))) return r; cerr << toolname << ": error: undefined class '"; this->get_vertex()->pp(cerr); this->get_moduleRef()->pp(cerr); cout << "' on line " << this->get_vertex()->get_vertex_name()->get_line_number() << endl; exit(-1); } return r; } void Adjacency::compute_associted(Adjacency_Nlist* adjs, Adjacency_List*& r) { if (this->get_associated()) { if (r == NULL) r = this->get_associated(); else { Adjacency_list_iterator next1(*this->get_associated()); Adjacency* each1; while (each1 = next1()) { Adjacency_list_iterator next2(*r); Adjacency* each2; while (each2 = next2()) if (each2->get_source()->g_equal(each1->get_source())) break; if (each2 == NULL) r->append(each1); } } } else { Adjacency_List* lr = new Adjacency_List(); ns->compute_associted(adjs, lr, this); this->set_associated(lr); if (r == NULL) r = new Adjacency_List(); Adjacency_list_iterator next1(*lr); Adjacency* each1; while (each1 = next1()) { Adjacency_list_iterator next2(*r); Adjacency* each2; while (each2 = next2()) if (each2->get_source()->g_equal(each1->get_source())) break; if (each2 == NULL) r->append(each1); } } } void Neighbors::compute_associted(Adjacency_Nlist *adjs, Adjacency_List*r, Adjacency* adj) { } void Repetit_n::compute_associted(Adjacency_Nlist *adjs, Adjacency_List*r, Adjacency* adj) { } void Neighbors_wc::compute_associted(Adjacency_Nlist *adjs, Adjacency_List*r, Adjacency* adj) { } void Construct_ns::compute_associted(Adjacency_Nlist* adjs,Adjacency_List* r, Adjacency* adj) { Adjacency_list_iterator next(*r); Adjacency* each; while (each = next()) if (each->get_source()->g_equal(adj->get_source())) break; if (each == NULL) r->append(adj); } void Alternat_ns::compute_associted(Adjacency_Nlist* adjs, Adjacency_List* r, Adjacency* adj) { alternat_ns->compute_associted(adjs, r); } void Term_Bar_list::compute_associted(Adjacency_Nlist* adjs, Adjacency_List* r) { Term_list_iterator next(*this); Term* each; while (each = next()) each->compute_associted(adjs, r); } void Term::compute_associted(Adjacency_Nlist* adjs, Adjacency_List* r) { Adjacency_list_iterator next(*adjs); Adjacency* each; while (each = next()) if (each->get_source()->g_equal(this->get_vertex())) break; if (each) each->compute_associted(adjs, r); else { char* n = this->get_vertex()->get_vertex_name()->get_val(); if (!(strcmp(n,"DemString") && strcmp(n,"DemNumber") && strcmp(n,"DemReal") && strcmp(n,"DemIdent") && strcmp(n,"DemText"))) return; cerr << toolname << ": error: undefined class: '"; this->get_vertex()->pp(cerr); cerr << "' on line " << this->get_vertex()->get_vertex_name()->get_line_number() << "\n" << endl; exit(-1); } }