// // $Log: genMethod.pp,v $ // Revision 5.5.1.1 1994/08/24 19:32:06 demeter // *** empty log message *** // // Revision 5.5 1994/08/24 19:32:05 demeter // *** empty log message *** // // Revision 5.4.1.5 1994/03/25 21:01:22 demeter // *** empty log message *** // // Revision 5.4.1.4 1994/02/28 15:56:44 demeter // update generated comments // // Revision 5.4.1.3 1994/02/24 20:54:06 demeter // *** empty log message *** // // Revision 5.4.1.2 1994/02/22 14:45:46 demeter // update according to the new semantics // // Revision 5.4.1.1 1994/02/20 19:53:09 demeter // *** empty log message *** // // Revision 5.4 1994/02/20 19:53:08 demeter // *** empty log message *** // // Revision 5.3.1.1 1994/01/26 20:07:47 demeter // *** empty log message *** // // Revision 5.3 1994/01/26 20:07:46 demeter // *** empty log message *** // // Revision 5.2.1.1 1994/01/25 17:25:16 demeter // *** empty log message *** // // Revision 5.2 1994/01/25 17:25:15 demeter // *** empty log message *** // // Revision 5.1.1.3 1993/11/30 22:21:10 demeter // trans algorithm fixed. // // Revision 5.1.1.2 1993/11/18 20:46:36 demeter // change signature extension strategy // // *operation* void genMethod(Cd_graph* schema, Header* hdr, const char* tmp_cppfname, Propagation_schema* ps) *wrapper* Implementation *prefix* (@ ps->get_paths()->genMethod(ps, schema, hdr, tmp_cppfname, ps->get_source_port(), carry_or_wrapper); @) *operation* void genMethod(Propagation_schema *ps, Cd_graph* schema, Header* hdr, const char* tmp_cppfname, Vertex_selector* source_port, Carry_or_wrapper_List* frags) *wrapper* Cd_graph *prefix* (@ ofstream tmp_cpptarget(tmp_cppfname,ios::app); if (!tmp_cpptarget) { cout << toolname << ": unable to open " << tmp_cppfname << endl; perror(tmp_cppfname); exit(-1); } adjacencies->genMethod(ps, schema->get_adjacencies(), schema, hdr, tmp_cpptarget, source_port, frags); //adjacencies->genMethod(ps, schema->get_adjacencies(), this, hdr, tmp_cpptarget, source_port, frags); tmp_cpptarget.close(); @) *operation* void genMethod(Propagation_schema *ps, Adjacency_Nlist* adjs, Cd_graph* schema, Header* hdr, ofstream& strm, Vertex_selector* source_port, Carry_or_wrapper_List* frags) *wrapper* Adjacency_Nlist *prefix* (@ Adjacency_list_iterator next(*this); Adjacency* each; while (each = next()) { Adjacency_list_iterator next2(*adjs); Adjacency* each2; while (each2 = next2()) if (each2->get_source()->get_vertex_name() ->g_equal(each->get_source()->get_vertex_name())) break; each->genMethod(ps, adjs, each2, schema, hdr, strm, source_port, frags); } @) *operation* void genMethod(Propagation_schema *ps, Adjacency_Nlist* adjs, Adjacency* adj, Cd_graph* schema, Header* hdr, ofstream& strm, Vertex_selector* source_port, Carry_or_wrapper_List* frags) *wrapper* Adjacency *prefix* (@ if (ps->isTarget(this->get_source()) || schema->isConstructRepetit(this->get_source())) { Adjacency_List* considered = new Adjacency_List(); schema->collectDelayBindForTrans(schema, ps, considered, this); considered->printDelayBindForTrans(schema,ps,this,frags,hdr,strm); delete considered; } Adjacency_list_iterator next(*schema->get_adjacencies()); Adjacency* each; while (each = next()) if (each->get_source()->equal(this->get_source())) break; assert(each); each->cd_pp(strm); int r = 1; hdr->isAFunc(r); // generate signature hdr->printExtHdr(r ,strm ,source ,inarguments); // checking it is a propagation class int targetAssociated = 0; ps->get_target_port()->alternationReachable(schema,source,targetAssociated); if (targetAssociated || schema->isConstructRepetit(this->get_source())) { // carry out variable defs strm << " // variables for carrying in and out\n"; if (outarguments) { outarguments->genCarryVarDefs(strm); } strm << "\n"; // carry in assignments strm << " // assignments for carrying in\n"; // reach out to superclasses schema->genSuperCarryPrefixAssign( schema, source, ps, strm, inarguments, outarguments); if (param_assignments) { param_assignments->genCarryPrefixAssign( source, strm, inarguments, outarguments); } strm << "\n"; //generate function calls strm << " // prefix class wrappers\n"; frags->printClassPrefix(strm,source,ps,schema); strm << "\n"; } else strm << "#ifndef NOTRACE\n DemTrace demTraceEmptyMethod(__FILE__,__LINE__,\"" << source->get_vertex_name()->get_val() << "\",form(\" at %s , *** PREMATURELY TERMINATED *** \", this->get_type()));\n#endif\n"; if (schema->isConstructRepetit(this->get_source())) { // outgoing calls strm << " // outgoing calls\n"; ns->printCalls(schema, source, hdr, strm, frags, inarguments); if (superclasses) superclasses->printSuperCalls(schema, source, hdr, strm, frags, ps); } strm << "\n"; // checking it is a propagation class if (targetAssociated || schema->isConstructRepetit(this->get_source())) { strm << " // suffix class wrappers\n"; frags->printClassSuffix(strm,source,ps,schema); strm << "\n"; // carry out assignments strm << " // assignments for carrying out\n"; // reach out to superclasses schema->genSuperCarrySuffixAssign( schema, source, ps, strm, inarguments, outarguments); if (param_assignments) { param_assignments->genCarrySuffixAssign(source, strm, inarguments, outarguments); } } strm << "}\n\n"; @) *operation* void printExtHdr(int isFunc, ofstream &strm, Vertex* owner, Param_decl_Commalist* inargs) *wrapper* Header *prefix* (@ this->get_signature()->printExtHdr(isFunc, strm, owner, inargs); @) *wrapper* Signature *prefix* (@ int r; //////////////////////////// // print default arglist //////////////////////////// r = 0; if (this->get_parameter_decls()) this->get_parameter_decls()->hasDefaultArgs(r); if (r) this->get_parameter_decls()->printDefaultArgs(isFunc,strm); ///////////////////////// // print signature ///////////////////////// strm << "void "; owner->printVertex(strm); strm << "::"; strm << this->get_name()->get_op_name()->get_val(); if (isFunc) { strm << "_( "; this->get_type_spec()->printType(strm); strm << "& return_val"; if (inargs || this->get_parameter_decls()) strm << ", "; } else strm << "( "; if (this->get_parameter_decls()) this->get_parameter_decls()->printArgs(strm); if (inargs) { if (this->get_parameter_decls()) strm << ", "; inargs->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 << "\",\""; strm << "void "; owner->printVertex(strm); strm << "::"; strm << this->get_name()->get_op_name()->get_val(); if (isFunc) { strm << "_("; this->get_type_spec()->printType(strm); strm << "& return_val"; if (inargs || this->get_parameter_decls()) strm << ","; } else strm << "("; if (this->get_parameter_decls()) this->get_parameter_decls()->printArgs(strm); if (inargs) { if (this->get_parameter_decls()) strm << ","; inargs->printArgs(strm); } strm << ")"; if (this->get_const_qualifier()) strm << " const"; strm << "\");\n"; @) *operation* void printSplitHdr(int isFunc, ofstream &strm, Vertex* owner, Param_decl_Commalist* inargs, Vertex* v) *wrapper* Header *prefix* (@ this->get_signature()->printSplitHdr(isFunc, strm, owner, inargs, v); @) *wrapper* Signature *prefix* (@ int r; //////////////////////////// // print default arglist //////////////////////////// r = 0; if (this->get_parameter_decls()) this->get_parameter_decls()->hasDefaultArgs(r); if (r) this->get_parameter_decls()->printDefaultArgs(isFunc,strm); ///////////////////////// // print signature ///////////////////////// strm << "void "; owner->printVertex(strm); strm << "::"; strm << v->get_vertex_name()->get_val() << this->get_name()->get_op_name()->get_val(); if (isFunc) { strm << "_( "; this->get_type_spec()->printType(strm); strm << "& return_val"; if (inargs || this->get_parameter_decls()) strm << ", "; } else strm << "( "; if (this->get_parameter_decls()) this->get_parameter_decls()->printArgs(strm); if (inargs) { if (this->get_parameter_decls()) strm << ", "; inargs->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 << "\",\""; strm << "void "; owner->printVertex(strm); strm << "::"; strm << v->get_vertex_name()->get_val() << this->get_name()->get_op_name()->get_val(); if (isFunc) { strm << "_("; this->get_type_spec()->printType(strm); strm << "& return_val"; if (inargs || this->get_parameter_decls()) strm << ","; } else strm << "("; if (this->get_parameter_decls()) this->get_parameter_decls()->printArgs(strm); if (inargs) { if (this->get_parameter_decls()) strm << ","; inargs->printArgs(strm); } strm << ")"; if (this->get_const_qualifier()) strm << " const"; strm << "\");\n"; @)