diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-04-07 16:29:54 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-04-07 16:29:54 +0000 |
commit | ce06a53ca96f4de195a73c009e61e6068dc68818 (patch) | |
tree | 650fa6200bc31bd858555f747ee48b3c12601588 | |
parent | 469c2670d606c1b069cd3e1e6add20e769730b53 (diff) | |
download | ATCD-ce06a53ca96f4de195a73c009e61e6068dc68818.tar.gz |
ChangeLogTag:Wed Apr 7 11:27:08 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-99c | 22 | ||||
-rw-r--r-- | TAO/TAO_IDL/ast/ast_expression.cpp | 29 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_interface.cpp | 104 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp | 14 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp | 23 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp | 73 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp | 19 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp | 94 |
8 files changed, 182 insertions, 196 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index b41ad0389f8..80c989f27ae 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,25 @@ +Wed Apr 7 11:27:08 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * TAO_IDL/ast/ast_expression.cpp: + Fixed the problems with LL_MAX and friends, use the ACE_*_MAX + constants instead. + + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: + T::_narrow() can use T::_unchecked_narrow() to complete its + job. + + * TAO_IDL/be/be_interface.cpp: + The generated operation table is static to avoid namespace + pollution. + + * TAO_IDL/be/be_visitor_interface/interface_sh.cpp: + * TAO_IDL/be/be_visitor_interface/interface_si.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + The generated code is more readable now. + The code for the collocated class and the skeleton where mixed + and thus harder to read. + Wed Apr 07 10:11:23 1999 David L. Levine <levine@cs.wustl.edu> * orbscvs/Concurrency_Service/Makefile, diff --git a/TAO/TAO_IDL/ast/ast_expression.cpp b/TAO/TAO_IDL/ast/ast_expression.cpp index 9e7669b802f..a8153b2ca1d 100644 --- a/TAO/TAO_IDL/ast/ast_expression.cpp +++ b/TAO/TAO_IDL/ast/ast_expression.cpp @@ -53,8 +53,8 @@ Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR Sun, Sun Microsystems and the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. -SunSoft, Inc. -2550 Garcia Avenue +SunSoft, Inc. +2550 Garcia Avenue Mountain View, California 94043 NOTE: @@ -85,7 +85,7 @@ ACE_RCSID(ast, ast_expression, "$Id$") void AST_Expression::fill_definition_details() { - pd_defined_in = idl_global->scopes()->depth() > 0 + pd_defined_in = idl_global->scopes()->depth() > 0 ? idl_global->scopes()->top() : 0 ; pd_line = idl_global->lineno(); @@ -260,7 +260,7 @@ AST_Expression::AST_Expression(ACE_CDR::ULongLong ullv) pd_ev->u.ullval = ullv; } -/* +/* * An AST_Expression denoting a 32-bit floating point number */ AST_Expression::AST_Expression(float fv) @@ -680,7 +680,7 @@ coerce_value(AST_Expression::AST_ExprValue *ev, AST_Expression::ExprType t) return ev; return ev; case AST_Expression::EV_ulonglong: - if (ev->u.ullval > LL_MAX) + if (ev->u.ullval > ACE_INT64_MAX) return NULL; ev->u.llval = (ACE_CDR::LongLong) ev->u.ullval; ev->et = AST_Expression::EV_longlong; @@ -690,13 +690,15 @@ coerce_value(AST_Expression::AST_ExprValue *ev, AST_Expression::ExprType t) ev->et = AST_Expression::EV_longlong; return ev; case AST_Expression::EV_float: - if (ev->u.fval > (float) LL_MAX || ev->u.fval < (float) -(LL_MAX)) + if (ev->u.fval > (float) ACE_INT64_MAX + || ev->u.fval < (float) ACE_INT64_MIN) return NULL; ev->u.llval = (ACE_CDR::LongLong) ev->u.fval; ev->et = AST_Expression::EV_longlong; return ev; case AST_Expression::EV_double: - if (ev->u.dval > (double) ULL_MAX || ev->u.dval < (double) -(LL_MAX)) + if (ev->u.dval > (double) ACE_INT64_MAX + || ev->u.dval < (double) ACE_INT64_MIN) return NULL; ev->u.llval = (ACE_CDR::LongLong) ev->u.dval; ev->et = AST_Expression::EV_longlong; @@ -756,13 +758,13 @@ coerce_value(AST_Expression::AST_ExprValue *ev, AST_Expression::ExprType t) ev->et = AST_Expression::EV_ulonglong; return ev; case AST_Expression::EV_float: - if (ev->u.fval < 0.0 || ev->u.fval > (float) ULL_MAX) + if (ev->u.fval < 0.0 || ev->u.fval > (float) ACE_UINT64_MAX) return NULL; ev->u.ullval = (ACE_CDR::ULongLong) ev->u.fval; ev->et = AST_Expression::EV_ulonglong; return ev; case AST_Expression::EV_double: - if (ev->u.dval < 0.0 || ev->u.dval > (double) ULL_MAX) + if (ev->u.dval < 0.0 || ev->u.dval > (double) ACE_UINT64_MAX) return NULL; ev->u.ullval = (ACE_CDR::ULongLong) ev->u.dval; ev->et = AST_Expression::EV_ulonglong; @@ -872,7 +874,8 @@ coerce_value(AST_Expression::AST_ExprValue *ev, AST_Expression::ExprType t) case AST_Expression::EV_ulonglong: // Some compilers don't implement unsigned 64-bit to float conversions, // so we are stuck with the signed 64-bit max value. - if (ev->u.ullval > LL_MAX || (ACE_CDR::LongLong) ev->u.ullval > FLT_MAX) + if (ev->u.ullval > ACE_UINT64_MAX + || (ACE_CDR::LongLong) ev->u.ullval > ACE_FLT_MAX) return NULL; ev->u.fval = (float) ((ACE_CDR::LongLong) ev->u.ullval); ev->et = AST_Expression::EV_float; @@ -932,9 +935,9 @@ coerce_value(AST_Expression::AST_ExprValue *ev, AST_Expression::ExprType t) ev->et = AST_Expression::EV_double; return ev; case AST_Expression::EV_ulonglong: - // Some compilers don't implement unsigned 64-bit to double + // Some compilers don't implement unsigned 64-bit to double // conversions, so we are stuck with the signed 64-bit max value. - if (ev->u.ullval > LL_MAX) + if (ev->u.ullval > ACE_INT64_MAX) return NULL; ev->u.dval = (double) ((ACE_CDR::LongLong) ev->u.ullval); ev->et = AST_Expression::EV_double; @@ -1866,7 +1869,7 @@ AST_Expression::dump(ostream &o) case EC_none: break; default: - o << GTDEVEL("unsupported dump mode for expression with ec == ") + o << GTDEVEL("unsupported dump mode for expression with ec == ") << (int) pd_ec ; break; } diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 33f9e4fbb6e..9e9526f9b78 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -271,14 +271,14 @@ void be_interface::in_mult_inheritance (int mi) } //gen copy constructors -void +void be_interface::gen_copy_ctors (TAO_OutStream* os) { this->traverse_inheritance_graph(be_interface::gen_copy_ctors_helper,os); return; } -int +int be_interface::gen_copy_ctors_helper (be_interface* node, be_interface* base, TAO_OutStream *os) { static int first = 0; @@ -287,14 +287,14 @@ be_interface::gen_copy_ctors_helper (be_interface* node, be_interface* base, TAO if(first) { *os << idl_global->impl_class_prefix () << base->flatname () << idl_global->impl_class_suffix () << " (t)" - << ", " << base->full_skel_name () << " (t)"; + << ", " << base->full_skel_name () << " (t)"; first = 0; } else { - *os << ", " << idl_global->impl_class_prefix () << base->flatname () << idl_global->impl_class_suffix () << " (t)" + *os << ", " << idl_global->impl_class_prefix () << base->flatname () << idl_global->impl_class_suffix () << " (t)" << ", " << base->full_skel_name () << " (t)"; ; - + } } else @@ -304,19 +304,19 @@ be_interface::gen_copy_ctors_helper (be_interface* node, be_interface* base, TAO } return 1; - + } - + //generate default constructors -void +void be_interface::gen_def_ctors (TAO_OutStream* os) { this->traverse_inheritance_graph(be_interface::gen_def_ctors_helper,os); return; } - -int + +int be_interface::gen_def_ctors_helper (be_interface* node, be_interface* base, TAO_OutStream *os) { @@ -325,13 +325,13 @@ be_interface::gen_def_ctors_helper (be_interface* node, be_interface* base, TAO_ { if(first) { - *os << idl_global->impl_class_prefix () << base->flatname () << idl_global->impl_class_suffix () << " ()"; + *os << idl_global->impl_class_prefix () << base->flatname () << idl_global->impl_class_suffix () << " ()"; first = 0; } else { *os << ", " << idl_global->impl_class_prefix () << base->flatname () << idl_global->impl_class_suffix () << " ()"; - + } } else @@ -341,7 +341,7 @@ be_interface::gen_def_ctors_helper (be_interface* node, be_interface* base, TAO_ } return 1; - + } @@ -944,19 +944,22 @@ be_interface::gen_operation_table (void) *ss << "static ACE_Static_Allocator_Base _tao_" << this->flatname () << "_allocator (_tao_" << this->flatname () << "_optable_pool, " << "_tao_" << this->flatname () << "_optable_size);" << be_nl; - *ss << "TAO_Dynamic_Hash_OpTable tao_" << this->flatname () << "_optable " - << "(" << this->flatname () << "_operations, " << this->skel_count_ - << ", " << 2*this->skel_count_ << ", &_tao_" << this->flatname () - << "_allocator);" << be_nl; + *ss << "static TAO_Dynamic_Hash_OpTable tao_" + << this->flatname () << "_optable " << "(" << be_idt << be_idt_nl + << this->flatname () << "_operations," << be_nl + << this->skel_count_ << "," << be_nl + << 2*this->skel_count_ << "," << be_nl + << "&_tao_" << this->flatname () << "_allocator" << be_uidt_nl + << ");" << be_uidt_nl; break; case TAO_CodeGen::TAO_LINEAR_SEARCH: // For generating linear search also, we are calling GPERF - // only. + // only. case TAO_CodeGen::TAO_BINARY_SEARCH: // For generating binary search also, we are calling GPERF - // only. + // only. case TAO_CodeGen::TAO_PERFECT_HASH: // For each interface in the IDL, have a new temp file to // collect the input for the gperf program. @@ -972,7 +975,7 @@ be_interface::gen_operation_table (void) "%s%s.gperf", idl_global->temp_dir (), this->flatname ()); - + // Save this file name with the codegen singleton. cg->gperf_input_filename (temp_file); @@ -1007,8 +1010,8 @@ be_interface::gen_operation_table (void) -1); // Add the gperf input header. - gen_gperf_input_header (ss); - + this->gen_gperf_input_header (ss); + // Traverse the graph. if (this->traverse_inheritance_graph (be_interface::gen_optable_helper, ss) == -1) ACE_ERROR_RETURN ((LM_ERROR, @@ -1032,7 +1035,7 @@ be_interface::gen_operation_table (void) // Input to the gperf is ready. Run gperf and get things // done. This method also unlinks the temp file that we used // for the gperf. - gen_gperf_things (); + this->gen_gperf_things (); } break; @@ -1363,7 +1366,7 @@ be_interface::gen_optable_helper (be_interface *derived, // Run GPERF and get the correct lookup and other operations // depending on which strategy we are using. Returns 0 on sucess, -1 -// on error. +// on error. int be_interface::gen_gperf_things (void) { @@ -1381,9 +1384,9 @@ be_interface::gen_gperf_things (void) { case TAO_CodeGen::TAO_PERFECT_HASH: // Output a class definition deriving from - // TAO_Perfect_Hash_OpTable. + // TAO_Perfect_Hash_OpTable. gen_perfect_hash_class_definition (); - + // Call GPERF and get the methods defined. if (gen_gperf_lookup_methods () == -1) return -1; @@ -1391,14 +1394,14 @@ be_interface::gen_gperf_things (void) // Create an instance of the correct class corresponding the // operation lookup strategy we are following. gen_perfect_hash_instance (); - + break; - + case TAO_CodeGen::TAO_BINARY_SEARCH: // Output a class definition deriving from // TAO_Binary_Search_OpTable. this->gen_binary_search_class_definition (); - + // Call GPERF and get the methods defined. if (gen_gperf_lookup_methods () == -1) return -1; @@ -1408,12 +1411,12 @@ be_interface::gen_gperf_things (void) gen_binary_search_instance (); break; - + case TAO_CodeGen::TAO_LINEAR_SEARCH: // Output a class definition deriving from // TAO_Linear_Search_OpTable. gen_linear_search_class_definition (); - + // Call GPERF and get the methods defined. if (gen_gperf_lookup_methods () == -1) return -1; @@ -1423,7 +1426,7 @@ be_interface::gen_gperf_things (void) gen_linear_search_instance (); break; - + default: ACE_ERROR_RETURN ((LM_ERROR, "tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"), @@ -1463,7 +1466,7 @@ be_interface::gen_perfect_hash_class_definition (void) } // Outputs the class definition for the binary searching. This class -// will inherit from the TAO_Binary_Seach_OpTable. +// will inherit from the TAO_Binary_Seach_OpTable. void be_interface::gen_binary_search_class_definition (void) { @@ -1493,7 +1496,7 @@ be_interface::gen_linear_search_class_definition (void) { // Codegen singleton. TAO_CodeGen *cg = TAO_CODEGEN::instance (); - + // Outstream. TAO_OutStream *ss = cg->server_skeletons (); @@ -1534,21 +1537,21 @@ be_interface::gen_gperf_lookup_methods (void) // <open_temp_file> to open the file now, so that the file will get // deleted once when we close the file. - // Close the file. + // Close the file. if (ACE_OS::fclose (cg->gperf_input_stream ()->file ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p:File close failed on temp gperf's input file\n"), -1); - // Open the temp file. + // Open the temp file. ACE_HANDLE input = ACE::open_temp_file (cg->gperf_input_filename (), O_RDONLY); - + if (input == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "%p:File open failed on gperf's temp input file\n"), -1); - + // Stdout is server skeleton. Do *not* close the file, just open // again with ACE_OS::open with WRITE + APPEND option.. After this, // remember to update the file offset to the correct location. @@ -1564,7 +1567,7 @@ be_interface::gen_gperf_lookup_methods (void) process_options.set_handles (input, output); // Set the command line for the gperf program. Give the right - // arguments for the operation lookup strategy that we are using. + // arguments for the operation lookup strategy that we are using. switch (cg->lookup_strategy ()) { // Perfect Hashing. @@ -1585,8 +1588,8 @@ be_interface::gen_gperf_lookup_methods (void) idl_global->gperf_path (), this->flatname ()); break; - - // Binary search methods from GPERF. Everythis and the -B flag. + + // Binary search methods from GPERF. Everythis and the -B flag. case TAO_CodeGen::TAO_BINARY_SEARCH: process_options.command_line ("%s" " " @@ -1606,7 +1609,7 @@ be_interface::gen_gperf_lookup_methods (void) idl_global->gperf_path (), this->flatname ()); break; - + // Linear search methods from GPERF. Everything and the -z flag. case TAO_CodeGen::TAO_LINEAR_SEARCH: process_options.command_line ("%s" @@ -1632,7 +1635,7 @@ be_interface::gen_gperf_lookup_methods (void) ACE_ERROR_RETURN ((LM_ERROR, "tao_idl:ERROR:%N:%l:Unknown Operation Lookup Strategy\n"), -1); - } + } // Spawn a process for gperf. @@ -1663,11 +1666,10 @@ be_interface::gen_perfect_hash_instance () // Outstream. TAO_OutStream *ss = cg->server_skeletons (); - *ss << "TAO_" << this->flatname () << "_Perfect_Hash_OpTable" + *ss << "static TAO_" << this->flatname () << "_Perfect_Hash_OpTable" << " " << "tao_" << this->flatname () << "_optable" - << ";" - << be_nl; + << ";\n" << be_nl; } // Create an instance of the binary search optable. @@ -1680,11 +1682,10 @@ be_interface::gen_binary_search_instance () // Outstream. TAO_OutStream *ss = cg->server_skeletons (); - *ss << "TAO_" << this->flatname () << "_Binary_Search_OpTable" + *ss << "static TAO_" << this->flatname () << "_Binary_Search_OpTable" << " " << "tao_" << this->flatname () << "_optable" - << ";" - << be_nl; + << ";\n" << be_nl; } // Create an instance of this perfect hash table. @@ -1697,11 +1698,10 @@ be_interface::gen_linear_search_instance () // Outstream. TAO_OutStream *ss = cg->server_skeletons (); - *ss << "TAO_" << this->flatname () << "_Linear_Search_OpTable" + *ss << "static TAO_" << this->flatname () << "_Linear_Search_OpTable" << " " << "tao_" << this->flatname () << "_optable" - << ";" - << be_nl; + << ";\n" << be_nl; } int diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index 05d1cf2950e..ff03c2a6bab 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -186,18 +186,18 @@ be_visitor_interface_ch::visit_interface (be_interface *node) // the _is_a method os->indent (); *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl - << "const CORBA::Char *type_id, " << be_nl + << "const CORBA::Char *type_id, " << be_nl << "CORBA::Environment &env = " << be_idt_nl - << "CORBA::Environment::default_environment ()" - << be_uidt << be_uidt_nl - << ");" << be_uidt_nl - << "virtual const char* " - << "_interface_repository_id (void) const;" << be_uidt_nl; + << "CORBA::Environment::default_environment ()" + << be_uidt << be_uidt_nl + << ");" << be_uidt_nl + << "virtual const char* " + << "_interface_repository_id (void) const;\n" << be_uidt_nl; // generate the "protected" constructor so that users cannot instantiate // us *os << "protected:" << be_idt_nl - << node->local_name () << " (void); // default constructor" << be_nl + << node->local_name () << " (void);" << be_nl << node->local_name () << " (TAO_Stub *objref, " << be_idt << be_idt_nl << "TAO_ServantBase *_tao_servant = 0, " << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp index 29de681be8e..f795da20bfc 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -67,30 +67,15 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << be_idt_nl << "return " << node->name () << "::_nil ();" << be_uidt_nl; + *os << "return " << node->name () + << "::_unchecked_narrow (obj, env);" << be_uidt_nl + << "}" << be_nl << be_nl; + // This may be necessary to work around a GCC compiler bug! const char *skel_name = node->full_skel_name (); const char *coll_name = node->full_coll_name (); assert (coll_name != 0); - *os << "TAO_Stub* stub = obj->_stubobj ();" << be_nl - << "stub->_incr_refcnt ();" << be_nl; - *os << "void* servant = 0;" << be_nl; - *os << "if (obj->_is_collocated () " - << "&& obj->_servant() != 0)" << be_idt_nl - << "servant = obj->_servant()->_downcast (\"" - << node->repoID () << "\");" << be_uidt_nl; - - *os << "if (servant == 0)" << be_idt_nl - << "return new " << node->name () << "(stub);" << be_uidt_nl; - - *os << "return new " - << coll_name << "(" << be_idt << be_idt_nl - << "ACE_reinterpret_cast(" << skel_name - << "_ptr, servant)," << be_nl - << "stub" << be_uidt_nl - << ");" << be_uidt << be_uidt_nl - << "}" << be_nl << be_nl; - // The _unchecked_narrow method *os << node->name () << "_ptr " << node->name () << "::_unchecked_narrow (" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index b0107f873c2..12a3a50a992 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -102,33 +102,24 @@ be_visitor_interface_sh::visit_interface (be_interface *node) *os << be_nl << "{" << be_nl << "protected:" << be_idt_nl - << namebuf << " (void);" << be_uidt_nl + << namebuf << " (void);\n" << be_uidt_nl << "public:" << be_idt_nl << namebuf << " (const " << namebuf << "& rhs);" << be_nl - << "virtual ~" << namebuf << " (void);" << be_nl; + << "virtual ~" << namebuf << " (void);\n\n"; - *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl + *os << be_nl + << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl << "const char* logical_type_id," << be_nl << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl << "CORBA::Environment::default_environment ()" << be_uidt << be_uidt_nl - << ");" << be_uidt_nl; + << ");\n" << be_uidt_nl; *os << "virtual void* _downcast (" << be_idt << be_idt_nl << "const char* logical_type_id" << be_uidt_nl - << ");\n" << be_uidt; + << ");\n" << be_uidt_nl; - // generate code for elements in the scope (e.g., operations) - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "codegen for scope failed\n"), - -1); - } // add a skeleton for our _is_a method - os->indent (); *os << "static void _is_a_skel (" << be_idt << be_idt_nl << "CORBA::ServerRequest &req," << be_nl << "void *obj," << be_nl @@ -136,7 +127,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl << "CORBA::Environment::default_environment ()" << be_uidt << be_uidt_nl - << ");" << be_uidt << "\n\n"; + << ");\n" << be_uidt_nl; // add a skeleton for our _non_existent method os->indent (); @@ -147,46 +138,48 @@ be_visitor_interface_sh::visit_interface (be_interface *node) << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl << "CORBA::Environment::default_environment ()" << be_uidt << be_uidt_nl - << ");" << be_uidt << "\n\n"; - - // add a method that says whether we are involved in a multiple inheritance - // or not - os->indent (); - *os << "CORBA::Boolean in_mult_inheritance (void);\n\n"; - - // generate skeletons for operations of our base classes. These skeletons - // just cast the pointer to the appropriate type before invoking the call - if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "inheritance graph traversal failed\n"), - -1); - } + << ");\n" << be_uidt_nl; // add the dispatch method - os->indent (); *os << "virtual void _dispatch (" << be_idt << be_idt_nl << "CORBA::ServerRequest &_tao_req," << be_nl << "void *_tao_context," << be_nl << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl << "CORBA::Environment::default_environment ()" << be_uidt << be_uidt_nl - << ");" << be_uidt << "\n\n"; + << ");\n" << be_uidt_nl; // Print out the _this() method. - os->indent (); *os << node->name () << " *_this (" << be_idt << be_idt_nl << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl << "CORBA::Environment::default_environment ()" << be_uidt << be_uidt_nl - << ");" << be_uidt << "\n"; + << ");\n" << be_uidt_nl; // the _interface_repository_id method - os->indent (); - *os << "virtual const char* _interface_repository_id (void) const;\n"; - os->decr_indent (); + *os << "virtual const char* _interface_repository_id " + << "(void) const;" << be_uidt_nl; + + // generate code for elements in the scope (e.g., operations) + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + + // generate skeletons for operations of our base classes. These skeletons + // just cast the pointer to the appropriate type before invoking the call + if (node->traverse_inheritance_graph (be_interface::gen_skel_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "inheritance graph traversal failed\n"), + -1); + } *os << "};\n\n"; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp index 76768659b91..6ac012bab0a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp @@ -60,25 +60,6 @@ be_visitor_interface_si::visit_interface (be_interface *node) -1); } - os->indent (); // start with whatever indentation level we are at - *os << "ACE_INLINE CORBA::Boolean" << be_nl; - *os << node->full_skel_name () << "::in_mult_inheritance (void)" << be_nl - << "{" << be_idt_nl; - switch (node->in_mult_inheritance ()) - { - case 0: - *os << "return 0;"; - break; - case 1: - *os << "return 1;"; - break; - default: - // error - return -1; - } - *os << be_uidt_nl - << "}" << be_nl << be_nl; - // Generate skeletons for operations of our base classes. These skeletons // just cast the pointer to the appropriate type before invoking the // call. Hence we generate these in the inline file diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index 8ef39b74845..8fb1cdf5067 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -108,10 +108,8 @@ be_visitor_interface_ss::visit_interface (be_interface *node) "be_visitor_interface_ss::visit_interface - " " copy ctor generation failed\n"), -1); *os << " TAO_ServantBase (rhs)" << be_uidt_nl - << "{}\n"; + << "{}\n" << be_nl; - // destructor - os->indent (); *os << "// skeleton destructor" << be_nl; if (!node->is_nested ()) @@ -127,7 +125,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) " (void)" << be_nl; } *os << "{\n"; - *os << "}\n"; + *os << "}\n\n"; // generate code for elements in the scope (e.g., operations) @@ -141,6 +139,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) } // generate code for the _is_a skeleton + // @@ TODO Use compiled marshaling here!!! os->indent (); *os << "void " << node->full_skel_name () << "::_is_a_skel (" << be_idt << be_idt_nl @@ -190,32 +189,8 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << "}\n\n"; - os->indent (); - *os << "CORBA::Boolean " << node->full_skel_name () - << "::_is_a (" << be_idt << be_idt_nl - << "const char* value," << be_nl - << "CORBA::Environment &ACE_TRY_ENV" << be_uidt_nl - << ")" << be_uidt_nl - << "{" << be_idt_nl - << "if (\n" << be_idt; - if (node->traverse_inheritance_graph (be_interface::is_a_helper, os) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_ss::" - "visit_interface - " - "traversal of inhertance graph failed\n"), - -1); - } - - os->indent (); - *os << "(!ACE_OS::strcmp ((char *)value, " - << "CORBA::_tc_Object->id (ACE_TRY_ENV))))" - << be_idt_nl << "return 1;" << be_uidt_nl - << "else" << be_idt_nl - << "return 0;" << be_uidt << be_uidt << be_uidt_nl - << "}\n\n"; - // generate code for the _non_existent skeleton + // @@ TODO Use compiled marshaling here!!! Or remove this method! os->indent (); *os << "void " << node->full_skel_name () << "::_non_existent_skel (" << be_idt << be_idt_nl @@ -245,6 +220,31 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << "}\n\n"; os->indent (); + *os << "CORBA::Boolean " << node->full_skel_name () + << "::_is_a (" << be_idt << be_idt_nl + << "const char* value," << be_nl + << "CORBA::Environment &ACE_TRY_ENV" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl + << "if (\n" << be_idt; + if (node->traverse_inheritance_graph (be_interface::is_a_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_ss::" + "visit_interface - " + "traversal of inhertance graph failed\n"), + -1); + } + + os->indent (); + *os << "(!ACE_OS::strcmp ((char *)value, " + << "CORBA::_tc_Object->id (ACE_TRY_ENV))))" + << be_idt_nl << "return 1;" << be_uidt_nl + << "else" << be_idt_nl + << "return 0;" << be_uidt << be_uidt << be_uidt_nl + << "}\n\n"; + + os->indent (); *os << "void* " << node->full_skel_name () << "::_downcast (" << be_idt << be_idt_nl << "const char* logical_type_id" << be_uidt_nl @@ -302,6 +302,22 @@ be_visitor_interface_ss::visit_interface (be_interface *node) os->decr_indent (); *os << "}\n\n"; + *os << "\n"; + + // the _this () operation + *os << node->name () << "*" << be_nl + << node->full_skel_name () + << "::_this (CORBA_Environment &ACE_TRY_ENV)" << be_nl + << "{" << be_idt_nl + << "TAO_Stub *stub = this->_create_stub (ACE_TRY_ENV);" << be_nl + << "ACE_CHECK_RETURN (0);" << be_nl + // << "if (ACE_TRY_ENV.exception () != 0)" << be_idt_nl + // << "return 0;" << be_uidt_nl + << "return new " << node->full_coll_name () + << " (this, stub);" << be_uidt << be_nl; + + *os << "}\n\n"; + // generate the collocated class impl be_visitor_context ctx (*this->ctx_); ctx.state (TAO_CodeGen::TAO_INTERFACE_COLLOCATED_SS); @@ -325,21 +341,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) } delete visitor; - *os << "\n"; - - // the _this () operation - *os << node->name () << "*" << be_nl - << node->full_skel_name () - << "::_this (CORBA_Environment &ACE_TRY_ENV)" << be_nl - << "{" << be_idt_nl - << "TAO_Stub *stub = this->_create_stub (ACE_TRY_ENV);" << be_nl - << "ACE_CHECK_RETURN (0);" << be_nl - // << "if (ACE_TRY_ENV.exception () != 0)" << be_idt_nl - // << "return 0;" << be_uidt_nl - << "return new " << node->full_coll_name () - << " (this, stub);" << be_uidt << be_nl; - - *os << "}\n\n"; - - return 0; + *os << "\n\n"; + + return 0; } |