#include "pp.h" // Carry_or_wrapper : Sig_ext_prim | // Code_fragment // *common* . void Carry_or_wrapper::noEdgesForCodeFrag( ) { DEM_TRACE("Carry_or_wrapper","void Carry_or_wrapper::noEdgesForCodeFrag()"); #ifndef NOTRACE DemTrace demTraceEmptyMethod(__FILE__,__LINE__,"Carry_or_wrapper",form(" at %s , *** PREMATURELY TERMINATED *** ", this->get_type())); #endif } // Code_fragment = + // "*wrapper*" // Vertices_edges // *l // [ Prefix ] // [ CppCode ] // [ CppCode ] // -. void Code_fragment::noEdgesForCodeFrag( ) { DEM_TRACE("Code_fragment","void Code_fragment::noEdgesForCodeFrag()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls // construction edge prefix wrappers this->get_vertices_edges()->noEdgesForCodeFrag( ); // construction edge suffix wrappers // suffix class wrappers // assignments for carrying out } // Vertices_edges : Require_vertex_selector | // Require_meta_edges // *common* . void Vertices_edges::noEdgesForCodeFrag( ) { DEM_TRACE("Vertices_edges","void Vertices_edges::noEdgesForCodeFrag()"); #ifndef NOTRACE DemTrace demTraceEmptyMethod(__FILE__,__LINE__,"Vertices_edges",form(" at %s , *** PREMATURELY TERMINATED *** ", this->get_type())); #endif } // Require_vertex_selector = Vertex_selector // [ Meta_edges ] . void Require_vertex_selector::noEdgesForCodeFrag( ) { DEM_TRACE("Require_vertex_selector","void Require_vertex_selector::noEdgesForCodeFrag()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls if ( this->get_edges() != NULL ) { // construction edge prefix wrappers this->get_edges()->noEdgesForCodeFrag( ); // construction edge prefix wrappers } // suffix class wrappers // assignments for carrying out } // Require_meta_edges = Meta_edges // [ Vertex_selector ] . void Require_meta_edges::noEdgesForCodeFrag( ) { DEM_TRACE("Require_meta_edges","void Require_meta_edges::noEdgesForCodeFrag()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls // construction edge prefix wrappers this->get_edges()->noEdgesForCodeFrag( ); // construction edge suffix wrappers // suffix class wrappers // assignments for carrying out } // Meta_edges = Meta_edge_Commalist . void Meta_edges::noEdgesForCodeFrag( ) { DEM_TRACE("Meta_edges","void Meta_edges::noEdgesForCodeFrag()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers cout << toolname << ": error: code fragments cannot be attached to edges without" << " traversal specification" << endl; exit(-1); // outgoing calls // suffix class wrappers // assignments for carrying out } // Carry_or_wrapper_List ~ { Carry_or_wrapper }. . void Carry_or_wrapper_List::noEdgesForCodeFrag( ) { DEM_TRACE("Carry_or_wrapper_List","void Carry_or_wrapper_List::noEdgesForCodeFrag()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls Carry_or_wrapper_list_iterator next_Carry_or_wrapper(*this); Carry_or_wrapper* each_Carry_or_wrapper; while ( each_Carry_or_wrapper = next_Carry_or_wrapper() ) { // repetition edge prefix wrappers each_Carry_or_wrapper->noEdgesForCodeFrag( ); // repetition edge suffix wrappers } // suffix class wrappers // assignments for carrying out } void Carry_or_wrapper_List::genSimpleMethod( Header* hdr,const char* tmp_cppfname,Cd_graph* schema ) { DEM_TRACE("Carry_or_wrapper_List","void Carry_or_wrapper_List::genSimpleMethod(Header* hdr,const char* tmp_cppfname,Cd_graph* schema)"); // prefix class wrappers ofstream strm(tmp_cppfname,ios::app); if (!strm) { cout << toolname << ": unable to open " << tmp_cppfname << endl; perror(tmp_cppfname); exit(-1); } Vertex_List* vlist = new Vertex_List(); Carry_or_wrapper_list_iterator next(*this); Carry_or_wrapper* each; while (each = next()) each->collectVertices(vlist); Vertex_list_iterator nextv(*vlist); Vertex* eachv; while (eachv = nextv()) { int r = 1; hdr->isAFunc(r); if (r) { hdr->printhdr(strm,eachv); strm << "\n this->"; // generate signature hdr->printRetHdr(strm); strm << " return return_val;\n"; strm << "}\n"; } // generate signature hdr->printExtHdr(r ,strm , eachv ,NULL); strm << " // prefix class wrappers\n"; this->printClassPrefix(strm,eachv,NULL,schema); strm << "\n"; strm << " // suffix class wrappers\n"; this->printClassSuffix(strm,eachv,NULL,schema); strm << "\n"; strm << "}\n\n"; } strm.close(); delete vlist; // suffix class wrappers } void Carry_or_wrapper_List::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Carry_or_wrapper_List","void Carry_or_wrapper_List::collectVertices(Vertex_List* vlist)"); // prefix class wrappers Carry_or_wrapper_list_iterator next(*this); Carry_or_wrapper* each; while (each = next()) each->collectVertices(vlist); // suffix class wrappers } void Carry_or_wrapper::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Carry_or_wrapper","void Carry_or_wrapper::collectVertices(Vertex_List* vlist)"); // prefix class wrappers // suffix class wrappers } void Code_fragment::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Code_fragment","void Code_fragment::collectVertices(Vertex_List* vlist)"); // prefix class wrappers vertices_edges->collectVertices(vlist); // suffix class wrappers } void Vertices_edges::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Vertices_edges","void Vertices_edges::collectVertices(Vertex_List* vlist)"); // prefix class wrappers // suffix class wrappers } void Require_vertex_selector::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Require_vertex_selector","void Require_vertex_selector::collectVertices(Vertex_List* vlist)"); // prefix class wrappers vertices->collectVertices(vlist); // suffix class wrappers } void Require_meta_edges::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Require_meta_edges","void Require_meta_edges::collectVertices(Vertex_List* vlist)"); // prefix class wrappers if (vertices) vertices->collectVertices(vlist); // suffix class wrappers } void Vertex_selector::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Vertex_selector","void Vertex_selector::collectVertices(Vertex_List* vlist)"); // prefix class wrappers derror('i',1," unexpected visit at Vertex_selector::collectVertices\n"); abort(); // suffix class wrappers } void Any_term::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Any_term","void Any_term::collectVertices(Vertex_List* vlist)"); // prefix class wrappers derror('i',1," unexpected visit at Vertex_selector::collectVertices\n"); abort(); // suffix class wrappers } void Fixed_term::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Fixed_term","void Fixed_term::collectVertices(Vertex_List* vlist)"); // prefix class wrappers derror('i',1," unexpected visit at Vertex_selector::collectVertices\n"); abort(); // suffix class wrappers } void Vertex_set::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Vertex_set","void Vertex_set::collectVertices(Vertex_List* vlist)"); // prefix class wrappers derror('i',1," unexpected visit at Vertex_selector::collectVertices\n"); abort(); // suffix class wrappers } void Vertex_set_sim::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Vertex_set_sim","void Vertex_set_sim::collectVertices(Vertex_List* vlist)"); // prefix class wrappers terms->collectVertices(vlist); // suffix class wrappers } void Fixed_term_Commalist::collectVertices( Vertex_List* vlist ) { DEM_TRACE("Fixed_term_Commalist","void Fixed_term_Commalist::collectVertices(Vertex_List* vlist)"); // prefix class wrappers Fixed_term_list_iterator next(*this); Fixed_term* each; while (each = next()) { Vertex_list_iterator next2(*vlist); Vertex* each2; while (each2 = next2()) if (each2->get_vertex_name()-> g_equal(each->get_vertex()->get_vertex()->get_vertex_name())) break; if (each2 == NULL) vlist->append(each->get_vertex()->get_vertex()); } // suffix class wrappers } // Header = Signature // [ Vertex_selector ] . void Header::isAFunc( int& r ) { DEM_TRACE("Header","void Header::isAFunc(int& r)"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls // construction edge prefix wrappers this->get_signature()->isAFunc( r ); // construction edge suffix wrappers // suffix class wrappers // assignments for carrying out } // Signature = *l // "*operation*" // Type_spec // Op_name // "(" // [ Param_decl_Commalist ] // ")" // [ Const ] // [ CppCode ] // *l. void Signature::isAFunc( int& r ) { DEM_TRACE("Signature","void Signature::isAFunc(int& r)"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls // construction edge prefix wrappers this->get_type_spec()->isAFunc( r ); // construction edge suffix wrappers // suffix class wrappers // assignments for carrying out } // Type_spec : Void | // Nonvoid_type_spec // *common* . void Type_spec::isAFunc( int& r ) { DEM_TRACE("Type_spec","void Type_spec::isAFunc(int& r)"); #ifndef NOTRACE DemTrace demTraceEmptyMethod(__FILE__,__LINE__,"Type_spec",form(" at %s , *** PREMATURELY TERMINATED *** ", this->get_type())); #endif } // Void = "void" . void Void::isAFunc( int& r ) { DEM_TRACE("Void","void Void::isAFunc(int& r)"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers r = 0; // outgoing calls // suffix class wrappers // assignments for carrying out } void CppCode::printCode( ofstream& strm ) { DEM_TRACE("CppCode","void CppCode::printCode(ofstream& strm)"); // prefix class wrappers strm << code->get_val(); // suffix class wrappers } void Header::printhdr( ofstream& strm,Vertex* owner ) { DEM_TRACE("Header","void Header::printhdr(ofstream& strm,Vertex* owner)"); // prefix class wrappers this->get_signature()->printhdr(strm,owner); // suffix class wrappers } void Signature::printhdr( ofstream& strm,Vertex* owner ) { DEM_TRACE("Signature","void Signature::printhdr(ofstream& strm,Vertex* owner)"); // prefix class wrappers int r = 1; //////////////////////////// // print default arglist //////////////////////////// r = 0; if (this->get_parameter_decls()) this->get_parameter_decls()->hasDefaultArgs(r); if (r) this->get_parameter_decls()->printDefaultArgs(0,strm); ///////////////////////// // print signature ///////////////////////// this->get_type_spec()->printType(strm); strm << " "; owner->printVertex(strm); strm << "::"; strm << this->get_name()->get_op_name()->get_val(); strm << "( "; if (this->get_parameter_decls()) this->get_parameter_decls()->printArgs(strm); strm << " )"; if (this->get_const_qualifier()) strm << " const\n"; else strm << "\n"; strm << "{\n "; /////////////////////////// // generate traces /////////////////////////// strm << "DEM_TRACE(\""; owner->printVertex(strm); strm << "\",\""; this->get_type_spec()->printType(strm); strm << " "; owner->printVertex(strm); strm << "::"; strm << this->get_name()->get_op_name()->get_val(); strm << "("; if (this->get_parameter_decls()) this->get_parameter_decls()->printArgs(strm); strm << ")"; if (this->get_const_qualifier()) strm << " const"; strm << "\");\n"; /////////////////////////// // generate var for func /////////////////////////// r = 1; this->isAFunc(r); if (r) { strm << " "; this->get_type_spec()->printType(strm); strm << " return_val"; if (this->get_init()) strm << " = " << this->get_init()->get_code()->get_val(); strm << ";\n"; } else if (this->get_init()) { cout << toolname << ": '*init* " << this->get_init()->get_code()->get_val() << "' ignored" << endl; } // suffix class wrappers } void Type_spec::printType( ofstream& strm ) { DEM_TRACE("Type_spec","void Type_spec::printType(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void Void::printType( ofstream& strm ) { DEM_TRACE("Void","void Void::printType(ofstream& strm)"); // prefix class wrappers strm << "void "; // suffix class wrappers } void Nonvoid_type_spec::printType( ofstream& strm ) { DEM_TRACE("Nonvoid_type_spec","void Nonvoid_type_spec::printType(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void Type_without_attribute::printType( ofstream& strm ) { DEM_TRACE("Type_without_attribute","void Type_without_attribute::printType(ofstream& strm)"); // prefix class wrappers param_type->printType(strm); // suffix class wrappers } void Type_with_attribute::printType( ofstream& strm ) { DEM_TRACE("Type_with_attribute","void Type_with_attribute::printType(ofstream& strm)"); // prefix class wrappers param_type->printType(strm); param_attribute->printType(strm); // suffix class wrappers } void Param_attribute::printType( ofstream& strm ) { DEM_TRACE("Param_attribute","void Param_attribute::printType(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void In::printType( ofstream& strm ) { DEM_TRACE("In","void In::printType(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void Out::printType( ofstream& strm ) { DEM_TRACE("Out","void Out::printType(ofstream& strm)"); // prefix class wrappers strm << "& "; // suffix class wrappers } void Inout::printType( ofstream& strm ) { DEM_TRACE("Inout","void Inout::printType(ofstream& strm)"); // prefix class wrappers strm << "& "; // suffix class wrappers } void Type::printType( ofstream& strm ) { DEM_TRACE("Type","void Type::printType(ofstream& strm)"); // prefix class wrappers if (type_qualifier) type_qualifier->printType(strm); type_name->printVertex(strm); refs->printType(strm); // suffix class wrappers } void Type_qualifier::printType( ofstream& strm ) { DEM_TRACE("Type_qualifier","void Type_qualifier::printType(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void Const::printType( ofstream& strm ) { DEM_TRACE("Const","void Const::printType(ofstream& strm)"); // prefix class wrappers strm << "const "; // suffix class wrappers } void Struct::printType( ofstream& strm ) { DEM_TRACE("Struct","void Struct::printType(ofstream& strm)"); // prefix class wrappers strm << "struct "; // suffix class wrappers } void Ref_Ptr_List::printType( ofstream& strm ) { DEM_TRACE("Ref_Ptr_List","void Ref_Ptr_List::printType(ofstream& strm)"); // prefix class wrappers Ref_Ptr_list_iterator next(*this); Ref_Ptr *each; while (each = next()) each->printType(strm); // suffix class wrappers } void Ref_Ptr::printType( ofstream& strm ) { DEM_TRACE("Ref_Ptr","void Ref_Ptr::printType(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void Ref::printType( ofstream& strm ) { DEM_TRACE("Ref","void Ref::printType(ofstream& strm)"); // prefix class wrappers strm << "& "; // suffix class wrappers } void Ptr::printType( ofstream& strm ) { DEM_TRACE("Ptr","void Ptr::printType(ofstream& strm)"); // prefix class wrappers strm << "* "; // suffix class wrappers } void Term::printVertex( ofstream& strm ) { DEM_TRACE("Term","void Term::printVertex(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void CppTerm::printVertex( ofstream& strm ) { DEM_TRACE("CppTerm","void CppTerm::printVertex(ofstream& strm)"); // prefix class wrappers strm << "$"; this->get_vertex()->printVertex(strm); this->get_moduleRef()->printVertex(strm); // suffix class wrappers } void Normal::printVertex( ofstream& strm ) { DEM_TRACE("Normal","void Normal::printVertex(ofstream& strm)"); // prefix class wrappers this->get_vertex()->printVertex(strm); this->get_moduleRef()->printVertex(strm); // suffix class wrappers } void Vertex::printVertex( ofstream& strm ) { DEM_TRACE("Vertex","void Vertex::printVertex(ofstream& strm)"); // prefix class wrappers strm << vertex_name->get_val(); // suffix class wrappers } void TermRef::printVertex( ofstream& strm ) { DEM_TRACE("TermRef","void TermRef::printVertex(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void LocalRef::printVertex( ofstream& strm ) { DEM_TRACE("LocalRef","void LocalRef::printVertex(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void ModuleRef::printVertex( ofstream& strm ) { DEM_TRACE("ModuleRef","void ModuleRef::printVertex(ofstream& strm)"); // prefix class wrappers // suffix class wrappers } void CompRef::printVertex( ofstream& strm ) { DEM_TRACE("CompRef","void CompRef::printVertex(ofstream& strm)"); // prefix class wrappers strm << "@"; strm << this->get_moduleName()->get_val(); // suffix class wrappers } void LibRef::printVertex( ofstream& strm ) { DEM_TRACE("LibRef","void LibRef::printVertex(ofstream& strm)"); // prefix class wrappers strm << "@@"; strm << this->get_moduleName()->get_val(); // suffix class wrappers } void Param_decl_Commalist::printArgs( ofstream& strm ) { DEM_TRACE("Param_decl_Commalist","void Param_decl_Commalist::printArgs(ofstream& strm)"); // prefix class wrappers Param_decl_list_iterator next(*this); Param_decl *each; each = next(); if (each) { each->get_param_type_spec()->printType(strm); strm << " " << each->get_param_name()->get_name()->get_val(); } while (each = next()) { strm << ","; each->get_param_type_spec()->printType(strm); strm << " " << each->get_param_name()->get_name()->get_val(); } // suffix class wrappers } void Param_decl_Commalist::hasDefaultArgs( int& r ) { DEM_TRACE("Param_decl_Commalist","void Param_decl_Commalist::hasDefaultArgs(int& r)"); // prefix class wrappers Param_decl_list_iterator next(*this); Param_decl *each; while (each = next()) if (each->get_default_val()) { r = 1; return; } // suffix class wrappers } void Param_decl_Commalist::printDefaultArgs( int isFunc,ofstream& strm ) { DEM_TRACE("Param_decl_Commalist","void Param_decl_Commalist::printDefaultArgs(int isFunc,ofstream& strm)"); // prefix class wrappers strm << "//++ defaults ( "; if (isFunc) strm << ", "; Param_decl_list_iterator next(*this); Param_decl *each; each = next(); if (each) { if (each->get_default_val()) strm << each->get_default_val()->get_code()->get_val(); } while (each = next()) { strm << " , "; if (each->get_default_val()) strm << each->get_default_val()->get_code()->get_val(); } strm << " )\n"; // suffix class wrappers }