// Expand Common parts of alternation classes *operation* int expand_common(char* filename) *init* (@ 1 @) *wrapper* Cd_graph *prefix* (@ cout << endl << "Expanding common parts ..." << endl; if (filename != NULL) { filebuf in_file; if (in_file.open(filename, input) != 0) cout << "sem-check: " << filename << " recreated." << endl; else in_file.close(); ofstream OutFile(filename); if (!OutFile) { cout << "sem-check: error: cannot open file " << filename << endl; return_val = 0; } else { OutFile << "// Common-expanded class dictionary." << endl << endl; } Cd_graph* cdg = (Cd_graph*)this->g_copy(); cdg->expand_common1(); cdg->g_print(OutFile); cdg->g_delete(); OutFile.close(); } @) *operation* void expand_common1() *traverse* *from* Cd_graph *to* Alternat_ns *carry* *in* Cd_graph* graph = (@ this @) *along* *from* Cd_graph *to* Alternat_ns *wrapper* Alternat_ns *prefix* (@ if (this->get_construct_ns() != NULL) { this->expand_common2(graph, this->get_construct_ns()); this->get_construct_ns()->g_delete(); this->set_construct_ns(new Any_vertex_List); } @) *operation* void expand_common2(Cd_graph* graph, Any_vertex_List* avl) *traverse* *from* Alternat_ns *through* ->Alternat_ns,alternat_ns,* *to* Term *wrapper* Term *prefix* (@ Adjacency* adjclass = graph->find_adjacency(this->get_vertex()); adjclass->expand_common3(graph, avl); @) *operation* void expand_common3(Cd_graph* graph, Any_vertex_List* avl) *traverse* *from* Adjacency *to* {Construct_ns, Alternat_ns} *wrapper* Construct_ns *prefix* (@ this->get_construct_ns()-> concatenate((Any_vertex_List*)avl->g_copy()); @) *wrapper* Alternat_ns *prefix* (@ this->expand_common2(graph, avl); @)