diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-04-20 05:54:53 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-04-20 05:54:53 +0000 |
commit | 8de5379034bdc854621f054f1ec70b4da1cc47ab (patch) | |
tree | 843ef8d4939612d2d9e8e6727c2a50677f97c9b9 | |
parent | fd93d3807e7598ff2b2ece067fbe3d1b94b69f30 (diff) | |
download | ATCD-8de5379034bdc854621f054f1ec70b4da1cc47ab.tar.gz |
Thu Apr 20 00:40:19 2000 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 28 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp | 148 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_factory.cpp | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface.cpp | 8 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp | 34 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp | 11 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_root/root.cpp | 18 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_codegen.h | 13 |
10 files changed, 161 insertions, 120 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 0b608f61a41..005aa66b1d7 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,17 +1,33 @@ TO-DO - * Supress AMI code generation for local interfaces. - * Need to add syntax/semantic check for local/abstract interfaces as defined in CCM. (E.g., a local interface can not be an argument in an operation of a remote interface.) - * Remove gen_locality_constraint stuff. - * Rename TAO/TAO_IDL/util/utl_error.cpp to utl_err.cpp. - * Need to figure out how to do _narrow if a local interface - inherits from a remote interface. +Thu Apr 20 00:40:19 2000 Nanbor Wang <nanbor@cs.wustl.edu> + + * TAO_IDL/be_include/be_codegen.h: Added several new compiler + states to propagate local interface information down the chain. + + * TAO_IDL/be/be_visitor_factory.cpp: + * TAO_IDL/be/be_visitor_root/root.cpp: + * TAO_IDL/be/be_visitor_interface/interface.cpp: Changed to + propagate local interface states down the chain. + + * TAO_IDL/be/be_visitor_ami_pre_proc.cpp: No need to preprocess + local interfaces for AMI. + + * TAO_IDL/be/be_visitor_interface/interface_cs.cpp: Do not + generate typecode information for local interfaces. + + * TAO_IDL/be/be_visitor_operation/arglist.cpp: + * TAO_IDL/be/be_visitor_operation/operation_ch.cpp: Operations of + local interfaces should be declared as pure virtual functions. + + * TAO_IDL/be/be_visitor_operation/operation_cs.cpp: Do not + generate code local interface's operations. Wed Apr 19 04:05:39 2000 Nanbor Wang <nanbor@cs.wustl.edu> diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp index a700403a87d..f22331bdbc8 100644 --- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp @@ -56,7 +56,7 @@ be_visitor_ami_pre_proc::visit_root (be_root *node) return 0; } -int +int be_visitor_ami_pre_proc::visit_module (be_module *node) { if (!node->imported ()) @@ -76,11 +76,11 @@ be_visitor_ami_pre_proc::visit_module (be_module *node) int be_visitor_ami_pre_proc::visit_interface (be_interface *node) { - if (!node->imported ()) + if (!node->imported () && !node->is_local_interface ()) { AST_Module *module = AST_Module::narrow_from_scope (node->defined_in ()); if (!module) - { + { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_ami_pre_proc::" "visit_interface - " @@ -97,7 +97,7 @@ be_visitor_ami_pre_proc::visit_interface (be_interface *node) { reply_handler->set_defined_in (node->defined_in ()); - // Insert the ami handler after the node, the + // Insert the ami handler after the node, the // exception holder will be placed between these two later. module->be_add_interface (reply_handler, node); @@ -114,7 +114,7 @@ be_visitor_ami_pre_proc::visit_interface (be_interface *node) } // Set the proper strategy - be_interface_strategy *old_strategy = + be_interface_strategy *old_strategy = node->set_strategy (new be_interface_ami_strategy (node, reply_handler)); if (old_strategy) @@ -124,14 +124,14 @@ be_visitor_ami_pre_proc::visit_interface (be_interface *node) { excep_holder->set_defined_in (node->defined_in ()); // Insert the exception holder after the original node, - // this way we ensure that it is *before* the + // this way we ensure that it is *before* the // ami handler, which is the way we want to have it. module->be_add_interface (excep_holder, node); module->set_has_nested_valuetype (); // Remember from whom we were cloned excep_holder->original_interface (node); // Set the strategy - be_interface_strategy *old_strategy = + be_interface_strategy *old_strategy = excep_holder->set_strategy (new be_interface_ami_exception_holder_strategy (excep_holder)); if (old_strategy) delete old_strategy; @@ -159,18 +159,18 @@ be_visitor_ami_pre_proc::visit_interface (be_interface *node) return 0; } -int +int be_visitor_ami_pre_proc::visit_operation (be_operation *node) { if (node->flags () == AST_Operation::OP_oneway) // We do nothing for oneways! return 0; - be_operation *sendc_marshaling = - this->create_sendc_operation (node, + be_operation *sendc_marshaling = + this->create_sendc_operation (node, 0); // for arguments = FALSE - be_operation *sendc_arguments = + be_operation *sendc_arguments = this->create_sendc_operation (node, 1); // for arguments = TRUE @@ -185,8 +185,8 @@ be_visitor_ami_pre_proc::visit_operation (be_operation *node) // Set the proper strategy, and store the specialized // marshaling and arguments operations in it. - be_operation_strategy *old_strategy = - node->set_strategy (new be_operation_ami_sendc_strategy (node, + be_operation_strategy *old_strategy = + node->set_strategy (new be_operation_ami_sendc_strategy (node, sendc_marshaling, sendc_arguments)); if (old_strategy) @@ -201,13 +201,13 @@ int be_visitor_ami_pre_proc::visit_attribute (be_attribute *node) { // Temporerily generate the set operation. - be_operation *set_operation = + be_operation *set_operation = this->generate_set_operation (node); this->visit_operation (set_operation); // Retrieve the strategy set by the visit operation - be_operation_strategy *set_operation_strategy = + be_operation_strategy *set_operation_strategy = set_operation->set_strategy (new be_operation_default_strategy (set_operation)); // Assign it to the attribute as set_operation strategy @@ -215,12 +215,12 @@ be_visitor_ami_pre_proc::visit_attribute (be_attribute *node) delete node->set_set_strategy (set_operation_strategy); // Temporerily generate the get operation. - be_operation *get_operation = + be_operation *get_operation = this->generate_get_operation (node); this->visit_operation (get_operation); - be_operation_strategy *get_operation_strategy = + be_operation_strategy *get_operation_strategy = get_operation->set_strategy (new be_operation_default_strategy (get_operation)); if (get_operation_strategy) @@ -240,30 +240,30 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) { // Create a virtual module named "Messaging" and an valuetype "ExceptionHolder" // from which we inherit. - UTL_ScopedName *inherit_name = + UTL_ScopedName *inherit_name = new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), 0); - - inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder", + + inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder", 0, 0, 0), 0)); - + be_valuetype *inherit_vt = new be_valuetype (inherit_name, 0, 0, 0); inherit_vt->set_name (inherit_name); - be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging", + be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging", 0, 0, 0), 0), 0); - - // Notice the valuetype "ExceptionHolder" that it is defined in the + + // Notice the valuetype "ExceptionHolder" that it is defined in the // "Messaging" module inherit_vt->set_defined_in (msg); @@ -287,7 +287,7 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) 0); // set abstract excep_holder->set_name (excep_holder_name); - // Now our customized valuetype is created, we have to + // Now our customized valuetype is created, we have to // add now the operations and attributes to the scope. if (node->nmembers () > 0) @@ -332,7 +332,7 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) } } - else + else { this->create_raise_operation (op, excep_holder, @@ -353,13 +353,13 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, { // Create a virtual module named "Messaging" and an interface "ReplyHandler" // from which we inherit. - UTL_ScopedName *inherit_name = + UTL_ScopedName *inherit_name = new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), 0); - + inherit_name->nconc (new UTL_ScopedName (new Identifier ("ReplyHandler", 0,0,0), 0)); - + be_interface *inherit_intf = new be_interface (inherit_name, 0, // inherited interfaces 0, // number of inherited interfaces @@ -371,8 +371,8 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), 0), 0); - - // Notice the interface "ReplyHandler" that it is defined in the + + // Notice the interface "ReplyHandler" that it is defined in the // "Messaging" module inherit_intf->set_defined_in (msg); @@ -398,7 +398,7 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, 0); // pragmas reply_handler->set_name (reply_handler_name); - // Now our customized valuetype is created, we have to + // Now our customized valuetype is created, we have to // add now the operations and attributes to the scope. if (node->nmembers () > 0) @@ -454,7 +454,7 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, else { be_operation* operation = be_operation::narrow_from_decl (d); - + if (operation) { this->create_reply_handler_operation (operation, @@ -464,7 +464,7 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, reply_handler, excep_holder); } - } + } si->next (); } // end of while loop delete si; @@ -490,19 +490,19 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node, return 0; } } - + // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", - 1, - 0, - I_FALSE), + (new Identifier ("void", + 1, + 0, + I_FALSE), 0), 0); // Name the operation properly - UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, + UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, excep_holder->name ()-> copy ()); ACE_CString new_local_name ("raise_"); @@ -541,7 +541,7 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node, } // Set the proper strategy - be_operation_strategy *old_strategy = + be_operation_strategy *old_strategy = operation->set_strategy (new be_operation_ami_exception_holder_raise_strategy (operation)); if (old_strategy) delete old_strategy; @@ -560,11 +560,11 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, if (node->flags () == AST_Operation::OP_oneway) // We do nothing for oneways! return 0; - + // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", 1, 0, I_FALSE), + (new Identifier ("void", 1, 0, I_FALSE), 0), 0); @@ -580,9 +580,9 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, op_name->last_component ()->replace_string (new_op_name.rep ()); // Create the operation - be_operation * op = new be_operation (rt, + be_operation * op = new be_operation (rt, AST_Operation::OP_noflags, - op_name, + op_name, 0); // Create the first argument, which is a Reply Handler @@ -616,9 +616,9 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, field_type, // is also a valuetype new UTL_ScopedName ( new Identifier ( - "ami_handler", - 1, - 0, + "ami_handler", + 1, + 0, I_FALSE ), 0 @@ -630,7 +630,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, } - // Iterate over the arguments and put all the in and inout + // Iterate over the arguments and put all the in and inout // into the new method. if (node->nmembers () > 0) { @@ -656,13 +656,13 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, } //be_decl *arg = be_decl::narrow_from_decl (d); AST_Argument *original_arg = AST_Argument::narrow_from_decl (d); - + if (original_arg->direction () == AST_Argument::dir_IN || original_arg->direction () == AST_Argument::dir_INOUT) { // Create the argument be_argument *arg = new be_argument (AST_Argument::dir_IN, - original_arg->field_type (), + original_arg->field_type (), original_arg->name (), 0); @@ -672,7 +672,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, } // end of while loop delete si; } // end of if - + return op; } @@ -694,7 +694,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", 1, 0, I_FALSE), + (new Identifier ("void", 1, 0, I_FALSE), 0), 0); @@ -710,9 +710,9 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, 0)); // Create the operation - be_operation *operation = new be_operation (rt, + be_operation *operation = new be_operation (rt, AST_Operation::OP_noflags, - op_name, + op_name, 0); operation->set_name (op_name); @@ -723,8 +723,8 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, // Create the argument be_argument *arg = new be_argument (AST_Argument::dir_IN, - node->return_type (), - new UTL_ScopedName + node->return_type (), + new UTL_ScopedName (new Identifier ("ami_return_val", 1, 0, I_FALSE), 0), @@ -734,7 +734,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, operation->add_argument_to_scope (arg); } - // Iterate over the arguments and put all the in and inout + // Iterate over the arguments and put all the in and inout // into the new method. if (node->nmembers () > 0) { @@ -760,13 +760,13 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, } //be_decl *arg = be_decl::narrow_from_decl (d); AST_Argument *original_arg = AST_Argument::narrow_from_decl (d); - + if (original_arg->direction () == AST_Argument::dir_INOUT || original_arg->direction () == AST_Argument::dir_OUT) { // Create the argument be_argument *arg = new be_argument (AST_Argument::dir_IN, - original_arg->field_type (), + original_arg->field_type (), original_arg->name (), 0); @@ -778,7 +778,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, } // end of if // Set the proper strategy - be_operation_strategy *old_strategy = + be_operation_strategy *old_strategy = operation->set_strategy (new be_operation_ami_handler_reply_stub_strategy (operation)); if (old_strategy) delete old_strategy; @@ -810,7 +810,7 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node, // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", 1, 0, I_FALSE), + (new Identifier ("void", 1, 0, I_FALSE), 0), 0); @@ -838,9 +838,9 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node, 0)); // create the operation - be_operation *operation = new be_operation (rt, + be_operation *operation = new be_operation (rt, AST_Operation::OP_noflags, - op_name, + op_name, 0); operation->set_name (op_name); operation->add_argument_to_scope (arg); @@ -884,7 +884,7 @@ be_visitor_ami_pre_proc::visit_scope (be_scope *node) } AST_Decl **elements = new AST_Decl *[number_of_elements]; - + { int position = 0; // initialize an iterator to iterate thru our scope @@ -904,7 +904,7 @@ be_visitor_ami_pre_proc::visit_scope (be_scope *node) int elem_number = 0; - + // continue until each element is visited while (elem_number < number_of_elements) { @@ -971,14 +971,14 @@ be_visitor_ami_pre_proc::generate_get_operation (be_attribute *node) ->get_string ()); ACE_CString new_op_name = ACE_CString ("get_") + original_op_name; - UTL_ScopedName *get_name = ACE_static_cast (UTL_ScopedName *, + UTL_ScopedName *get_name = ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ()); get_name->last_component ()->replace_string (new_op_name.rep ()); - be_operation *operation = - new be_operation (node->field_type (), + be_operation *operation = + new be_operation (node->field_type (), AST_Operation::OP_noflags, - get_name, + get_name, 0); operation->set_name (get_name); operation->set_defined_in (node->defined_in ()); @@ -995,7 +995,7 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node) ->get_string ()); ACE_CString new_op_name = ACE_CString ("set_") + original_op_name; - UTL_ScopedName *set_name = ACE_static_cast (UTL_ScopedName *, + UTL_ScopedName *set_name = ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ()); set_name->last_component ()->replace_string (new_op_name.rep ()); @@ -1016,7 +1016,7 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node) // create the operation be_operation *operation = new be_operation (rt, AST_Operation::OP_noflags, - set_name, + set_name, 0); operation->set_name (set_name); operation->set_defined_in (node->defined_in ()); @@ -1024,7 +1024,3 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node) return operation; } - - - - diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp index f685f67f85e..7574ef99cdc 100644 --- a/TAO/TAO_IDL/be/be_visitor_factory.cpp +++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp @@ -143,12 +143,15 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_module_cdr_op (new_ctx); case TAO_CodeGen::TAO_INTERFACE_CH: + case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: return new be_visitor_interface_ch (new_ctx); case TAO_CodeGen::TAO_INTERFACE_CI: + case TAO_CodeGen::TAO_LOCAL_INTERFACE_I: return new be_visitor_interface_ci (new_ctx); case TAO_CodeGen::TAO_INTERFACE_CS: + case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: return new be_visitor_interface_cs (new_ctx); case TAO_CodeGen::TAO_INTERFACE_SH: @@ -496,8 +499,10 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_UNION_ANY_OP_CS: return new be_visitor_union_any_op_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_CH: + case TAO_CodeGen::TAO_LOCAL_OPERATION_H: return new be_visitor_operation_ch (new_ctx); case TAO_CodeGen::TAO_OPERATION_CS: + case TAO_CodeGen::TAO_LOCAL_OPERATION_S: return new be_visitor_operation_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_SH: return new be_visitor_operation_sh (new_ctx); @@ -549,6 +554,7 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_operation_rettype_assign_ss (new_ctx); case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: + case TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H: case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_IS: diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp index 57ccda35af5..6928314a13a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -268,7 +268,7 @@ be_visitor_interface::visit_enum (be_enum *node) case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH: case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH: - case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS: + case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS: case TAO_CodeGen::TAO_INTERFACE_TIE_SH: case TAO_CodeGen::TAO_INTERFACE_TIE_SI: return 0; // nothing to be done @@ -413,6 +413,12 @@ be_visitor_interface::visit_operation (be_operation *node) case TAO_CodeGen::TAO_INTERFACE_CS: ctx.state (TAO_CodeGen::TAO_OPERATION_CS); break; + case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: + ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_H); + break; + case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: + ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_S); + break; case TAO_CodeGen::TAO_INTERFACE_SH: ctx.state (TAO_CodeGen::TAO_OPERATION_SH); break; 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 cdf45cebc94..b2ec7d668f6 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -251,12 +251,12 @@ be_visitor_interface_cs::visit_interface (be_interface *node) << "return \"" << node->repoID () << "\";" << be_uidt_nl << "}\n\n"; - be_visitor_context ctx (*this->ctx_); - be_visitor *visitor = 0; - // Smart Proxy classes if (! node->is_local_interface ()) { + be_visitor_context ctx (*this->ctx_); + be_visitor *visitor = 0; + ctx.state (TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS); visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) @@ -270,21 +270,21 @@ be_visitor_interface_cs::visit_interface (be_interface *node) } delete visitor; visitor = 0; - } - // by using a visitor to declare and define the TypeCode, we have the - // added advantage to conditionally not generate any code. This will be - // based on the command line options. This is still TO-DO - ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); - ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interface_cs::" - "visit_interface - " - "TypeCode definition failed\n"), - -1); + // by using a visitor to declare and define the TypeCode, we have the + // added advantage to conditionally not generate any code. This will be + // based on the command line options. This is still TO-DO + ctx.state (TAO_CodeGen::TAO_TYPECODE_DEFN); + ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_cs::" + "visit_interface - " + "TypeCode definition failed\n"), + -1); + } } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp index af56580aa39..9418bdaf777 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp @@ -103,15 +103,11 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: - // @@ What to do with local interface? -#if 0 - { - *os << " = 0;\n\n"; - break; - } -#endif + case TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H: + *os << " = 0;\n\n"; + break; // Fall thru. + case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH: *os << ";\n\n"; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp index ad20f9bd7a8..1bfcf3a5f98 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp @@ -18,9 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" #include "be_visitor_operation.h" @@ -96,7 +96,10 @@ be_visitor_operation_ch::visit_operation (be_operation *node) // STEP 3: generate the argument list with the appropriate mapping. For these // we grab a visitor that generates the parameter listing ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); + if (this->ctx_->state () == TAO_CodeGen::TAO_LOCAL_OPERATION_H) + ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H); + else + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); visitor = tao_cg->make_visitor (&ctx); if (!visitor) { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp index 94a6c91cd88..a58a6c41de8 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp @@ -64,6 +64,9 @@ be_visitor_operation_cs::visit_operation (be_operation *node) os = this->ctx_->stream (); this->ctx_->node (node); // save the node for future use + if (this->ctx_->state () == TAO_CodeGen::TAO_LOCAL_OPERATION_S) + return 0; + os->indent (); // start with the current indentation level // retrieve the operation return type diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index ed5b9180242..7c630b15c1e 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -88,7 +88,7 @@ int be_visitor_root::visit_root (be_root *node) ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CS); break; default: - break; + break; } if (obv) { @@ -492,13 +492,19 @@ be_visitor_root::visit_interface (be_interface *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_ROOT_CH: - ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); + if (! node->is_local_interface ()) + ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); + else + ctx.state (TAO_CodeGen::TAO_LOCAL_INTERFACE_H); break; case TAO_CodeGen::TAO_ROOT_CI: ctx.state (TAO_CodeGen::TAO_INTERFACE_CI); break; case TAO_CodeGen::TAO_ROOT_CS: - ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); + if (! node->is_local_interface ()) + ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); + else + ctx.state (TAO_CodeGen::TAO_LOCAL_INTERFACE_S); break; case TAO_CodeGen::TAO_ROOT_SH: ctx.state (TAO_CodeGen::TAO_INTERFACE_SH); @@ -595,7 +601,7 @@ be_visitor_root::visit_interface (be_interface *node) delete visitor; visitor = 0; } - + return 0; } @@ -751,7 +757,7 @@ be_visitor_root::visit_valuetype (be_valuetype *node) // Do addtional "extra" code generation if necessary if (node->has_extra_code_generation (ctx.state ())) - { + { // Change the state depending on the kind of node strategy ctx.state (node->next_state (ctx.state (), 1)); @@ -776,7 +782,7 @@ be_visitor_root::visit_valuetype (be_valuetype *node) } delete visitor; visitor = 0; - } + } return 0; } diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index 3739337d4f1..7557e560f5f 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -90,7 +90,7 @@ public: // collocated TAO_ATTRIBUTE_SMART_PROXY_CH, // in client header TAO_ATTRIBUTE_SMART_PROXY_CS, // in client source - + TAO_ATTRIBUTE_TIE_SH, TAO_ATTRIBUTE_TIE_SI, @@ -163,6 +163,10 @@ public: TAO_INTERFACE_SMART_PROXY_CH, TAO_INTERFACE_SMART_PROXY_CS, + TAO_LOCAL_INTERFACE_H, + TAO_LOCAL_INTERFACE_I, + TAO_LOCAL_INTERFACE_S, + // emitting code for the interface forward declaration TAO_INTERFACE_FWD_CH, TAO_INTERFACE_FWD_CI, @@ -233,7 +237,7 @@ public: TAO_OPERATION_DIRECT_COLLOCATED_SH, // in collocated server header TAO_OPERATION_DIRECT_COLLOCATED_SS, // in collocated server skel - TAO_OPERATION_SMART_PROXY_CH, // in client header + TAO_OPERATION_SMART_PROXY_CH, // in client header TAO_OPERATION_SMART_PROXY_CS, // in client stubs TAO_OPERATION_RETTYPE_CH, // return type in client header op @@ -286,6 +290,11 @@ public: TAO_OBV_OPERATION_ARGLIST_IMPL_CH, // for implementations, e.g. exception holders TAO_OBV_OPERATION_ARGLIST_IMPL_CS, // for implementations, e.g. exception holders + TAO_LOCAL_OPERATION_H, + TAO_LOCAL_OPERATION_I, + TAO_LOCAL_OPERATION_S, + TAO_LOCAL_OPERATION_ARGLIST_H, + // AMI next generation states TAO_AMI_INTERFACE_CH, TAO_AMI_SENDC_OPERATION_CH, |